setu.c2st#
- setu.c2st(samples_a, samples_b, n_folds=5, seed=42)[source]#
Classifier Two-Sample Test using MLP.
Trains an MLP classifier to distinguish between two sets of samples. Returns accuracy: 0.5 means indistinguishable, >0.5 means different.
Based on recommendations from “A Unified Framework for Two-Sample Tests” (arXiv:2403.12636v2), which advocates MLP over Random Forest for better sensitivity to distributional differences.
- Parameters:
samples_a (
Array) – First set of samples (n, dim)samples_b (
Array) – Second set of samples (n, dim). Must have the same count as samples_a: C2ST is scored by classification accuracy, whose chance level is only 0.5 when the two classes are balanced. Subsample the larger set before calling if counts differ.n_folds (
int) – Number of cross-validation foldsseed (
int) – Random seed for reproducibility
- Return type:
- Returns:
Mean cross-validation accuracy in [0, 1]