Drift tests, baselines, and alerts
Databricks Machine Learning Professional · Lesson 19 of 22 · 2:16:56
YouTube loads only after you press play. This chapter opens at its timestamp in the full course. Watch on YouTube ↗
Learning with these videos? Subscribe for new courses and exam-style questions.
Subscribe on YouTube (opens in a new tab)In this lesson
Prepare for the Databricks Certified Machine Learning Professional exam. In this lesson: consecutive and baseline drift, the KS and chi-squared tests, PSI and Wasserstein distance, reading significance, and SQL alerts on drift metrics. Includes three original practice questions.
Study notes
The text of this lesson, to read at your own pace. Information as of November 2026.
Numbers nobody reads
Pebblecove's drift dashboard shows dozens of numbers for each feature, every day, and nobody reads them. The team needs to know which numbers mean real drift, compared with what, and who gets told when a threshold is crossed. This lesson covers baselines and consecutive windows, the statistical tests of the drift metrics table, and alerts that notify people.
Baseline or previous window
The drift metrics table compares two distributions, and its drift type column says which two. Consecutive drift compares a window with the previous window, like this week with last week, and catches sudden changes. Baseline drift compares a window with a baseline table, a reference that represents acceptable data, like the training data of the model. A slow drift can pass unnoticed from one week to the next, yet show clearly against the baseline, which is why both are useful. Each row also names the column, the slice, and the granularity, and for consecutive drift, the window it was compared with.
The drift tests
For each column, the drift metrics table stores statistical tests and distances. The KS test compares numerical distributions, and the chi squared test compares categorical ones; each stores a statistic and a p value. The population stability index and the Wasserstein distance measure how far two numerical distributions moved, and other distances, like Jensen Shannon, total variation, and L infinity, compare distributions too. Simpler deltas, like the change in the average, in the count, or in the share of nulls, complete the picture.
Reading significance
A p value answers one question: if nothing had changed, how likely would a difference this large be? Below a level chosen in advance, like 0.0 five, the change is called statistically significant. But on millions of rows, even a tiny and harmless change becomes significant, so the size of the change matters as much: for the population stability index, below 0.1 means no notable change, below 0.2 a moderate one, and from 0.2, a significant one. In practice, alert on a distance or an index above a threshold, and use the p value to confirm it, not alone.
Alerts on drift metrics
An alert on drift is a Databricks SQL alert, built the same way as any other. Write a query on the drift metrics table, for example the highest population stability index of the latest window, against the baseline, for the whole table. The alert runs the query on a schedule, checks a condition, like a value greater than or equal to 0.2, and its state becomes triggered. By default, it sends an email notification, and it can also call a webhook, or post to Slack or PagerDuty. For an inference profile, the same alert can signal that the model should be retrained, as in lesson seventeen.
Recap
Let's recap. Consecutive drift compares a window with the previous one, and baseline drift compares it with a reference, like the training data. The KS test suits numerical columns, and the chi squared test categorical ones, each with a statistic and a p value. On large data, a tiny change can be significant, so check its size: an index from 0.2 is significant. Drift alerts are SQL alerts on the drift metrics table, with a threshold and a schedule. And they notify by email, webhook, Slack, or PagerDuty, or signal retraining.
Quick checks for this lesson
The 3 questions of this lesson, as plain text. The button above runs them with shuffled choices and the reason behind every choice.
The average booking lead time rises by about one day each week, for months. Which comparison reveals it most clearly?
- Consecutive drift, with a daily granularity
- Consecutive drift, with a weekly granularity
- Baseline drift, against the training data
- The count of rows in each window
Show the answer
Baseline drift, against the training data
Against the training data, months of small steps add up to a large and visible drift. “Consecutive drift, with a daily granularity” would compare each day with the day before, where the change is tiny. “Consecutive drift, with a weekly granularity” would compare each week with the last, where the change is still small. And “The count of rows in each window” would count rows, which says nothing about their distribution.
On ten million rows, the KS test on the nightly price gives a p value of 0.001, while the population stability index is 0.02. What does this suggest?
- A significant but tiny change
- A major drift: retrain at once
- A failed test: p must exceed 0.05
- No baseline table was provided
Show the answer
A significant but tiny change
The large sample makes a tiny change significant, while the index stays far below zero point one. “A major drift: retrain at once” would overreact to the p value alone. “A failed test: p must exceed 0.05” is wrong, since a low p value is a valid result. And “No baseline table was provided” is wrong, since both kinds of drift can use these tests.
A drift alert must fire only when the population stability index shows a significant change. Which condition fits?
- psi > 0
- psi >= 0.2
- psi < 0.1
- pvalue > 0.05
Show the answer
psi >= 0.2
From zero point two, the index indicates a significant change in the population. “psi > 0” would fire on almost any value, since the index is rarely exactly zero. “psi < 0.1” would invert the rule, and fires when nothing notable changed. And “pvalue > 0.05” would describe a result that is not significant.