Kernel Two-Sample Test (Maximum Mean Discrepancy)
The kernel two-sample test compares two samples through the maximum mean discrepancy, the distance between their mean embeddings under a kernel such as the Gaussian, with a permutation p-value.
커널 두 표본 검정은 가우스 등 커널로 두 표본의 평균 임베딩 사이 거리인 최대평균불일치(MMD)를 구하고 순열 p값으로 두 분포가 같은지 검정하는 방법입니다.
Is the feature distribution of this month's model inputs different from the training data, considering all features together?
이번 달 모델 입력 데이터의 분포가 학습 데이터와 달라졌는지 모든 변수를 함께 고려해 어떻게 검정하나요?
Compute the unbiased squared maximum mean discrepancy with a Gaussian kernel whose bandwidth is the median pairwise distance, then compare it with its permutation distribution. A small p-value shows that the two samples come from different distributions.
When to use Kernel Two-Sample Test (Maximum Mean Discrepancy)
- You want to detect any distributional difference between two multivariate samples.
- Variables may be nonlinearly related and non-normal.
- Checking data drift or the balance of two groups.
When to use something else
- More than two groups are compared; use the energy distance test.
- Only means are of interest with normal data; use Hotelling's T-squared test.
Assumptions and requirements
- Independent rows, exchangeable under the null.
- Features standardised or on comparable scales.
- At most 2,000 rows are used (seeded subsample above that).
What the analysis reports
- Unbiased MMD squared
- Permutation p-value
- Kernel and bandwidth used
- Group sizes
How to report it
A kernel two-sample test (Gaussian kernel, bandwidth = [value]) detected a difference between [group A] and [group B], MMD^2 = [value], permutation p = [value].
Related methods
- Energy Distance Test of Equal Distributions (Two- and k-Sample)
- Classifier Two-Sample Test
- Kolmogorov-Smirnov Test
How this method is validated
이 방법의 검증 근거
- Automated tests. Checked by automated run tests; no external reference comparison is recorded yet.
자동 시험. 자동 실행 시험을 거칩니다. 외부 참조값과 대조한 기록은 아직 없습니다.
Run Kernel Two-Sample Test (Maximum Mean Discrepancy) on Quorant
- Data you need
- a table (CSV or Excel) with predictor (feature) columns and a grouping variable
- Price
- 250 credits for one analysis up to 10,000 rows (complexity level 2); larger or wider data costs more. Optional methodologist review: 1200 credits.
- Checking
- Automated run tests; no external reference comparison yet
- Before you pay
- A free pre-analysis diagnosis checks your data and gives an exact quote; nothing is deducted until you approve it.