Stay Ahead, Stay ONMINE

How to Spot and Prevent Model Drift Before it Impacts Your Business

Despite the AI hype, many tech companies still rely heavily on machine learning to power critical applications, from personalized recommendations to fraud detection.  I’ve seen firsthand how undetected drifts can result in significant costs — missed fraud detection, lost revenue, and suboptimal business outcomes, just to name a few. So, it’s crucial to have robust monitoring in place if your company has deployed or plans to deploy machine learning models into production. Undetected Model Drift can lead to significant financial losses, operational inefficiencies, and even damage to a company’s reputation. To mitigate these risks, it’s important to have effective model monitoring, which involves: Tracking model performance Monitoring feature distributions Detecting both univariate and multivariate drifts A well-implemented monitoring system can help identify issues early, saving considerable time, money, and resources. In this comprehensive guide, I’ll provide a framework on how to think about and implement effective Model Monitoring, helping you stay ahead of potential issues and ensure stability and reliability of your models in production. What’s the difference between feature drift and score drift? Score drift refers to a gradual change in the distribution of model scores. If left unchecked, this could lead to a decline in model performance, making the model less accurate over time. On the other hand, feature drift occurs when one or more features experience changes in the distribution. These changes in feature values can affect the underlying relationships that the model has learned, and ultimately lead to inaccurate model predictions. Simulating score shifts To model real-world fraud detection challenges, I created a synthetic dataset with five financial transaction features. The reference dataset represents the original distribution, while the production dataset introduces shifts to simulate an increase in high-value transactions without PIN verification on newer accounts, indicating an increase in fraud. Each feature has different underlying distributions: Transaction Amount: Log-normal distribution (right-skewed with a long tail) Account Age (months): clipped normal distribution between 0 to 60 (assuming a 5-year-old company) Time Since Last Transaction: Exponential distribution Transaction Count: Poisson distribution Entered PIN: Binomial distribution. To approximate model scores, I randomly assigned weights to these features and applied a sigmoid function to constrain predictions between 0 to 1. This mimics how a logistic regression fraud model generates risk scores. As shown in the plot below: Drifted features: Transaction Amount, Account Age, Transaction Count, and Entered PIN all experienced shifts in distribution, scale, or relationships. Distribution of drifted features (image by author) Stable feature: Time Since Last Transaction remained unchanged. Distribution of stable feature (image by author) Drifted scores: As a result of the drifted features, the distribution in model scores has also changed. Distribution of model scores (image by author) This setup allows us to analyze how feature drift impacts model scores in production. Detecting model score drift using PSI To monitor model scores, I used population stability index (PSI) to measure how much model score distribution has shifted over time. PSI works by binning continuous model scores and comparing the proportion of scores in each bin between the reference and production datasets. It compares the differences in proportions and their logarithmic ratios to compute a single summary statistic to quantify the drift. Python implementation: # Define function to calculate PSI given two datasets def calculate_psi(reference, production, bins=10): # Discretize scores into bins min_val, max_val = 0, 1 bin_edges = np.linspace(min_val, max_val, bins + 1) # Calculate proportions in each bin ref_counts, _ = np.histogram(reference, bins=bin_edges) prod_counts, _ = np.histogram(production, bins=bin_edges) ref_proportions = ref_counts / len(reference) prod_proportions = prod_counts / len(production) # Avoid division by zero ref_proportions = np.clip(ref_proportions, 1e-8, 1) prod_proportions = np.clip(prod_proportions, 1e-8, 1) # Calculate PSI for each bin psi = np.sum((ref_proportions – prod_proportions) * np.log(ref_proportions / prod_proportions)) return psi # Calculate PSI psi_value = calculate_psi(ref_data[‘model_score’], prod_data[‘model_score’], bins=10) print(f”PSI Value: {psi_value}”) Below is a summary of how to interpret PSI values: PSI < 0.1: No drift, or very minor drift (distributions are almost identical). 0.1 ≤ PSI < 0.25: Some drift. The distributions are somewhat different. 0.25 ≤ PSI < 0.5: Moderate drift. A noticeable shift between the reference and production distributions. PSI ≥ 0.5: Significant drift. There is a large shift, indicating that the distribution in production has changed substantially from the reference data. Histogram of model score distributions (image by author) The PSI value of 0.6374 suggests a significant drift between our reference and production datasets. This aligns with the histogram of model score distributions, which visually confirms the shift towards higher scores in production — indicating an increase in risky transactions. Detecting feature drift Kolmogorov-Smirnov test for numeric features The Kolmogorov-Smirnov (K-S) test is my preferred method for detecting drift in numeric features, because it is non-parametric, meaning it doesn’t assume a normal distribution. The test compares a feature’s distribution in the reference and production datasets by measuring the maximum difference between the empirical cumulative distribution functions (ECDFs). The resulting K-S statistic ranges from 0 to 1: 0 indicates no difference between the two distributions. Values closer to 1 suggest a greater shift. Python implementation: # Create an empty dataframe ks_results = pd.DataFrame(columns=['Feature', 'KS Statistic', 'p-value', 'Drift Detected']) # Loop through all features and perform the K-S test for col in numeric_cols: ks_stat, p_value = ks_2samp(ref_data[col], prod_data[col]) drift_detected = p_value < 0.05 # Store results in the dataframe ks_results = pd.concat([ ks_results, pd.DataFrame({ 'Feature': [col], 'KS Statistic': [ks_stat], 'p-value': [p_value], 'Drift Detected': [drift_detected] }) ], ignore_index=True) Below are ECDF charts of the four numeric features in our dataset: ECDFs of four numeric features (image by author) Let’s look at the account age feature as an example: the x-axis represents account age (0-50 months), while the y-axis shows the ECDF for both reference and production datasets. The production dataset skews towards newer accounts, as it has a larger proportion of observations have lower account ages. Chi-Square test for categorical features To detect shifts in categorical and boolean features, I like to use the Chi-Square test. This test compares the frequency distribution of a categorical feature in the reference and production datasets, and returns two values: Chi-Square statistic: A higher value indicates a greater shift between the reference and production datasets. P-value: A p-value below 0.05 suggests that the difference between the reference and production datasets is statistically significant, indicating potential feature drift. Python implementation: # Create empty dataframe with corresponding column names chi2_results = pd.DataFrame(columns=['Feature', 'Chi-Square Statistic', 'p-value', 'Drift Detected']) for col in categorical_cols: # Get normalized value counts for both reference and production datasets ref_counts = ref_data[col].value_counts(normalize=True) prod_counts = prod_data[col].value_counts(normalize=True) # Ensure all categories are represented in both all_categories = set(ref_counts.index).union(set(prod_counts.index)) ref_counts = ref_counts.reindex(all_categories, fill_value=0) prod_counts = prod_counts.reindex(all_categories, fill_value=0) # Create contingency table contingency_table = np.array([ref_counts * len(ref_data), prod_counts * len(prod_data)]) # Perform Chi-Square test chi2_stat, p_value, _, _ = chi2_contingency(contingency_table) drift_detected = p_value < 0.05 # Store results in chi2_results dataframe chi2_results = pd.concat([ chi2_results, pd.DataFrame({ 'Feature': [col], 'Chi-Square Statistic': [chi2_stat], 'p-value': [p_value], 'Drift Detected': [drift_detected] }) ], ignore_index=True) The Chi-Square statistic of 57.31 with a p-value of 3.72e-14 confirms a large shift in our categorical feature, Entered PIN. This finding aligns with the histogram below, which visually illustrates the shift: Distribution of categorical feature (image by author) Detecting multivariate shifts Spearman Correlation for shifts in pairwise interactions In addition to monitoring individual feature shifts, it’s important to track shifts in relationships or interactions between features, known as multivariate shifts. Even if the distributions of individual features remain stable, multivariate shifts can signal meaningful differences in the data. By default, Pandas’ .corr() function calculates Pearson correlation, which only captures linear relationships between variables. However, relationships between features are often non-linear yet still follow a consistent trend. To capture this, we use Spearman correlation to measure monotonic relationships between features. It captures whether features change together in a consistent direction, even if their relationship isn’t strictly linear. To assess shifts in feature relationships, we compare: Reference correlation (ref_corr): Captures historical feature relationships in the reference dataset. Production correlation (prod_corr): Captures new feature relationships in production. Absolute difference in correlation: Measures how much feature relationships have shifted between the reference and production datasets. Higher values indicate more significant shifts. Python implementation: # Calculate correlation matrices ref_corr = ref_data.corr(method='spearman') prod_corr = prod_data.corr(method='spearman') # Calculate correlation difference corr_diff = abs(ref_corr – prod_corr) Example: Change in correlation Now, let’s look at the correlation between transaction_amount and account_age_in_months: In ref_corr, the correlation is 0.00095, indicating a weak relationship between the two features. In prod_corr, the correlation is -0.0325, indicating a weak negative correlation. Absolute difference in the Spearman correlation is 0.0335, which is a small but noticeable shift. The absolute difference in correlation indicates a shift in the relationship between transaction_amount and account_age_in_months. There used to be no relationship between these two features, but the production dataset indicates that there is now a weak negative correlation, meaning that newer accounts have higher transaction accounts. This is spot on! Autoencoder for complex, high-dimensional multivariate shifts In addition to monitoring pairwise interactions, we can also look for shifts across more dimensions in the data. Autoencoders are powerful tools for detecting high-dimensional multivariate shifts, where multiple features collectively change in ways that may not be apparent from looking at individual feature distributions or pairwise correlations. An autoencoder is a neural network that learns a compressed representation of data through two components: Encoder: Compresses input data into a lower-dimensional representation. Decoder: Reconstructs the original input from the compressed representation. To detect shifts, we compare the reconstructed output to the original input and compute the reconstruction loss. Low reconstruction loss → The autoencoder successfully reconstructs the data, meaning the new observations are similar to it has seen and learned. High reconstruction loss → The production data deviates significantly from the learned patterns, indicating potential drift. Unlike traditional drift metrics that focus on individual features or pairwise relationships, autoencoders capture complex, non-linear dependencies across multiple variables simultaneously. Python implementation: ref_features = ref_data[numeric_cols + categorical_cols] prod_features = prod_data[numeric_cols + categorical_cols] # Normalize the data scaler = StandardScaler() ref_scaled = scaler.fit_transform(ref_features) prod_scaled = scaler.transform(prod_features) # Split reference data into train and validation np.random.shuffle(ref_scaled) train_size = int(0.8 * len(ref_scaled)) train_data = ref_scaled[:train_size] val_data = ref_scaled[train_size:] # Build autoencoder input_dim = ref_features.shape[1] encoding_dim = 3 # Input layer input_layer = Input(shape=(input_dim, )) # Encoder encoded = Dense(8, activation="relu")(input_layer) encoded = Dense(encoding_dim, activation="relu")(encoded) # Decoder decoded = Dense(8, activation="relu")(encoded) decoded = Dense(input_dim, activation="linear")(decoded) # Autoencoder autoencoder = Model(input_layer, decoded) autoencoder.compile(optimizer="adam", loss="mse") # Train autoencoder history = autoencoder.fit( train_data, train_data, epochs=50, batch_size=64, shuffle=True, validation_data=(val_data, val_data), verbose=0 ) # Calculate reconstruction error ref_pred = autoencoder.predict(ref_scaled, verbose=0) prod_pred = autoencoder.predict(prod_scaled, verbose=0) ref_mse = np.mean(np.power(ref_scaled – ref_pred, 2), axis=1) prod_mse = np.mean(np.power(prod_scaled – prod_pred, 2), axis=1) The charts below show the distribution of reconstruction loss between both datasets. Distribution of reconstruction loss between actuals and predictions (image by author) The production dataset has a higher mean reconstruction error than that of the reference dataset, indicating a shift in the overall data. This aligns with the changes in the production dataset with a higher number of newer accounts with high-value transactions. Summarizing Model monitoring is an essential, yet often overlooked, responsibility for data scientists and machine learning engineers. All the statistical methods led to the same conclusion, which aligns with the observed shifts in the data: they detected a trend in production towards newer accounts making higher-value transactions. This shift resulted in higher model scores, signaling an increase in potential fraud. In this post, I covered techniques for detecting drift on three different levels: Model score drift: Using Population Stability Index (PSI) Individual feature drift: Using Kolmogorov-Smirnov test for numeric features and Chi-Square test for categorical features Multivariate drift: Using Spearman correlation for pairwise interactions and autoencoders for high-dimensional, multivariate shifts. These are just a few of the techniques I rely on for comprehensive monitoring — there are plenty of other equally valid statistical methods that can also detect drift effectively. Detected shifts often point to underlying issues that warrant further investigation. The root cause could be as serious as a data collection bug, or as minor as a time change like daylight savings time adjustments. There are also fantastic python packages, like evidently.ai, that automate many of these comparisons. However, I believe there’s significant value in deeply understanding the statistical techniques behind drift detection, rather than relying solely on these tools. What’s the model monitoring process like at places you’ve worked? Want to build your AI skills? 👉🏻 I run the AI Weekender and write weekly blog posts on data science, AI weekend projects, career advice for professionals in data. Resources

