Monitoring Machine Learning in Python
Hakim Elakhrass
CEO and co-founder
Kolgomorov-Smirnov - only continuous
L-infinity - only categorical
Chi2 - only categorical
# Intialize the univariate drift calculator
uv_calc = nannyml.UnivariateDriftCalculator(
continuous_methods=['wasserstein', 'hellinger'],
categorical_methods=['jensen_shannon', 'l_infinity', 'chi2'],
column_names=feature_column_names,
timestamp_column_name='timestamp',
chunk_period='d'
)
# Fit, calculate and plot the results
uv_calc.fit(reference)
uv_results = uv_calc.calculate(analysis)
uv_results.plot().show()
# Filter the univariate results
filtered_figure = uv_results.filter(column_names=['trip_distance', 'fare_amount'],
methods=['jensen_shannon'])
# Plot the filtered results
filtered_figure.show().plot()
# Initialize the alert count ranker
alert_count_ranker = nannyml.AlertCountRanker()
alert_count_ranked_results = alert_count_ranker.rank(
uv_results,
only_drifting=False)
# Display the results
display(alert_count_ranked_results)
# Initialize the correlation ranker
correlation_ranker = nannyml.CorrelationRanker()
correlation_ranker.fit(perf_results.filter(period='reference'))
correlation_ranked_results = correlation_ranker.rank(uv_results, perf_results)
# Display the results
display(correlation_ranked_results)
# Create distribution plots
distribution_results = uv_results.plot(kind='distribution')
# Show the plots
distribution_results.show()
Monitoring Machine Learning in Python