skip to content

Drift & Performance Platforms

Evidently's DataDriftPreset reports, NannyML's estimators and Arize AX or Fiddler monitors turn logged predictions into drift and performance views. Interviewers ask which to adopt and how it is fed.

on this pageshow

explore

questions

6

In Evidently 0.7, how do you build a drift report with pass/fail tests for a weekly churn batch, and what does running it return?

level: juniorimportance: must knowfreq 14%

answer

  1. one object for metrics and tests
  2. a preset passed inside a list
  3. a Report-level flag, off by default
  4. current first, reference second
  5. the run hands back a snapshot

basics

~10 s

Wrap DataDriftPreset() in Report([...], include_tests=True) and call report.run(current, reference). The call returns a Snapshot holding per-column drift results plus pass/fail tests, which you save as HTML or JSON or upload to an Evidently workspace.

solid answer

~40 s

In Evidently 0.7 one `Report` carries both metrics and tests: `Report([DataDriftPreset()], include_tests=True)`. `include_tests` defaults to `False` on the Report, so without it you get drift scores and charts but no pass/fail verdicts. `report.run(current, reference)` takes the current batch first and the reference second, as pandas DataFrames or as `Dataset` objects built with a `DataDefinition`, and returns a `Snapshot`. With tests on, each column gets a test that fails when drift is detected for it, and the drifted-columns count gets a test that fails once the drifted share reaches `drift_share` (0.5 by default). The snapshot exports with `save_html()`, `save_json()` or `dict()`, or goes to an Evidently workspace with `add_run()`. The older API with a separate `TestSuite` class now lives under `evidently.legacy`.

code

python · 19 lines
python
import sys
import pandas as pd
from evidently import DataDefinition, Dataset, Report
from evidently.presets import DataDriftPreset

definition = DataDefinition(
    numerical_columns=["tenure_months", "monthly_charges", "churn_score"],
    categorical_columns=["plan_type", "contract_type"],
)
reference = Dataset.from_pandas(pd.read_parquet("reference.parquet"), data_definition=definition)
current = Dataset.from_pandas(pd.read_parquet("week_41.parquet"), data_definition=definition)

report = Report([DataDriftPreset()], include_tests=True)
snapshot = report.run(current, reference)  # current first, reference second
snapshot.save_html("churn_drift_week_41.html")

failed = [t for t in snapshot.dict()["tests"] if t["status"] == "FAIL"]
if failed:
    sys.exit(1)

go deeper

for a junior

Recall the shape: Report with a list holding DataDriftPreset, include_tests=True, then run(current, reference), which returns a snapshot you save or upload.

for a middle

Explain what include_tests adds, the per-column and drifted-share tests, how to read test statuses from snapshot.dict(), and how DataDefinition maps column types.

for a senior

Show the report working as a gate: the job reads statuses and fails itself, keeps the HTML as evidence, and stores snapshots in a workspace for history rather than relying on stray files.

for a principal

Weigh where reports live across many models: files per run, a self-hosted workspace or the hosted one, and what uploading input data with include_data means for data handling.