Despite the AI hype, many tech companies still rely heavily on machine learning to power critical applications, from personalized recommendations to fraud detection. 

I’ve seen firsthand how undetected drifts can result in significant costs — missed fraud detection, lost revenue, and suboptimal business outcomes, just to name a few. So, it’s crucial to have robust monitoring in place if your company has deployed or plans to deploy machine learning models into production.

Undetected Model Drift can lead to significant financial losses, operational inefficiencies, and even damage to a company’s reputation. To mitigate these risks, it’s important to have effective model monitoring, which involves:

  • Tracking model performance
  • Monitoring feature distributions
  • Detecting both univariate and multivariate drifts

A well-implemented monitoring system can help identify issues early, saving considerable time, money, and resources.

In this comprehensive guide, I’ll provide a framework on how to think about and implement effective Model Monitoring, helping you stay ahead of potential issues and ensure stability and reliability of your models in production.

What’s the difference between feature drift and score drift?

Score drift refers to a gradual change in the distribution of model scores. If left unchecked, this could lead to a decline in model performance, making the model less accurate over time.

On the other hand, feature drift occurs when one or more features experience changes in the distribution. These changes in feature values can affect the underlying relationships that the model has learned, and ultimately lead to inaccurate model predictions.

Simulating score shifts

To model real-world fraud detection challenges, I created a synthetic dataset with five financial transaction features.

