Definition

The column drift test allows you to select a dataset column, specify a drift detection method, and set a threshold for the drift score.

Drift is measured by comparing the selected column on the current dataset with a reference dataset.

  • In development projects, the training set is used as the reference and the validation set as the current dataset.
  • In monitoring projects, the reference dataset is uploaded by the user and the production data is the current dataset.

If you want Openlayer to automatically find the best drift detection method and threshold, you can use the Feature drift, and Label drift tests instead.

Taxonomy

  • Category: Consistency.
  • Task types: LLM, tabular classification, tabular regression, text classification.
  • Availability: and .

Why it matters

  • Measuring drift is crucial to maintain the relevance of your models. In development, it allows you to ensure that the data you use to validate your model is similar to the data you used to train it. In monitoring, it allows you to detect when the data your model is receiving is different from the data considered as reference.
  • Over time, changes in the underlying data distribution can degrade the performance of your model. Measuring drift helps in identifying these changes early, enabling timely updates or retraining of the model to maintain its performance.

Drift detection methods

One of the parameters that you must pass to the column drift test is the drift detection method. This is the method that will be used to compare the specified columns in the datasets and compute a drift score, which is what you apply a threshold to.

Openlayer supports different drift detection methods, namely:

MethodApplicationScore
Anderson-DarlingApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Chi-SquareApplies only to categorical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Cramer-Von-MisesApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Energy DistanceApplies only to numerical columns.Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1.
Epps-SingletonApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Fisher Exact TestApplies only to categorical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
G-testApplies only to categorical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Hellinger DistanceApplies to categorical and numerical columns.Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1.
Jensen-Shannon DistanceApplies to categorical and numerical columns.Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1.
Kullback-Leibler DivergenceApplies to categorical and numerical columns.Returns the divergence. If divergence >= threshold, drift is detected. Recommended threshold: 0.1.
K-S TestApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Mann-Whitney U-Rank TestApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Population Stability IndexApplies to categorical and numerical columns.Returns the computed PSI value. If PSI >= threshold, drift is detected. Recommended threshold: 0.1.
Student’s t-testApplies only to numerical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Text Content DriftApplies only to text columns.Returns the ROC AUC of a binary classifier trained to distinguish text from the current and reference data. Drift is detected when the ROC AUC is high. Recommended threshold range: 0.5 - 1
Total Variation DistanceApplies only to categorical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.
Wasserstein DistanceApplies only to numerical columns.Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1.
Z-testApplies only to categorical columns.Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05.

Note that not all drift detection methods apply to all column types. For example, the “Kolmogorov-Smirnov (KS) test” is only available for numerical columns, the “Text content drift” method is only available for text columns, etc.

If you select an invalid method for a column, the test will be skipped and you will see a message with the justification in the test report.

Test configuration examples

If you are writing a tests.json, here are a few valid configurations for the character length test: