Explore Library
Code QuizAdvanced

Data Drift Detection Computation

Spot the flawed threshold logic in a KS-test data drift check.

Codepython
from scipy.stats import ks_2samp

def detect_drift(reference, current, threshold=0.05):
    stat, p_value = ks_2samp(reference, current)
    # Flag drift when the two distributions differ
    return p_value > threshold

What is the bug in this drift detection function?