The reference dataset represents the original distribution, while the production dataset introduces shifts to simulate an increase in high-value transactions without PIN verification on newer accounts, indicating an increase in fraud.

Each feature has different underlying distributions:

  • Transaction Amount: Log-normal distribution (right-skewed with a long tail)
  • Account Age (months): clipped normal distribution between 0 to 60 (assuming a 5-year-old company)
  • Time Since Last Transaction: Exponential distribution
  • Transaction Count: Poisson distribution
  • Entered PIN: Binomial distribution.

To approximate model scores, I randomly assigned weights to these features and applied a sigmoid function to constrain predictions between 0 to 1. This mimics how a logistic regression fraud model generates risk scores.

As shown in the plot below:

  • Drifted features: Transaction Amount, Account Age, Transaction Count, and Entered PIN all experienced shifts in distribution, scale, or relationships.
Distribution of drifted features (image by author)
  • Stable feature: Time Since Last Transaction remained unchanged.
Distribution of stable feature (image by author)
  • Drifted scores: As a result of the drifted features, the distribution in model scores has also changed.
Distribution of model scores (image by author)

This setup allows us to analyze how feature drift impacts model scores in production.

Detecting model score drift using PSI

To monitor model scores, I used population stability index (PSI) to measure how much model score distribution has shifted over time.

PSI works by binning continuous model scores and comparing the proportion of scores in each bin between the reference and production datasets. It compares the differences in proportions and their logarithmic ratios to compute a single summary statistic to quantify the drift.

Python implementation:

# Define function to calculate PSI given two datasets
def calculate_psi(reference, production, bins=10):
  # Discretize scores into bins
  min_val, max_val = 0, 1
  bin_edges = np.linspace(min_val, max_val, bins + 1)

  # Calculate proportions in each bin
  ref_counts, _ = np.histogram(reference, bins=bin_edges)
  prod_counts, _ = np.histogram(production, bins=bin_edges)

  ref_proportions = ref_counts / len(reference)
  prod_proportions = prod_counts / len(production)
  
  # Avoid division by zero
  ref_proportions = np.clip(ref_proportions, 1e-8, 1)
  prod_proportions = np.clip(prod_proportions, 1e-8, 1)

  # Calculate PSI for each bin
  psi = np.sum((ref_proportions - prod_proportions) * np.log(ref_proportions / prod_proportions))

  return psi
  
# Calculate PSI
psi_value = calculate_psi(ref_data['model_score'], prod_data['model_score'], bins=10)
print(f"PSI Value: {psi_value}")

Below is a summary of how to interpret PSI values:

  • PSI < 0.1: No drift, or very minor drift (distributions are almost identical).
  • 0.1 ≤ PSI < 0.25: Some drift. The distributions are somewhat different.
  • 0.25 ≤ PSI < 0.5: Moderate drift. A noticeable shift between the reference and production distributions.
  • PSI ≥ 0.5: Significant drift. There is a large shift, indicating that the distribution in production has changed substantially from the reference data.
Histogram of model score distributions (image by author)

The PSI value of 0.6374 suggests a significant drift between our reference and production datasets. This aligns with the histogram of model score distributions, which visually confirms the shift towards higher scores in production — indicating an increase in risky transactions.

Detecting feature drift

Kolmogorov-Smirnov test for numeric features

The Kolmogorov-Smirnov (K-S) test is my preferred method for detecting drift in numeric features, because it is non-parametric, meaning it doesn’t assume a normal distribution.

The test compares a feature’s distribution in the reference and production datasets by measuring the maximum difference between the empirical cumulative distribution functions (ECDFs). The resulting K-S statistic ranges from 0 to 1:

  • 0 indicates no difference between the two distributions.
  • Values closer to 1 suggest a greater shift.

Python implementation:

# Create an empty dataframe
ks_results = pd.DataFrame(columns=['Feature', 'KS Statistic', 'p-value', 'Drift Detected'])

# Loop through all features and perform the K-S test
for col in numeric_cols:
    ks_stat, p_value = ks_2samp(ref_data[col], prod_data[col])
    drift_detected = p_value < 0.05
		
		# Store results in the dataframe
    ks_results = pd.concat([
        ks_results,
        pd.DataFrame({
            'Feature': [col],
            'KS Statistic': [ks_stat],
            'p-value': [p_value],
            'Drift Detected': [drift_detected]
        })
    ], ignore_index=True)

