Kolmogorov–Smirnov (KS) Test#
A test comparing distributions via their largest cumulative gap.
Important
✨ AI-generated content. This page was written with the assistance of an AI language model and is provided as a learning aid. Despite careful review, it may still contain mistakes, omissions, or out-of-date information. Whether you are new to the topic, a team lead, or a senior practitioner, treat it as a starting point rather than an authoritative reference: read it critically and independently verify anything you act on (code, commands, figures, and factual claims) against official documentation and primary sources before relying on it.
What it is#
The KS test is a non-parametric test of whether two samples come from the same distribution (two-sample), or whether a sample matches a reference distribution (goodness-of-fit). It compares their cumulative distribution functions (CDFs).
The statistic#
Its D-statistic is the largest vertical gap between the two CDFs:
A bigger D means the distributions are further apart. Because it uses the CDF directly, it makes no assumptions about the distribution’s shape — its great strength.
Where it’s used#
With a null of “same distribution,” a small p-value flags a significant difference — making the KS test a standard tool for drift detection on continuous features and for goodness-of-fit checks. It underlies the KS statistic used as a drift metric.
Theme: Statistical Inference & Power · All terminology
Hint
Mind map — connected ideas
KS Statistic (Kolmogorov–Smirnov Statistic) · Kullback–Leibler (KL) Divergence · Jensen–Shannon (JS) Divergence · Data Drift · Cumulative Distribution Function (CDF) · Statistical Tests
Hint
More in Statistical Inference & Power
A Priori Power Analysis · Chi-square (χ²) Test · Clopper–Pearson Interval · Compromise Power Analysis · Confidence Intervals (CIs) · Effect Size (δ) · Hypothesis Testing · Minimum Detectable Lift (MDL) · P-Value (probability value) · Post Hoc Power Analysis · Power (1 – β) · Power Analysis · Sample size · Significance Level (α)
See also
Source article Adapted (context, re-expressed) in our own words from: Kolmogorov–Smirnov (KS) Test (insightful-data-lab.com).