How Concept Drift Ruins Your Model Performance
By: Alexandra Amidon
Tags: Modeling, Regime Change, Artificial Intelligence, Data Science, Machine Learning

The world is inherently dynamic and nonstationary — that is, constantly changing.

It is inevitable that the performance of many machine learning models will decline over time. This is particularly relevant for models related to human behavior. Contemporary machine learning models do not generalize well to new environments without explicit training examples. Model performance may start to degrade as data and the “ground truth” change over time. These are critical weaknesses that must be accounted for in machine learning systems. But what are the characteristics of such changes, which result in low-quality responses from models? How can you monitor and maintain your models so that the downstream user always sees quality outputs?

It is essential to anticipate how changes in data from dynamic real world environments will affect your models and how to handle these changes.

This article will first provide a theoretical foundation for understanding how concept drift can appear and behave and then discuss approaches for addressing drift. Understanding how data and models can drift is essential for designing a model monitor and response plan.

What is Concept Drift?

The image below provides a simple illustration of a “concept”. The 2-dimensional data points are mapped to either the color red or green, according to some unknown process G. The “concept” is the true mapping G→{green, red} of data points to color. The light grey line shows the learned mapping F that distinguishes between red and green data points that approximates G.

A concept — the distinction between red and green data points. The grey line represents the learned concept distinguishing between red and green.

Simply stated, concept drift occurs when there is a change in G, the underlying function that generates the data you observe. Of course, we cannot observe G directly. Instead, we observe G indirectly by sampling from the data generated by G. This definition assumes that we receive data points over time that describe some phenomenon that we want to model, such as toilet paper consumption.

In the case of toilet paper demand, the underlying data generating function is the quantity of toilet paper consumed (and hoarded). Actual flushing (G) and hoarding of toilet paper cannot be observed directly of course. Instead, we can only “sample” from actual consumption by observing the quantity purchased through various supply channels. We then train a model, F, of toilet paper consumption using observed purchase data. COVID-19 induced changes in toilet paper consumption and purchase patterns — aka drift in G.

What Does Concept Drift Look Like?

Drift can appear as either virtual drift (no immediate impact on model performance) or real drift (impact on model performance). Note that the distinction is relative to a model.

Real Concept Drift

Real concept drift is a change in the mechanism that generates your data, such that your model’s performance decreases. As shown by the illustration below, the concept (distinction between red and green data points) has rotated and changed shape. A model that learned the concept during Regime A is now obsolete under Regime B and will have poor performance. Absent updates to the model after real concept drift, the model will no longer correctly describe the full target concept space.

Real concept drift from Regime A to Regime B. The function learned during Regime A misclassifies some data points observed in Regime B.

In terms of toilet paper, the pre-COVID consumption pattern is “Regime A” and the post-COVID consumption pattern is “Regime B”. A model that proficiently forecasts TP demand in 2019 before the pandemic would perform poorly in 2020 during the pandemic. Vice versa, a model that has been updated to forecast TP demand during COVID-induced economic lockdowns, where people seldom leave home, would likely perform poorly on historical data where people often leave home.

Virtual Concept Drift

Concept drift in G does not necessarily affect the accuracy of your model F. In virtual concept drift, the distribution of observed data has changed, but the previously learned mapping F still correctly applies to the new data generating process G’. The chart below illustrates virtual drift from Regime A to Regime B. Although the distribution of the data in each regime is different, the model F still assigns the data point color correctly per the light grey line. Thus, your machine learning model only becomes obsolete under real concept drift.

Virtual concept drift from Regime A to Regime B. The function F (grey line dividing red and green points) trained on data from Regime A is still valid in Regime B.

In the real world, your model performance will not indicate that virtual drift has occurred because your model is still performing well! Indeed, even if you are monitoring the distribution of the data itself, you may require a “large” number of observations to ascertain the presence of virtual drift. (Monitoring the distribution of your data directly is usually impractical if it has more than a couple dimensions).

Is virtual drift a problem? It depends. If your objective is to ensure that your model continues to meet given performance metrics, then your model is sufficient in the presence of virtual drift. Virtual drift presents a hidden risk that the model may treat certain outlier observations from the new distribution incorrectly.

Hidden risk of virtual drift: What are the correct classifications of the grey data points in Regime B? Will the model (grey line) continue to produce accurate predictions for these points?

Drift Severity

The severity of drift can vary widely. Most concept drift occurs as intersected drift, where part of the input space has the same target class in both the old and new concepts. In the extreme, severe drift occurs when all examples are misclassified under the new target concept. Misclassifications can be due to new classes in the target concept and changes in the class definition.

Intersected drift occurred between Regime A and Regime B as only some data point classifications changed. Severe drift occurred between Regime A and Regime C, where all the classification of all data points changed.

If you can detect and measure drift, you could specify a threshold to distinguish between “major” and “minor” drift. Drift magnitude for a binary classification task could be measured as the percentage of observations whose class has changed. If the drift magnitude is less than the threshold, the model simply requires updating with new data. If the drift magnitude is greater than the threshold, the drift is “severe” and the model ought to be abandoned in favor of a freshly trained model. Severe drift is typically rare and the presence of severe drift is often apparent without the use of sophisticated drift detection.