Below are ECDF charts of the four numeric features in our dataset:

ECDFs of four numeric features (image by author)

Let’s look at the account age feature as an example: the x-axis represents account age (0-50 months), while the y-axis shows the ECDF for both reference and production datasets. The production dataset skews towards newer accounts, as it has a larger proportion of observations have lower account ages.

Chi-Square test for categorical features

To detect shifts in categorical and boolean features, I like to use the Chi-Square test.

This test compares the frequency distribution of a categorical feature in the reference and production datasets, and returns two values:

  • Chi-Square statistic: A higher value indicates a greater shift between the reference and production datasets.
  • P-value: A p-value below 0.05 suggests that the difference between the reference and production datasets is statistically significant, indicating potential feature drift.

Python implementation:

# Create empty dataframe with corresponding column names
chi2_results = pd.DataFrame(columns=['Feature', 'Chi-Square Statistic', 'p-value', 'Drift Detected'])

for col in categorical_cols:
    # Get normalized value counts for both reference and production datasets
    ref_counts = ref_data[col].value_counts(normalize=True)
    prod_counts = prod_data[col].value_counts(normalize=True)

    # Ensure all categories are represented in both
    all_categories = set(ref_counts.index).union(set(prod_counts.index))
    ref_counts = ref_counts.reindex(all_categories, fill_value=0)
    prod_counts = prod_counts.reindex(all_categories, fill_value=0)

    # Create contingency table
    contingency_table = np.array([ref_counts * len(ref_data), prod_counts * len(prod_data)])

    # Perform Chi-Square test
    chi2_stat, p_value, _, _ = chi2_contingency(contingency_table)
    drift_detected = p_value < 0.05

    # Store results in chi2_results dataframe
    chi2_results = pd.concat([
        chi2_results,
        pd.DataFrame({
            'Feature': [col],
            'Chi-Square Statistic': [chi2_stat],
            'p-value': [p_value],
            'Drift Detected': [drift_detected]
        })
    ], ignore_index=True)

The Chi-Square statistic of 57.31 with a p-value of 3.72e-14 confirms a large shift in our categorical feature, Entered PIN. This finding aligns with the histogram below, which visually illustrates the shift:

Distribution of categorical feature (image by author)

Detecting multivariate shifts

Spearman Correlation for shifts in pairwise interactions

In addition to monitoring individual feature shifts, it’s important to track shifts in relationships or interactions between features, known as multivariate shifts. Even if the distributions of individual features remain stable, multivariate shifts can signal meaningful differences in the data.

By default, Pandas’ .corr() function calculates Pearson correlation, which only captures linear relationships between variables. However, relationships between features are often non-linear yet still follow a consistent trend.

To capture this, we use Spearman correlation to measure monotonic relationships between features. It captures whether features change together in a consistent direction, even if their relationship isn’t strictly linear.

To assess shifts in feature relationships, we compare:

  • Reference correlation (ref_corr): Captures historical feature relationships in the reference dataset.
  • Production correlation (prod_corr): Captures new feature relationships in production.
  • Absolute difference in correlation: Measures how much feature relationships have shifted between the reference and production datasets. Higher values indicate more significant shifts.

Python implementation:

# Calculate correlation matrices
ref_corr = ref_data.corr(method='spearman')
prod_corr = prod_data.corr(method='spearman')

# Calculate correlation difference
corr_diff = abs(ref_corr - prod_corr)

Example: Change in correlation

Now, let’s look at the correlation between transaction_amount and account_age_in_months:

  • In ref_corr, the correlation is 0.00095, indicating a weak relationship between the two features.
  • In prod_corr, the correlation is -0.0325, indicating a weak negative correlation.
  • Absolute difference in the Spearman correlation is 0.0335, which is a small but noticeable shift.

The absolute difference in correlation indicates a shift in the relationship between transaction_amount and account_age_in_months.

There used to be no relationship between these two features, but the production dataset indicates that there is now a weak negative correlation, meaning that newer accounts have higher transaction accounts. This is spot on!

Autoencoder for complex, high-dimensional multivariate shifts

In addition to monitoring pairwise interactions, we can also look for shifts across more dimensions in the data.

Autoencoders are powerful tools for detecting high-dimensional multivariate shifts, where multiple features collectively change in ways that may not be apparent from looking at individual feature distributions or pairwise correlations.

An autoencoder is a neural network that learns a compressed representation of data through two components:

  • Encoder: Compresses input data into a lower-dimensional representation.
  • Decoder: Reconstructs the original input from the compressed representation.

To detect shifts, we compare the reconstructed output to the original input and compute the reconstruction loss.

  • Low reconstruction loss → The autoencoder successfully reconstructs the data, meaning the new observations are similar to it has seen and learned.
  • High reconstruction loss → The production data deviates significantly from the learned patterns, indicating potential drift.

Unlike traditional drift metrics that focus on individual features or pairwise relationships, autoencoders capture complex, non-linear dependencies across multiple variables simultaneously.

Python implementation:

ref_features = ref_data[numeric_cols + categorical_cols]
prod_features = prod_data[numeric_cols + categorical_cols]

# Normalize the data
scaler = StandardScaler()
ref_scaled = scaler.fit_transform(ref_features)
prod_scaled = scaler.transform(prod_features)

# Split reference data into train and validation
np.random.shuffle(ref_scaled)
train_size = int(0.8 * len(ref_scaled))
train_data = ref_scaled[:train_size]
val_data = ref_scaled[train_size:]

# Build autoencoder
input_dim = ref_features.shape[1]
encoding_dim = 3 
# Input layer
input_layer = Input(shape=(input_dim, ))
# Encoder
encoded = Dense(8, activation="relu")(input_layer)
encoded = Dense(encoding_dim, activation="relu")(encoded)
# Decoder
decoded = Dense(8, activation="relu")(encoded)
decoded = Dense(input_dim, activation="linear")(decoded)
# Autoencoder
autoencoder = Model(input_layer, decoded)
autoencoder.compile(optimizer="adam", loss="mse")

# Train autoencoder
history = autoencoder.fit(
    train_data, train_data,
    epochs=50,
    batch_size=64,
    shuffle=True,
    validation_data=(val_data, val_data),
    verbose=0
)

