nannyml.performance_estimation.base module

Module containing base classes for performance estimation.

class nannyml.performance_estimation.base.PerformanceEstimator(model_metadata: ModelMetadata, features: Optional[List[str]] = None, chunk_size: Optional[int] = None, chunk_number: Optional[int] = None, chunk_period: Optional[str] = None, chunker: Optional[Chunker] = None)[source]

Bases: ABC

Abstract class for performance estimation.

Creates a new instance of a performance estimator.

Parameters
  • model_metadata (ModelMetadata) – Metadata telling the DriftCalculator what columns are required for drift calculation.

  • features (List[str]) – An optional list of feature column names. When set only these columns will be included in the drift calculation. If not set it will default to all feature column names.

  • chunk_size (int) – Splits the data into chunks containing chunks_size observations. Only one of chunk_size, chunk_number or chunk_period should be given.

  • chunk_number (int) – Splits the data into chunk_number pieces. Only one of chunk_size, chunk_number or chunk_period should be given.

  • chunk_period (str) – Splits the data according to the given period. Only one of chunk_size, chunk_number or chunk_period should be given.

  • chunker (Chunker) – The Chunker used to split the data sets into a lists of chunks.

estimate(data: DataFrame) PerformanceEstimatorResult[source]

Estimate performance given a data set lacking ground truth.

fit(reference_data: DataFrame) PerformanceEstimator[source]

Fits the data on a reference data set.

class nannyml.performance_estimation.base.PerformanceEstimatorResult(estimated_data: DataFrame, model_metadata: ModelMetadata)[source]

Bases: ABC

Contains performance estimation results and provides additional functionality on them.

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(*args, **kwargs) Figure[source]

Plot drift results.