Complete the code to import the monitoring library.
import [1]
The prometheus_client library is commonly used for monitoring metrics in ML systems.
Complete the code to define a gauge metric for prediction distribution.
prediction_gauge = Gauge('[1]', 'Distribution of model predictions')
The gauge name should reflect the metric being tracked, here it is prediction_distribution.
Fix the error in updating the gauge with the latest prediction value.
prediction_gauge.[1](latest_prediction)The correct method to update a Gauge metric value is set.
Fill both blanks to create a dictionary comprehension that filters predictions above a threshold.
{pred: count for pred, count in prediction_counts.items() if pred [1] [2]The comprehension filters predictions greater than 0.5.
Fill all three blanks to create a monitoring alert rule for prediction drift.
alert_rule = {
'alert': '[1]',
'expr': 'abs(prediction_mean - baseline_mean) [2] [3]',
'for': '5m'
}The alert is named PredictionDriftHigh, triggers when the absolute difference is greater than 0.1.