# Calculate reconstruction error
ref_pred = autoencoder.predict(ref_scaled, verbose=0)
prod_pred = autoencoder.predict(prod_scaled, verbose=0)

ref_mse = np.mean(np.power(ref_scaled - ref_pred, 2), axis=1)
prod_mse = np.mean(np.power(prod_scaled - prod_pred, 2), axis=1)

The charts below show the distribution of reconstruction loss between both datasets.

Distribution of reconstruction loss between actuals and predictions (image by author)

The production dataset has a higher mean reconstruction error than that of the reference dataset, indicating a shift in the overall data. This aligns with the changes in the production dataset with a higher number of newer accounts with high-value transactions.

Summarizing

Model monitoring is an essential, yet often overlooked, responsibility for data scientists and machine learning engineers.

All the statistical methods led to the same conclusion, which aligns with the observed shifts in the data: they detected a trend in production towards newer accounts making higher-value transactions. This shift resulted in higher model scores, signaling an increase in potential fraud.

In this post, I covered techniques for detecting drift on three different levels:

  • Model score drift: Using Population Stability Index (PSI)
  • Individual feature drift: Using Kolmogorov-Smirnov test for numeric features and Chi-Square test for categorical features
  • Multivariate drift: Using Spearman correlation for pairwise interactions and autoencoders for high-dimensional, multivariate shifts.

These are just a few of the techniques I rely on for comprehensive monitoring — there are plenty of other equally valid statistical methods that can also detect drift effectively.

Detected shifts often point to underlying issues that warrant further investigation. The root cause could be as serious as a data collection bug, or as minor as a time change like daylight savings time adjustments.

There are also fantastic python packages, like evidently.ai, that automate many of these comparisons. However, I believe there’s significant value in deeply understanding the statistical techniques behind drift detection, rather than relying solely on these tools.

What’s the model monitoring process like at places you’ve worked?


Want to build your AI skills?

👉🏻 I run the AI Weekender and write weekly blog posts on data science, AI weekend projects, career advice for professionals in data.


Resources

Shape
Shape
Stay Ahead

Explore More Insights

Stay ahead with more perspectives on cutting-edge power, infrastructure, energy,  bitcoin and AI solutions. Explore these articles to uncover strategies and insights shaping the future of industries.

Shape

Trump extends tariff pause to all USMCA goods

The White House announced Thursday afternoon that it will suspend tariffs on all imports that are compliant with the United States-Mexico-Canada Agreement until April 2. The pause, which was extended to imports from Mexico that adhered to the USMCA earlier Thursday, will now also cover goods from Canada that meet

Read More »

Raizen Is Said to Hire JPMorgan for Argentina Energy Assets Sale

Brazil’s Raizen SA has begun to explore the sale of its oil refinery and network of gas stations in Argentina, according to people familiar with the matter. Raizen, a joint venture between oil supermajor Shell Plc and Brazilian conglomerate Cosan SA, has hired JPMorgan Chase & Co. to manage the sale, said the people, who asked not to be named discussing private matters. Press offices for Raizen and JPMorgan declined to comment.  The energy firm’s potential departure from Argentina would add to a growing list of multinational firms, including Exxon Mobil, HSBC Holdings Plc and Mercedes-Benz, that have chosen to sell operations in the country during the past year despite more investor optimism about President Javier Milei’s economic overhaul.  Brazil’s largest producer of ethanol fuel, Raizen is mulling divestments and slowing down expansions as higher borrowing costs of late in Brazil rattle its finances. Its Dock Sud oil refinery in Buenos Aires is Argentina’s oldest with a capacity of 100,000 barrels a day that only trails two facilities run by state-run oil company YPF SA. Raizen’s network of around 700 gas stations account for 18% of Argentina’s gasoline and diesel sales, second to YPF, which has more than half of the market. The fuel is branded as Shell. Raizen bought the assets for almost $1 billion in 2018 from Shell, which owned them outright, during Argentina’s last experiment with market-oriented reforms. The country then witnessed a period of big government from 2019 to 2023 before voting in libertarian Milei more than a year ago. He is on a crusade to deregulate the economy, in particular the energy and oil sectors. The divestment comes as Milei rips away controls on crude and fuel prices that were used to stem inflation. That was sometimes bad for refiners or drillers, depending on how

Read More »

Data center supply, construction surged in 2024 amid AI boom

Dive Brief: Data center supply in major “primary” markets like Northern Virginia, Atlanta and Chicago surged 34% year-over-year in 2024 to 6,922.6 MW, with a further 6,350 MW under construction at year-end, CBRE said in a Feb. 26 report. The data center vacancy rate in primary markets fell to 1.9%, driving up the average asking rates for a 250-to-500-kilowatt requirement by 2.6% year-over-year to $184.06/kW, reflecting tight supply and robust demand for AI and cloud services, CBRE said in its North America Data Center Trends H2 2024 report. Volume-based discounts for larger tenants “have been significantly reduced or eliminated” due to rising demand for large, contiguous spaces, while data center operators grapple with elevated construction and equipment costs and “persistent shortages in critical materials like generators, chillers and transformers,” CBRE said. Dive Insight: Surging demand from organizations’ use of AI is driving the record data center development, CBRE says. The demand is giving AI-related occupiers increasing influence over data center development decisions like site selection, design and operational requirements. These occupiers are “prioritizing markets with scalable power capacity and advanced connectivity solutions,” the report says.  Demand is also showing up in pricing trends.  Last year was the third consecutive year of pricing increases for 250-to-500-kW slots in primary markets, CBRE said. Following steady single-digit annual declines from 2015 to 2021, average pricing rose 14.5% in 2022, 18.6% in 2023 and 12.6% in 2024. Robust tenant demand, healthy investor appetite for alternative real estate assets and recent interest rate declines are among the factors fueling an exponential increase in data center investment activity, CBRE said. Annual sales volumes reached $6.5 billion in 2024 as average sale prices increased year-over-year, reflecting “the growing scale of data center campuses,” CBRE said. Five transactions exceeded $400 million last year. Notable capital market developments included

Read More »

Bonneville opts to join SPP’s Markets+ day-ahead market over CAISO alternative

