liveBook · Manning

Concept drift

As explained in Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI

Concept drift is a change over time in the relationships between input predictors and the target that can make a previously trained model ineffective.

Concept drift occurs when the relationships between predictors and the target change over time, causing a previously effective model to underperform on new data. section 4.3

Cross-validation estimates future performance using current information, but changing economic, consumer, social, or political conditions can eventually invalidate those estimates. section 4.3

Treat concept drift as a model-lifecycle concern:

  • Expect models to require repeated retraining rather than assuming one training cycle remains effective indefinitely. section 7.2.6
  • Interpret strong cross-validation results as estimates based on available data, not guarantees about changed future conditions. section 4.3

An end-to-end model

An XGBoost pipeline can be trained and evaluated through cross-validation, then retrained in later iterations when predictor-target relationships no longer reflect reality. section 7.2.6

Listing 7.18 Training the model with full data
best_params = study.best_params
print(best_params)
 
xgb = XGBRegressor(**best_params)                               #1
model_pipeline = Pipeline([('processing', column_transform), ('xgb', xgb)])
 
cv_splits = cv.split(X, y=X["neighbourhood_more_than_30"])      #2
 
r2_scores = []
rmse_scores = []
mae_scores = []
 
for train_index, test_index in cv_splits:                       #3
    X_train, X_test = X.iloc[train_index], X.iloc[test_index]
    y_train, y_test = y.iloc[train_index], y.iloc[test_index]
 
    model_pipeline.fit(X_train, y_train)
    y_pred = model_pipeline.predict(X_test)
 
    r2_scores.append(r2_score(y_test, y_pred))
    rmse_scores.append(np.sqrt(mean_squared_error(y_test, y_pred)))
    mae_scores.append(mean_absolute_error(y_test, y_pred))
 
print(f"Mean cv R-squared: {np.mean(r2_scores):.3f}")
print(f"Mean cv RMSE: {np.mean(rmse_scores):.3f}")
print(f"Mean cv MAE: {np.mean(mae_scores):.3f}")
 
model_pipeline.fit(X, y)                                        #4

The training listing shows a complete pipeline, cross-validation splits, repeated fitting, predictions, and performance metrics. section 7.2.6

How Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI covers it

How deep it goes
Defines changed predictor-target relationships, explains performance decay, and links drift to retraining without detailing detection.
Examples
Uses economic, consumer, social, and political change, plus an XGBoost pipeline retrained through repeated modeling cycles.
What it assumes
Assumes predictors, targets, model performance, and cross-validation; defines drift through their changing relationships.
What you can do after
Operate/configure retraining cycles when predictor-target relationships change and validation results stop representing later performance.
How it connects
Connects concept drift with cross-validation, data distributions, predictors, target variables, and model retraining.

Also explained in

Compare how 7 books explain concept drift →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Machine Learning for Tabular Data: XGBoost, Deep Learning, and AI. The section links point to the parts of the book it draws on.