The classes representing the results of a target distribution calculation.

class pandas.core.frame.DataFrame, model_metadata: nannyml.metadata.base.ModelMetadata)[source]

Bases: object

Contains target distribution data and utilities to plot it.

Creates a new instance of the TargetDistributionResults.

plot(kind: str = 'distribution', distribution: str = 'metric', *args, **kwargs) plotly.graph_objs._figure.Figure[source]

Renders a line plot of the target distribution.

Chunks are set on a time-based X-axis by using the period containing their observations. Chunks of different partitions (reference and analysis) are represented using different colors and a vertical separation if the drift results contain multiple partitions.

  • kind (str) – The kind of plot to show. Restricted to the value ‘distribution’.

  • distribution (str, default='metric') – The kind of distribution to plot. Restricted to the values ‘metric’ or ‘statistical’


fig – A Figure object containing the requested drift plot. Can be saved to disk or shown rendered on screen using

Return type



>>> import nannyml as nml
>>> ref_df, ana_df, _ = nml.load_synthetic_binary_classification_dataset()
>>> metadata = nml.extract_metadata(ref_df, model_type=nml.ModelType.CLASSIFICATION_BINARY)
>>> target_distribution_calc = nml.TargetDistributionCalculator(model_metadata=metadata, chunk_period='W')
>>> target_distribution = target_distribution_calc.calculate(ana_df)
>>> # plot the distribution of the mean
>>> target_distribution.plot(kind='metric').show()
>>> # plot the Chi square statistic
>>> target_distribution.plot(kind='statistical').show()