Dive Brief: The Bonneville Power Administration plans to join the Southwest Power Pool’s Markets+ real-time and day-ahead market instead of a market being launched by the California Independent System Operator, BPA said in a draft policy released Wednesday. While the CAISO’s Extended Day-Ahead Market may offer greater financial benefits compared to Markets+, overall the SPP market is a better fit for BPA based on market design elements covering governance, resource adequacy, greenhouse gas accounting and congestion revenue, the federal power marketer said. Bonneville expects to make a final decision in May. The BPA’s draft decision sets the stage for the creation of two intertwined day-ahead markets in the West. “The idea that there’s some West-wide market ideal out there that we can get to today is just not something that is on the table,” Rachel Dibble, BPA power services vice president of bulk marketing, said at a press briefing Thursday. “Maybe someday, in future decades, there may be a point where we could merge into one market, but right now, there are many entities who support Markets+.” Dive Insight: The BPA’s decision will have a major effect on market development in the West. It sells wholesale power from federal hydroelectric dams in the Northwest, totaling about 22.4 GW. The federal power marketer also operates about 15,000 circuit miles of high-voltage transmission across the Northwest. The BPA mainly sells its power to cooperative and municipal utilities, and public power districts. In its draft decision, BPA rejected calls to wait for the West-Wide Governance Pathways Initiative to complete its effort to establish an independent governance framework for EDAM.  While a bill — SB 540 — was introduced in the California Legislature last month to implement the Pathways’ second phase, it “limits the availability of full operational administrative independence by requiring that the

Read More »

USA Won’t Hesitate on Russia and Iran Sanctions, Bessent Says

The US will not hesitate to go “all in” on sanctions on Russian energy if it helps lead to a ceasefire in the Ukraine war, Treasury Secretary Scott Bessent said Thursday. Sanctions on Russia “will be used explicitly and aggressively for immediate maximum impact” at President Donald Trump’s guidance, Bessent told an audience at the Economic Club of New York. The Trump administration is pressing Ukraine to come to the table for a ceasefire deal with Russia, and Bessent said additional sanctions on Russia could help give the US more leverage in the negotiations. Trump is ready to finalize an agreement that would give the US rights to help develop some of Ukraine’s natural resources if Ukrainian President Volodymyr Zelenskiy agrees to a tangible path for a truce and talks with Moscow, according to people familiar with the matter. Bessent criticized the Biden administration for not going harder on Russian energy sanctions for fear of driving up gas prices and asked what the point of “substantial US military and financial support over the past three years” was without matching sanctions. The US has paused military aid and some intelligence sharing with Ukraine in an effort to force the US ally to agree to negotiations with Russia over the end of the war. Bessent also said the US would ramp up sanctions on Iran, adding that the US will “shutdown” the country’s oil sector using “pre-determined benchmarks and timelines” and that “Making Iran broke again will mark the beginning of our updated sanctions policy.” The Treasury chief suggested that the US would work with “regional parties” that help Iran move its oil onto the market. One of those countries is likely to be Russia, which signaled earlier this week that it was willing to assist the US in talks with Iran on ending its nuclear

Read More »

Oil Gains on Truce Hopes but Closes Week Lower

Oil’s one-day advance wasn’t enough to rescue prices from a seventh straight weekly decline as the prospect of a temporary truce in Ukraine capped on-again, off-again tariff news that upended global markets. West Texas Intermediate futures climbed by 0.7% Friday to settle above $67 a barrel after Bloomberg reported that Russia is open to a pause to fighting in Ukraine, raising the prospect of a resumption in Moscow’s crude exports. US President Donald Trump earlier pressured the two warring nations to hasten peace talks and the White House signaled that it may relax sanctions on Russian oil if there’s progress. Crude also found support from a weakening dollar and US plans to refill its strategic oil reserve, but still was down 3.9% on the week. The Biden administration’s farewell sanctions on Russia have snarled the nation’s crude trade in recent months, with total oil and natural gas revenue last month falling almost 19% from a year earlier, Bloomberg calculations showed. Russia’s oil-related taxes are a key source of financing its war against Ukraine. A potential reintroduction of Russian barrels to the market comes amid a gloomy period for the supply outlook, as OPEC+ forges ahead with a plan to start reviving idled output in April. Meanwhile, Trump’s trade policies have fanned concerns about reduced global energy demand. “You’re seeing some volatility as people try to interpret what they think is going to happen and what it’s going to mean, but the bottom line is Russia has been able to sell its oil,” said Amy Jaffe, director of New York University’s Energy, Climate Justice and Sustainability Lab. Trump signed orders on Thursday paring back tariffs on Mexico and Canada until April 2. That timing coincides with a date when the president is expected to start detailing plans for so-called reciprocal duties

Read More »

EVOL X Fugro International Women’s Day special

Join Energy Voice News Editor Erikka Askeland who speaks to two high profile energy industry business leaders for International Women’s Day. We speak to Nicola Welsh, UK Country Director at geo-data specialist Fugro alongsideLinda Stewart, Director Marine Geophysical Europe, also at Fugro. Tune in to hear Nicola discuss her route from mining camps in the Australian outback to a senior leadership role while Linda charts her 19-year career journey to become Fugro’s first female director in her role in Scotland. There’s serious discussion about leaning in, the “double bind” and what the IWD 2025 call to “accelerate action” really means. This special podcast also serves and the opening of Energy Voice’s highly anticipated Women in New Energy Event which takes place in Aberdeen in June. Recommended for you Celebrating International Women’s Day with Axis Network’s Emma Behjat

Read More »

Lenovo introduces entry-level, liquid cooled AI edge server

Lenovo has announced the ThinkEdge SE100, an entry-level AI inferencing server, designed to make edge AI affordable for enterprises as well as small and medium-sized businesses. AI systems are not normally associated with being small and compact; they’re big, decked out servers with lots of memory, GPUs, and CPUs. But the server is for inferencing, which is the less compute intensive portion of AI processing, Lenovo stated.  GPUs are considered overkill for inferencing and there are multiple startups making small PC cards with inferencing chip on them instead of the more power-hungry CPU and GPU. This design brings AI to the data rather than the other way around. Instead of sending the data to the cloud or data center to be processed, edge computing uses devices located at the data source, reducing latency and the amount of data being sent up to the cloud for processing, Lenovo stated. 

Read More »

Seven important trends in the server sphere

