facet.simulation.viz.SimulationMatplotStyle#

class facet.simulation.viz.SimulationMatplotStyle(*, ax=None, colors=None, font_family=None)[source]#

matplotlib style for simulation chart.

Along the range of simulated feature values on the x axis, plots the mean and confidence intervals of the simulated target value.

A bar chart below the plot shows a histogram of actually observed values near the simulated values.

Bases

MatplotStyle, SimulationStyle

Metaclasses

ABCMeta

Parameters
  • ax (Optional[Axes]) – optional axes object to draw on; create a new figure if not specified

  • colors (Optional[MatplotColorScheme]) – the color scheme to be used by this drawing style (default: FacetLightColorScheme())

  • font_family (Union[str, Iterable[str], None]) – name of one or more fonts to use for all text, in descending order of preference; defaults to a monospaced font if undefined, or if none of the given fonts is available

Method summary

apply_color_scheme

See pytools.viz.MatplotStyle.apply_color_scheme()

draw_histogram

Draw the histogram of observed value counts per partition.

draw_uplift

Draw the simulation results as the mean simulated outputs with their confidence intervals.

finalize_drawing

See pytools.viz.MatplotStyle.finalize_drawing()

get_default_style_name

See pytools.viz.MatplotStyle.get_default_style_name()

get_named_styles

See pytools.viz.ColoredStyle.get_named_styles()

get_renderer

See pytools.viz.MatplotStyle.get_renderer()

start_drawing

See pytools.viz.MatplotStyle.start_drawing()

Attribute summary

ax

See pytools.viz.MatplotStyle.ax

colors

See pytools.viz.ColoredStyle.colors

Definitions

apply_color_scheme(ax)#

See pytools.viz.MatplotStyle.apply_color_scheme()

draw_histogram(partitions, frequencies, is_categorical_feature)[source]#

Draw the histogram of observed value counts per partition.

Parameters
  • partitions (Sequence[TypeVar(T_Partition)]) – the partitioning (center values) of the simulated feature

  • frequencies (Sequence[int]) – observed frequencies for each partition

  • is_categorical_feature (bool) – True if the simulated feature is categorical, False otherwise

Return type

None

draw_uplift(feature_name, output_name, output_unit, outputs_mean, outputs_lower_bound, outputs_upper_bound, baseline, confidence_level, partitions, frequencies, is_categorical_feature)[source]#

Draw the simulation results as the mean simulated outputs with their confidence intervals.

Parameters
  • feature_name (str) – name of the simulated feature

  • output_name (Union[str, Sequence[str]]) – name of the target for which output values were simulated

  • output_unit (str) – the unit of the output axis

  • outputs_mean (Sequence[float]) – the mean simulated outputs

  • outputs_lower_bound (Sequence[float]) – the lower CI bounds of the simulated outputs

  • outputs_upper_bound (Sequence[float]) – the upper CI bounds of the simulated outputs

  • baseline (float) – the baseline of the simulation

  • confidence_level (float) – the confidence level used to calculate the CI bounds

  • partitions (Sequence[Any]) – the central or categorical values representing the partitions

  • frequencies (Sequence[int]) – observed frequencies of the partitions

  • is_categorical_feature (bool) – True if the simulated feature is categorical; False otherwise

Return type

None

finalize_drawing(**kwargs)#

See pytools.viz.MatplotStyle.finalize_drawing()

classmethod get_default_style_name()#

See pytools.viz.MatplotStyle.get_default_style_name()

classmethod get_named_styles()#

See pytools.viz.ColoredStyle.get_named_styles()

get_renderer()#

See pytools.viz.MatplotStyle.get_renderer()

start_drawing(*, title, **kwargs)#

See pytools.viz.MatplotStyle.start_drawing()

property ax: matplotlib.axes.Axes#

See pytools.viz.MatplotStyle.ax

property colors: pytools.viz.T_ColorScheme#

See pytools.viz.ColoredStyle.colors