Drift Velocity and Stability

Abrupt drift

Concept drift with a short drift duration is known as abrupt drift. Abrupt drift occurs when the data generating function suddenly stops generating data with concept G and suddenly generates data according to concept G’. The abrupt drift paradigm assumes that concept drift occurs over discrete periods of time, bounded by stable periods without drift.

As an example of a sequence of abrupt drifts, the medical journal Lancet reported that China changed the case definition for COVID-19 seven times between Jan 15 and March 3, 2020. Each change in definition caused a change in how the cases were counted; thus each change caused an abrupt drift in the concept of daily COVID case counts in China.

Incremental Drift and Stability

Incremental drift implies a long drift duration, also known as continuous drift. In this case, the change is a steady progression from concept G to concept G’. The speed, or duration, of concept drift is the number of time steps for a new concept to completely replace an old concept.

In the case of classification, at each subsequent timestep, fewer data points are classified according to the old concept G and more data points are classified according to the new concept G’. You could think of each of these time steps between G and G’ as distinct, intermediate concepts.

An example of incremental drift would be how consumer behavior gradually changes as COVID-19 economic lockdowns are lifted in an area — people may be hesitant to return to “normal” and only return slowly. Each small change in behavior is an intermediate concept between G (behavior during lockdown) and G’ (“normal” behavior after restriction is lifted). It is worth noting that the progression from behavior in G (lockdown) to G’ (“normal”) is nonlinear as people idiosyncratically alter their behavior in response to exogenous factors like changes in case numbers.

A concept is unstable between concepts G and G’, the period between concepts because it will change again. This instability could be observed as greater noise in the data and in your model metrics. Further, some concepts are inherently unstable and chaotic, never arriving at a stable concept, such as market price movements.

The chart below illustrates incremental drift that progresses over a period of 100 time steps. The functions v1(t) and v2(t) model the probability that an example from the old and new concepts, respectively, will be presented at time t. The speed of drift is the slope of v2(t).

Illustration of incremental drift. (Source: Minku, White, and Yao 2010)

How do you detect and address drift?

This discussion, of course, would be incomplete without solutions to detecting and correcting for drift in models and data. Many refer to the subject of drift detection as model monitoring.

The basic approach to addressing concept drift is to monitor your model to detect drift, retrain the model, and deploy the new model version.

This basic approach works well for regimes where you expect concept drift to abruptly shift from one stable concept to a new stable concept. It can also be acceptable in cases with small and/or incremental drift if there is some tolerance for variation in model performance. For less stable regimes or situations where continuous drift is expected, incremental updates of your model with new observations may be more appropriate. In the case of online model updates, it is still important to monitor for model drift.

There are three basic approaches to monitoring for concept drift.

Monitor model performance

Monitoring model performance is straight forward in principle: if the model performance declines below some expected level, reevaluate the model. To implement this, you need to make several decisions that will impact the sensitivity and frequency of your drift detection.

1. How many new predictions do you use in calculating model performance?

2. Which performance metric(s) do you evaluates and which threshold(s) do you apply?

3.How often will you monitor for drift?

4. How error-tolerant is the user of your model? This will help inform your answers to (1)-(3).

5. How do you respond to drift? Manual evaluation and retraining of your model? Automatic updates?

Monitor statistical measures of confidence in model predictions

Another approach is to monitor the distribution of model prediction or residual values or the confidence in those values. It is far easier to monitor distributional changes the value(s) produced by your model than the potentially high-dimensional input data. The specific formulation of the the statistical monitor depends on the speed and quantity of predictions to monitor. In addition to the questions in the previous section, some relevant decisions to make include:

Does the Kolmogorov–Smirnov (KS) test indicate that distribution of your prediction or residual values has changed? Some minimum number of examples are required in order to accurately compare whether two distributions are the same with the KS test.

Does a given prediction / residual fall within a given confidence interval of the distribution of predictions / residuals observed during training?

For other adaptive test statistics for drift detection in the academic literature, refer to Dries and Ruckert (2009) in the References section.

Online updates

One option is to train your model online — that is, automatically update your model weights with new observations on a periodic basis. The periodicity of updates could be daily, weekly, or each time you receive new data. This solution is ideal if you anticipate incremental concept drift or an unstable concept.

This option is not foolproof because there is still some risk that model drifts away from true target in spite of the online updates. This could occur for a number of reasons.

An outlier could have an outsized influence on the model in online training, pulling the learned model further away from the target concept. This risk can be mitigated by conducting online updates with batches of observations, rather than with single data points.

The learning rate could be too small, preventing the model from updating quickly enough in the presence of large drift.

The learning rate could also be too large, causing the model to overshoot the target concept and to continue to perform poorly.

For these reasons, it is still important to monitor models that are updated online.

Other approaches

Various algorithms have been proposed in the academic literature to detect concept drift. Work in drift detection generally aims to efficiently identify the true points of concept drift with accuracy while also minimizing the drift detection time. A review of these proposals is outside the scope of this article.