The pace of change around server technology is advancing considerably, driven by hyperscalers but spilling over into the on-premises world as well. There are numerous overall trends, experts say, including: AI Everything: AI mania is everywhere and without high power hardware to run it, it’s just vapor. But it’s more than just a buzzword, it is a very real and measurable trend. AI servers are notable because they are decked out with high end CPUs, GPU accelerators, and oftentimes a SmartNIC network controller.  All the major players — Nvidia, Supermicro, Google, Asus, Dell, Intel, HPE — as well as smaller vendors are offering purpose-built AI hardware, according to a recent Network World article. AI edge server growth: There is also a trend towards deploying AI edge servers. The Global Edge AI Servers Market size is expected to be worth around $26.6 Billion by 2034, from $2.7 Billion in 2024, according to a Market.US report. Considerable amounts of data are collected on the edge.  Edge servers do the job of culling the useless data and sending only the necessary data back to data centers for processing. The market is rapidly expanding as industries such as manufacturing, automotive, healthcare, and retail increasingly deploy IoT devices and require immediate data processing for decision-making and operational efficiency, according to the report. Liquid cooling gains ground: Liquid cooling is inching its way in from the fringes into the mainstream of data center infrastructure. What was once a difficult add-on is now becoming a standard feature, says Jeffrey Hewitt, vice president and analyst with Gartner. “Server providers are working on developing the internal chassis plumbing for direct-to-chip cooling with the goal of supporting the next generation of AI CPUs and GPUs that will produce high amounts of heat within their servers,” he said.  New data center structures: Not

Read More »

Data center vacancies hit historic lows despite record construction

The growth comes despite considerable headwinds facing data center operators, including higher construction costs, equipment pricing, and persistent shortages in critical materials like generators, chillers and transformers, CRBE stated. There is a considerable pricing disparity between newly built data centers and legacy facilities, reflecting the premium placed on modern, energy-efficient infrastructure. Specifically, liquid/immersion cooling is preferred over air cooling for modern server requirements, CRBE found. On the networking side of things, major telecom companies made substantial investments in fiber in the second half of 2024, reflecting the growing need for more network infrastructure and capacity to accommodate growing demand from AI and data providers. There have also been many notable deals recently: AT&T’s multi-year, $1 billion agreement with Corning to provide next-generation fiber, cable and connectivity solutions; Comcast’s proposed acquisition of Nitel; Verizon’s agreement to acquire Frontier, the largest pure-play fiber internet provider in the U.S.; and T-Mobile’s entry into the fiber internet market via partnerships with fiber-optic providers. In the quarter, Meta announced plans for a 25,000-mile undersea fiber cable that would connect the U.S. East and West coasts with global markets across the Atlantic, Indian and Pacific oceans. The project would mark the first privately owned and operated global fiber cable network. Data Center Outlook

Read More »

AI driving a 165% rise in data center power demand by 2030

Goldman Sachs Research estimates the power usage by the global data center market to be around 55 gigawatts, which breaks down as 54% for cloud computing workloads, 32% for traditional line of business workloads and 14% for AI. By 2027, that number jumps to 84 GW, with AI growing to 27% of the overall market, cloud dropping to 50%, and traditional workloads falling to 23%, Schneider stated. Goldman Sachs Research estimates that there will be around 122 GW of data center capacity online by the end of 2030, and the density of power use in data centers is likely to grow as well, from 162 kilowatts per square foot to 176 KW per square foot in 2027, thanks to AI, Schneider stated.  “Data center supply — specifically the rate at which incremental supply is built — has been constrained over the past 18 months,” Schneider wrote. These constraints have arisen from the inability of utilities to expand transmission capacity because of permitting delays, supply chain bottlenecks, and infrastructure that is both costly and time-intensive to upgrade. The result is that due to power demand from data centers, there will need to be additional utility investment, to the tune of about $720 billion of grid spending through 2030. And then they are subject to the pace of public utilities, which move much slower than hyperscalers. “These transmission projects can take several years to permit, and then several more to build, creating another potential bottleneck for data center growth if the regions are not proactive about this given the lead time,” Schneider wrote.

Read More »

Top data storage certifications to sharpen your skills

Organization: Hitachi Vantara Skills acquired: Knowledge of data center infrastructure management tasks automation using Hitachi Ops Center Automator. Price: $100 Exam duration: 60 minutes How to prepare: Knowledge of all storage-related operations from an end-user perspective, including planning, allocating, and managing storage and architecting storage layouts. Read more about Hitachi Vantara’s training and certification options here. Certifications that bundle cloud, networking and storage skills AWS Certified Solutions Architect – Professional The AWS Certified Solutions Architect – Professional certification from leading cloud provider Amazon Web Services (AWS) helps individuals showcase advanced knowledge and skills in optimizing security, cost, and performance, and automating manual processes. The certification is a means for organizations to identify and develop talent with these skills for implementing cloud initiatives, according to AWS. The ideal candidate has the ability to evaluate cloud application requirements, make architectural recommendations for deployment of applications on AWS, and provide expert guidance on architectural design across multiple applications and projects within a complex organization, AWS says. Certified individuals report increased credibility with technical colleagues and customers as a result of earning this certification, it says. Organization: Amazon Web Services Skills acquired: Helps individuals showcase skills in optimizing security, cost, and performance, and automating manual processes Price: $300 Exam duration: 180 minutes How to prepare: The recommended experience prior to taking the exam is two or more years of experience in using AWS services to design and implement cloud solutions Cisco Certified Internetwork Expert (CCIE) Data Center The Cisco CCIE Data Center certification enables individuals to demonstrate advanced skills to plan, design, deploy, operate, and optimize complex data center networks. They will gain comprehensive expertise in orchestrating data center infrastructure, focusing on seamless integration of networking, compute, and storage components. Other skills gained include building scalable, low-latency, high-performance networks that are optimized to support artificial intelligence (AI)

Read More »

Netskope expands SASE footprint, bolsters AI and automation

Netskope is expanding its global presence by adding multiple regions to its NewEdge carrier-grade infrastructure, which now includes more than 75 locations to ensure processing remains close to end users. The secure access service edge (SASE) provider also enhanced its digital experience monitoring (DEM) capabilities with AI-powered root-cause analysis and automated network diagnostics. “We are announcing continued expansion of our infrastructure and our continued focus on resilience. I’m a believer that nothing gets adopted if end users don’t have a great experience,” says Netskope CEO Sanjay Beri. “We monitor traffic, we have multiple carriers in every one of our more than 75 regions, and when traffic goes from us to that destination, the path is direct.” Netskope added regions including data centers in Calgary, Helsinki, Lisbon, and Prague as well as expanded existing NewEdge regions including data centers in Bogota, Jeddah, Osaka, and New York City. Each data center offers customers a range of SASE capabilities including cloud firewalls, secure web gateway (SWG), inline cloud access security broker (CASB), zero trust network access (ZTNA), SD-WAN, secure service edge (SSE), and threat protection. The additional locations enable Netskope to provide coverage for more than 220 countries and territories with 200 NewEdge Localization Zones, which deliver a local direct-to-net digital experience for users, the company says.

