Column drift
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:
Method | Application | Score |
---|---|---|
Anderson-Darling | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Chi-Square | Applies only to categorical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Cramer-Von-Mises | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Energy Distance | Applies only to numerical columns. | Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1. |
Epps-Singleton | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Fisher Exact Test | Applies only to categorical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
G-test | Applies only to categorical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Hellinger Distance | Applies to categorical and numerical columns. | Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1. |
Jensen-Shannon Distance | Applies to categorical and numerical columns. | Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1. |
Kullback-Leibler Divergence | Applies to categorical and numerical columns. | Returns the divergence. If divergence >= threshold, drift is detected. Recommended threshold: 0.1. |
K-S Test | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Mann-Whitney U-Rank Test | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Population Stability Index | Applies to categorical and numerical columns. | Returns the computed PSI value. If PSI >= threshold, drift is detected. Recommended threshold: 0.1. |
Student’s t-test | Applies only to numerical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Text Content Drift | Applies 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 Distance | Applies only to categorical columns. | Returns a p-value. If p-value < threshold, drift is detected. Recommended threshold: 0.05. |
Wasserstein Distance | Applies only to numerical columns. | Returns a distance. If distance >= threshold, drift is detected. Recommended threshold: 0.1. |
Z-test | Applies 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:
Related
Was this page helpful?