Cert EspressoLearn. Practise. Find your flow.

A LITTLE FOCUS.
A BIG NEXT STEP.

Your pace. Your space.
Databricks · Databricks Machine Learning Associate

Data profiling, drift, and custom metrics

Databricks Machine Learning Associate · Lesson 19 of 19 · 2:29:20

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.

In this lesson

Prepare for the Databricks Certified Machine Learning Associate exam. In this lesson: data profiling for tables and models, snapshot, time series, and inference profiles, consecutive and baseline drift, and custom metrics. Includes three original practice questions.

Study notes

The text of this lesson, to read at your own pace. Information as of November 2026.

Nobody noticed

Three months after the demand model of Juniper Rides went into production, its forecasts drift away from the real rides: a new scooter model changed trip durations, and a large station opened downtown. Nobody noticed, until a manager complained. This lesson covers data profiling, the three profile types, how drift is measured against the previous window or a baseline, and how to add custom metrics.

Data profiling

Data profiling, formerly Lakehouse Monitoring, computes statistics on a Delta table in Unity Catalog, over time, to watch the quality of data and models. You create a profile from the Quality tab of the table in Catalog Explorer, or with the API, and it refreshes on a schedule, or manually. Each refresh writes two metric tables in an output schema: a profile metrics table, with statistics like counts, nulls, averages, and quantiles, and a drift metrics table. A dashboard comes with the profile, and alerts can warn the team when a metric crosses a threshold. Slicing expressions add the same metrics for subsets, like each city, besides the table as a whole.

Profile types

A snapshot profile watches any table as a whole, at each refresh, like the list of scooters and their batteries. A time series profile needs a timestamp column, and splits the data into time windows, by the granularities that you choose, like a day or a week. An inference profile watches a model: its table logs the requests, with a timestamp, the model ID, the input features, the prediction, and, when it arrives, the ground truth label. You also set the problem type, classification or regression, so that the profile computes model metrics, like accuracy and F1, or RMSE and R squared. For time series and inference profiles, turning on the change data feed of the table lets each refresh process only the new rows.

Consecutive and baseline drift

Drift is a change in the distribution of data over time, and the drift metrics table measures it in two ways. Consecutive drift compares each time window with the previous one, like this week against last week, to catch sudden changes. Baseline drift compares each window with a baseline table, an optional reference with the same columns, like the data that the model was trained on, to catch slow changes that build up. For categorical columns, the profile computes a chi squared test, the total variation distance, the L infinity distance, and the Jensen-Shannon distance. For numeric columns, it computes a KS test, the Wasserstein distance, and the population stability index. Drift in the inputs, or in the predictions, can warn before the labels arrive, while a drop in model metrics, once the labels arrive, confirms that the model needs retraining.

Custom metrics

Besides the built in statistics, a profile can compute custom metrics, like a weighted mean, or a business score. An aggregate metric is computed from columns of the primary table, like the average of a product of two columns, and it lands in the profile metrics table. A derived metric is computed from aggregate metrics that already exist, without reading the table again, and it lands in the profile metrics table too. A drift metric compares an aggregate or derived metric between two windows, or with the baseline, and it lands in the drift metrics table. Each one is defined by a Jinja template of a SQL expression, with parameters like input_column, and derived and drift metrics avoid scanning the full table again.

Recap

Let's recap. Data profiling, formerly Lakehouse Monitoring, computes statistics on a table over time, and writes a profile metrics table and a drift metrics table, with a dashboard. Snapshot profiles watch a whole table, time series profiles use time windows, and inference profiles watch a model, with its predictions and labels. Consecutive drift compares a window with the previous one, and baseline drift compares it with a reference table. Categorical columns get tests like chi squared, and numeric columns get tests like KS, Wasserstein, or the population stability index. And custom metrics are aggregate, derived, or drift metrics, and derived and drift metrics reuse what is already computed.

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.

  1. The team wants to watch the damage classifier, from a log of its predictions, the trip features, and the damage labels that arrive a few days later. Which option fits?

    • A snapshot profile of the trips table
    • A time series profile of the features
    • A baseline table of last year’s trips
    • An inference profile of the prediction log
    Show the answer

    An inference profile of the prediction log

    An inference profile watches a model, from a log with timestamps, inputs, predictions, and labels when they arrive, and it computes model metrics. “A snapshot profile of the trips table” watches a table as a whole, with no model metrics. “A time series profile of the features” watches values over time, without the predictions and labels of a model. And “A baseline table of last year’s trips” is not a profile type: a baseline table is an optional reference for drift.

  2. A new battery firmware rolled out slowly over three months, shifting the battery readings a little each week. From one week to the next, the changes look tiny. Which comparison catches the shift best?

    • Baseline drift, against the training data
    • Consecutive drift, week against week
    • Consecutive drift, with daily windows
    • The profile metrics of the latest week
    Show the answer

    Baseline drift, against the training data

    The baseline table holds the reference distribution, so the slow shift adds up against it, week after week. “Consecutive drift, week against week” compares each week with the one before, where every change looks tiny. “Consecutive drift, with daily windows” compares even shorter windows, where the change is smaller still. And “The profile metrics of the latest week” shows one week alone, with nothing to compare it to.

  3. The profile already computes the total rides and the total revenue of each window, as aggregate metrics. The team now wants the revenue per ride, without scanning the table again. Which metric type fits?

    • An aggregate metric over the revenue column
    • A derived metric from the two aggregates
    • A drift metric against the baseline
    • A slicing expression on the revenue
    Show the answer

    A derived metric from the two aggregates

    A derived metric is computed from aggregate metrics that already exist, so the revenue per ride needs no new scan of the table. “An aggregate metric over the revenue column” would read the table again. “A drift metric against the baseline” compares a metric between windows, instead of computing a new one. And “A slicing expression on the revenue” only splits the data into subsets.