Read More »

Microsoft will invest $80B in AI data centers in fiscal 2025

And Microsoft isn’t the only one that is ramping up its investments into AI-enabled data centers. Rival cloud service providers are all investing in either upgrading or opening new data centers to capture a larger chunk of business from developers and users of large language models (LLMs).  In a report published in October 2024, Bloomberg Intelligence estimated that demand for generative AI would push Microsoft, AWS, Google, Oracle, Meta, and Apple would between them devote $200 billion to capex in 2025, up from $110 billion in 2023. Microsoft is one of the biggest spenders, followed closely by Google and AWS, Bloomberg Intelligence said. Its estimate of Microsoft’s capital spending on AI, at $62.4 billion for calendar 2025, is lower than Smith’s claim that the company will invest $80 billion in the fiscal year to June 30, 2025. Both figures, though, are way higher than Microsoft’s 2020 capital expenditure of “just” $17.6 billion. The majority of the increased spending is tied to cloud services and the expansion of AI infrastructure needed to provide compute capacity for OpenAI workloads. Separately, last October Amazon CEO Andy Jassy said his company planned total capex spend of $75 billion in 2024 and even more in 2025, with much of it going to AWS, its cloud computing division.

Read More »

John Deere unveils more autonomous farm machines to address skill labor shortage

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More Self-driving tractors might be the path to self-driving cars. John Deere has revealed a new line of autonomous machines and tech across agriculture, construction and commercial landscaping. The Moline, Illinois-based John Deere has been in business for 187 years, yet it’s been a regular as a non-tech company showing off technology at the big tech trade show in Las Vegas and is back at CES 2025 with more autonomous tractors and other vehicles. This is not something we usually cover, but John Deere has a lot of data that is interesting in the big picture of tech. The message from the company is that there aren’t enough skilled farm laborers to do the work that its customers need. It’s been a challenge for most of the last two decades, said Jahmy Hindman, CTO at John Deere, in a briefing. Much of the tech will come this fall and after that. He noted that the average farmer in the U.S. is over 58 and works 12 to 18 hours a day to grow food for us. And he said the American Farm Bureau Federation estimates there are roughly 2.4 million farm jobs that need to be filled annually; and the agricultural work force continues to shrink. (This is my hint to the anti-immigration crowd). John Deere’s autonomous 9RX Tractor. Farmers can oversee it using an app. While each of these industries experiences their own set of challenges, a commonality across all is skilled labor availability. In construction, about 80% percent of contractors struggle to find skilled labor. And in commercial landscaping, 86% of landscaping business owners can’t find labor to fill open positions, he said. “They have to figure out how to do

Read More »

2025 playbook for enterprise AI success, from agents to evals

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More 2025 is poised to be a pivotal year for enterprise AI. The past year has seen rapid innovation, and this year will see the same. This has made it more critical than ever to revisit your AI strategy to stay competitive and create value for your customers. From scaling AI agents to optimizing costs, here are the five critical areas enterprises should prioritize for their AI strategy this year. 1. Agents: the next generation of automation AI agents are no longer theoretical. In 2025, they’re indispensable tools for enterprises looking to streamline operations and enhance customer interactions. Unlike traditional software, agents powered by large language models (LLMs) can make nuanced decisions, navigate complex multi-step tasks, and integrate seamlessly with tools and APIs. At the start of 2024, agents were not ready for prime time, making frustrating mistakes like hallucinating URLs. They started getting better as frontier large language models themselves improved. “Let me put it this way,” said Sam Witteveen, cofounder of Red Dragon, a company that develops agents for companies, and that recently reviewed the 48 agents it built last year. “Interestingly, the ones that we built at the start of the year, a lot of those worked way better at the end of the year just because the models got better.” Witteveen shared this in the video podcast we filmed to discuss these five big trends in detail. Models are getting better and hallucinating less, and they’re also being trained to do agentic tasks. Another feature that the model providers are researching is a way to use the LLM as a judge, and as models get cheaper (something we’ll cover below), companies can use three or more models to

Read More »

OpenAI’s red teaming innovations define new essentials for security leaders in the AI era

Join our daily and weekly newsletters for the latest updates and exclusive content on industry-leading AI coverage. Learn More OpenAI has taken a more aggressive approach to red teaming than its AI competitors, demonstrating its security teams’ advanced capabilities in two areas: multi-step reinforcement and external red teaming. OpenAI recently released two papers that set a new competitive standard for improving the quality, reliability and safety of AI models in these two techniques and more. The first paper, “OpenAI’s Approach to External Red Teaming for AI Models and Systems,” reports that specialized teams outside the company have proven effective in uncovering vulnerabilities that might otherwise have made it into a released model because in-house testing techniques may have missed them. In the second paper, “Diverse and Effective Red Teaming with Auto-Generated Rewards and Multi-Step Reinforcement Learning,” OpenAI introduces an automated framework that relies on iterative reinforcement learning to generate a broad spectrum of novel, wide-ranging attacks. Going all-in on red teaming pays practical, competitive dividends It’s encouraging to see competitive intensity in red teaming growing among AI companies. When Anthropic released its AI red team guidelines in June of last year, it joined AI providers including Google, Microsoft, Nvidia, OpenAI, and even the U.S.’s National Institute of Standards and Technology (NIST), which all had released red teaming frameworks. Investing heavily in red teaming yields tangible benefits for security leaders in any organization. OpenAI’s paper on external red teaming provides a detailed analysis of how the company strives to create specialized external teams that include cybersecurity and subject matter experts. The goal is to see if knowledgeable external teams can defeat models’ security perimeters and find gaps in their security, biases and controls that prompt-based testing couldn’t find. What makes OpenAI’s recent papers noteworthy is how well they define using human-in-the-middle

Read More »