liveBook · Manning

Chapter 11: Monitoring and explainability

What you will learn in chapter 11 of Machine Learning Platform Engineering

This chapter introduces operational monitoring, data drift detection, and explainability as ways to keep deployed ML services reliable and understand their decisions.

After this chapter you will be able to

What it builds on

Section by section

Introduction

This chapter introduces operational monitoring, data drift detection, and explainability as ways to keep deployed ML services reliable and understand their decisions.

Key terms: basic monitoring, service level agreements (SLAs), error budget, BentoML, custom metrics, Alertmanager, data drift monitoring, incoming data, target variable, deepchecks

11.1 Monitoring

This section explains why production applications need monitoring and alerting, then introduces their use in the object detection and movie recommender projects.

Key terms: monitoring, performance anomalies, SLAs, performance metrics, business metrics, resource utilization, response times, alerting

11.1.1 Basic monitoring

This section shows how to verify that Prometheus collects BentoML deployment metrics and import a prebuilt Grafana dashboard for basic monitoring.

Key terms: resource utilization, request tracking metrics, CPU, memory, response time latency, non-200 status codes, /metrics, Prometheus, Service Discovery, PodMonitor

11.1.2 Custom metrics

This section adds application-specific Prometheus metrics to two ML services and shows how to inspect and visualize them in Grafana.

Key terms: confidence score, Histogram, buckets, observe, /invocation, /metrics, le, PromQL, 90th percentile, Gauge

11.1.3 Logging

This section shows how BentoML logs complement metrics and how Loki brings logs into Grafana for centralized monitoring.

Key terms: metrics, logs, logging, observability, BentoML logger, Python logger, service.py, log level, Loki, Grafana

11.1.4 Alerting

This section sets up Prometheus alerts for BentoML service availability and uses Alertmanager to deliver notifications when those alerts fire.

Key terms: Prometheus, Alertmanager, alerting, uptime, up metric, absent function, MissingUpMetric, PromQL, alert group, serverFiles

11.2 Data drift detection

This section introduces an extension of the book’s data drift detection work from a tabular income classifier to object detection and movie recommendation projects.

Key terms: data drift, statistical tests, real-time, batch, object detection, movie recommendation

11.2.1 Object detection

This section shows how to detect image-property drift in an object detection project with deepchecks, then describes how to monitor that drift in production.

Key terms: data drift, image properties, brightness, contrast, aspect ratio, training images, ImageEnhance, PIL, brightness_factor, IDCardDataset

11.2.2 Movie recommender

This section demonstrates how to detect ratings drift in a movie recommender by comparing latent-factor distributions from models trained on drifted and unchanged data.

Key terms: matrix factorization, user-item rating matrix, user factors, item factors, data drift, latent factors, MovieLens, item ratings, user and item factors, embeddings

11.3 Explainability

This section explains why model decisions need to be interpretable, distinguishes two approaches to explainability, and shows why explanations matter for object detection and movie recommendations.

Key terms: explainability, interpretable AI, explainable AI (XAI), monitoring, credit risk models, Equal Credit Opportunity Act (ECOA), model-based explainability, post hoc explainability, linear regression, decision trees

11.3.1 Object detection

This section shows how to generate and interpret Eigen-CAM heatmaps to check what an object detection model focuses on when detecting ID cards.

Key terms: Eigen-CAM, heatmap, Class Activation Mapping (CAM), target layers, object detection, bounding boxes, class probabilities, ID card, training, inference

11.3.2 Movie recommendation

This section shows how an explainable matrix factorization model produces movie recommendations with explanations based on similar users’ ratings.

Key terms: explainable matrix factorization, EMF, latent space, explainability score, user and item neighborhood, MovieLens 100K Dataset, EMFModel, Recommender, EMFExplainer, recs_with_explanations

11.4 Summary

The chapter summary recaps how monitoring, drift detection, and explainability help keep production ML systems reliable, accurate, and understandable.

Where this is used later

Concepts explained in this chapter

← Chapter 10: Model inference and serving Chapter 12: Designing LLM-powered systems →

These guides are generated from the text of Manning books by Manning's knowledge graph and link to the sections they draw on. The full books are available on liveBook and at manning.com.