nannyml.performance_estimation.confidence_based.results module

Module containing CBPE estimation results and plotting implementations.

class nannyml.performance_estimation.confidence_based.results.Result(results_data: DataFrame, metrics: List[Metric], y_pred: str, y_pred_proba: str | Dict[str, str], y_true: str, chunker: Chunker, problem_type: ProblemType, timestamp_column_name: str | None = None)[source]

Bases: AbstractEstimatorResult

Contains results for CBPE estimation and adds plotting functionality.

Creates a new DriftResult instance.

Parameters:

results_data (pd.DataFrame) – The result data of the performed calculation.

plot(kind: str = 'performance', *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.

Returns:

fig – A Figure object containing the requested drift plot.

Can be saved to disk using the write_image() method or shown rendered on screen using the show() method.

Return type:

plotly.graph_objs._figure.Figure

Examples

>>> import nannyml as nml
>>>
>>> reference_df, analysis_df, target_df = nml.load_synthetic_binary_classification_dataset()
>>>
>>> estimator = nml.CBPE(
>>>     y_true='work_home_actual',
>>>     y_pred='y_pred',
>>>     y_pred_proba='y_pred_proba',
>>>     timestamp_column_name='timestamp',
>>>     metrics=['f1', 'roc_auc']
>>> )
>>>
>>> estimator.fit(reference_df)
>>>
>>> results = estimator.estimate(analysis_df)
>>> results.plot().show()