nannyml.performance_estimation.confidence_based.results module

Module containing CBPE estimation results and plotting implementations.

class nannyml.performance_estimation.confidence_based.results.CBPEPerformanceEstimatorResult(estimated_data: DataFrame, model_metadata: ModelMetadata)[source]

Bases: PerformanceEstimatorResult

Contains results for CBPE estimation and adds plotting functionality.

Creates a new DriftResult instance.

Parameters
  • estimated_data (pd.DataFrame) – The results of the estimate() call.

  • model_metadata (ModelMetadata) – The metadata describing the monitored model.

plot(kind: str = 'performance', metric: Optional[str] = None, *args, **kwargs) Figure[source]

Render plots based on CBPE estimation results.

This function will return a plotly.graph_objects.Figure object. The following kinds of plots are available:

  • performance: a line plot rendering the estimated performance per Chunk after

    applying the calculate() method on a chunked dataset.

Parameters
  • kind (str, default='performance') – The kind of plot to render. Only the ‘performance’ plot is currently available.

  • metric (str, default=None) – The metric to plot when rendering a plot of kind ‘performance’.

Examples

>>> 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)
>>> estimator = nml.CBPE(model_metadata=metadata, chunk_period='W')
>>> estimator.fit(ref_df)
>>> estimates = estimator.estimate(ana_df)
>>> # plot the estimated performance
>>> estimates.plot(kind='performance').show()