liveBook · Manning

Target drift

As explained in Financial AI in Practice

Target drift is a change over time in the distribution or proportion of a model’s target variable.

Target drift is a change over time in the distribution of a model’s target variable. In credit scoring, it can appear as a change in the proportion of borrowers who default. Monitoring that proportion helps risk teams identify shifts that may affect a model’s performance. section 6.2.2 section 6.0

Target drift differs from feature drift: the former tracks outcomes such as default, while the latter tracks changes in input distributions. A report can monitor both, even when the target remains stable and some features have shifted. section 6.2 section 6.2.2

To check target drift with Evidently:

  • Create a reference DataFrame from training features and labels, and a current DataFrame from test features and labels. Put the labels in a target column. section 6.2.1
  • Configure ColumnMapping with the target and numeric and categorical features. Run a Report with DataDriftPreset and TargetDriftPreset, then save the result as HTML. section 6.2.1
  • Inspect the target panel’s reference and current default rates and its Jensen–Shannon divergence score. Review feature shifts separately and consider their business impact. section 6.2.2
Listing 6.9 Creating and saving the Evidently drift report
from evidently import ColumnMapping
from evidently.report import Report
from evidently.metric_preset import DataDriftPreset, TargetDriftPreset

df_train = X_train.copy()    #1
df_train["target"] = y_train.values

df_test = X_test.copy()    #2
df_test["target"] = y_test.values                               

col_map = ColumnMapping(    #3
    target="target",
    numerical_features=X_train.select_dtypes(include="number").columns.tolist(),
    categorical_features=X_train.select_dtypes(exclude="number").columns.tolist()
)

combined_report = Report(     #4
    metrics=[
        DataDriftPreset(),
        TargetDriftPreset()
    ]
)

combined_report.run(      #5
    reference_data=df_train,
    current_data=df_test,
    column_mapping=col_map
)

combined_report.save_html("combined_drift_report.html")    #6
print("Drift report saved to 'combined_drift_report.html'")

The listing implements the combined feature and target drift report, including the target column mapping. section 6.2.1

A rising default rate

If the default rate rises from 26% in the reference data to 31% in current data, the population may be riskier. Risk teams may investigate and consider retraining or recalibrating thresholds. A near-zero target drift score with nearly identical bars instead suggests little change. section 6.2.2

For severe, sustained drift, a champion–challenger comparison can run an updated model alongside the existing one. Archiving HTML reports monthly or quarterly also provides a record for monitoring and compliance reviews. section 6.2.2

How Financial AI in Practice covers it

How deep it goes
Works through dataset preparation, Evidently configuration, dashboard interpretation, and possible responses to detected drift.
Examples
Compares training and test default rates, including an illustrative increase from 26% to 31%.
What you can do after
Apply it via Evidently to generate and interpret a target drift report for credit scoring.
How it connects
Connects target drift with feature drift, Jensen–Shannon divergence, model retraining, and threshold recalibration.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Financial AI in Practice. The section links point to the parts of the book it draws on.