## What a Report is in Evidently 0.7 **Evidently** is an open-source Python library that compares a **current** dataset (for example this week's scored churn batch) with a **reference** dataset (a period the model is known to behave well on) and reports what moved. In the 0.7 line, pinned here at 0.7.23, the central object is `Report`. A Report is a list of **metrics** or **presets** (bundles of metrics) and, optionally, the **tests** generated for them. Running a Report produces a **Snapshot**: the computed results, the rendered widgets and the test outcomes for one run. `DataDriftPreset` is the preset for distribution drift. For every selected column it adds a `ValueDrift` metric, and it adds one `DriftedColumnsCount` metric for the dataset as a whole. The preset picks a statistical test per column automatically; that choice and how to override it is a separate topic. ## Building the weekly churn report 1. Describe the columns. A `DataDefinition` names the numerical and categorical columns (`numerical_columns=[...]`, `categorical_columns=[...]`). Evidently can auto-detect numerical and categorical types, but its docs recommend mapping them explicitly, and text columns must always be mapped. 2. Wrap each DataFrame with `Dataset.from_pandas(df, data_definition=definition)`. A plain DataFrame is also accepted by `run()`, which converts it. 3. Build the report: `Report([DataDriftPreset()], include_tests=True)`. 4. Run it: `snapshot = report.run(current, reference)`. The **first** positional argument is the current data and the **second** the reference. Swapping them silently changes which distribution is treated as the benchmark. 5. Store the snapshot (below). ## What include_tests changes | Report setting | What the snapshot holds | |---|---| | `include_tests=False` (the default) | Drift score and method per column, distribution plots, the share of drifted columns | | `include_tests=True` | All of the above, plus a test per column that is `FAIL` when that column's drift is detected and `SUCCESS` otherwise, and a test on the drifted-columns share that fails once the share reaches `drift_share` | Tests are what turn a report into a gate. Evidently's docs call this a Test Preset: every Report preset can generate its own tests, with conditions derived from the reference or from built-in heuristics. You do not need `include_tests` when you attach tests to a metric by hand. ## Reading and storing the snapshot - `snapshot.save_html("churn_drift_week_41.html")` writes a self-contained page for a human to open. - `snapshot.save_json(...)`, `snapshot.json()` and `snapshot.dict()` give machine-readable output; `dict()` holds a `metrics` list and a `tests` list. - Each test result carries a `status`, one of the statuses Evidently defines, such as `SUCCESS`, `FAIL`, `WARNING` or `ERROR`. - To keep a history instead of loose files, create a project in an Evidently workspace (a local `Workspace` or the hosted `CloudWorkspace`) and call `ws.add_run(project.id, snapshot, include_data=False)`. With `include_data=True` the input datasets are uploaded as well. Evidently does not stop your pipeline by itself. `run()` returns a snapshot whether tests pass or fail, so a scoring job that should halt on drift reads the test statuses and exits non-zero itself. ## Data the drift tests ignore - Columns tested for drift must be non-empty in both datasets, or Evidently raises an error rather than computing drift. - Empty and infinite values are filtered out before the drift calculation, so a rising share of nulls does not by itself move a drift result. Evidently's docs recommend separate tests on the share of missing values for that. ## Choosing what goes in each argument - The **reference** should be a period the team trusts, typically a sample of the training or validation data, or an early production window reviewed as healthy. It is passed on every run, so store it as a fixed file rather than recomputing it each week. - The **current** dataset is the batch being judged: for a weekly churn job, the features and scores of this week's scored subscribers. - Include the model's score column among the numerical columns if prediction drift should be reported alongside feature drift; Evidently evaluates prediction and target columns with the other columns when they are present. ## Code written against the earlier API Tutorials written before 0.7 build a separate test-suite object and import presets from older module paths. In 0.7 that API is kept under `evidently.legacy` (the `TestSuite` class lives there), and the current entry points are `from evidently import Report` and `from evidently.presets import DataDriftPreset`. Code that mixes the two styles is a common source of confusing errors. When you migrate, turn each test suite into a Report with `include_tests=True`, or into explicit tests on its metrics.

  • How do you make the weekly scoring job stop when the Evidently drift tests fail?
    Read `snapshot.dict()["tests"]` and check each result's `status`. When any is `FAIL`, exit non-zero or raise, after saving the HTML so whoever investigates has the evidence. Evidently itself never fails the job: `run()` returns a snapshot whether tests pass or fail.
  • Where should weekly Evidently snapshots go if the team wants a history rather than loose files?
    Create a project in an Evidently workspace, either a local `Workspace` or the hosted `CloudWorkspace`, and call `ws.add_run(project.id, snapshot, include_data=False)`. With `include_data=False` only the computed results are uploaded; `True` also sends the input datasets.
  • A churn feature's null share jumped from 1% to 20% but the Evidently drift test still passed. Why?
    Evidently filters empty and infinite values out before computing drift, so the drift test compares only the non-null values. A null spike needs its own test on the share of missing values, which Evidently's docs recommend running alongside the drift preset.

  • Passes the reference first and the current batch second to report.run
  • Expects pass/fail results without setting include_tests=True on the Report
  • Builds a separate TestSuite object as if it were the current Evidently API
  • Thinks a failed drift test stops the scoring job by itself
  • Assumes a rising share of nulls shows up in the default drift test

Assumes Evidently 0.7.23; in 0.7 tests are part of Report via include_tests and the earlier TestSuite API moved under evidently.legacy.

open as a page

Should a weekly batch churn model use Evidently or NannyML in its scoring job, Arize AX or Fiddler, or a cloud monitor, and what decides it?

level: seniorimportance: must knowfreq 10%

basics

~20 s

The choice turns on data residency, who operates storage and alerting, and label latency: libraries run in the job, managed platforms hold history and joins. SageMaker Model Monitor is closed to new customers; Google Model Monitoring v2 is in Preview.

open as a page

In Evidently 0.7, how does DataDriftPreset pick each column's drift method, and how do you pin one so it stops depending on reference size?

level: middleimportance: should knowfreq 9%

basics

~20 s

DataDriftPreset picks a test from column type, unique-value count and reference size: at 1,000 reference rows or fewer, KS, chi-squared or a Z-test on p-values; above that, normed Wasserstein or Jensen-Shannon at 0.1. Pin it with method, num_method, cat_method or per_column_method.

open as a page

When a weekly churn model logs scores to Arize AX or Fiddler and true churn labels arrive two months later, how are those labels attached?

level: middleimportance: should knowfreq 6%

basics

~20 s

Both join on an identifier sent with each prediction. Arize AX's joiner matches actuals by prediction_id daily, by default only within 14 days of the prediction; Fiddler updates published events by event id with update=True, changing only target and metadata columns.

open as a page

What does NannyML's CBPE need to estimate a churn model's ROC AUC before labels arrive, and when does that estimate mislead?

level: seniorimportance: should knowfreq 8%

basics

~20 s

NannyML's CBPE is fitted on a labelled reference period (y_true, y_pred_proba, and y_pred for threshold metrics), then estimates metrics per chunk from scores alone. It misleads under concept drift, under shift into input regions the reference never covered, and on chunks too small.

open as a page

In NannyML, what does DomainClassifierCalculator catch that UnivariateDriftCalculator misses, and how does chunking change what each reports?

level: middleimportance: nice to knowfreq 5%

basics

~20 s

UnivariateDriftCalculator scores each column on its own, Jensen-Shannon by default. DomainClassifierCalculator trains LightGBM to tell reference rows from each chunk and reports cross-validated AUROC, so it catches changed relationships between features. Both score per chunk, and small chunks add noise.

open as a page