Monitoring Machine Learning in Python
Maciej Balawejder
Data Scientist


# Initialize the algorithm
cbpe = nannyml.CBPE(
   problem_type='classification_binary',
   y_pred_proba='predicted_probability',
   y_pred='prediction',
   y_true='employed',
   metrics=['roc_auc'],
   chunk_period='m',
   # chunk_size = 5000, 
   # chunk_number = 10
)
Standard deviation thresholds
# Standard deviation thresholds
stdt = StandardDeviationThreshold(
    std_lower_multiplier=3, 
    std_upper_multiplier=3
    )
Constant thresholds
# Constant thresholds
ct = ConstantThreshold(
    lower=0.85, 
    upper=0.95
    )
# Import threshold methods(last slide)
from nannyml.thresholds import ConstantThreshold, StandardDeviationThreshold
# Passing thresholds to the CBPE algorithm
estimator = nannyml.CBPE(...
    metrics = ['roc_auc', 'accuracy'],
    thresholds={'roc_auc': ct, 'accuracy' : stdt}
)

filtered_results = results.filter(period='analysis')
By metrics
filtered_results = results.filter(metrics=['mae'])
Both
filtered_results = results.filter(period='analysis', metrics=['mae'])
# Export results to dataframe format
results.filter(period='analysis').to_df()

Monitoring Machine Learning in Python