moabb.analysis.meta_analysis.compute_pvals_corrected_ttest#
- moabb.analysis.meta_analysis.compute_pvals_corrected_ttest(df, n_train, n_test, order=None)[source]#
Compute the Nadeau & Bengio corrected resampled t-test.
Returns a kxk matrix of one-tailed p-values comparing each pair of pipelines with the corrected resampled t-test of Nadeau & Bengio [1]. Use this test when the rows of
dfare scores of overlapping cross-validation resamples (e.g. the folds of a within-session (repeated) k-fold evaluation): the folds share training examples, so a standard paired t-test underestimates the variance and is overconfident. The correction inflates the variance by \(n_2 / n_1\), the test/train ratio of each split.For k-fold cross-validation repeated r times on
mexamples, usen_test = m // kandn_train = m - n_testand pass then = r * kper-fold scores as rows.- Parameters:
df (
pandas.DataFrame) – Scores of each cross-validation resample; samples (resamples) are index, columns are pipelines, and values are scores.n_train (int) – Number of training examples in each resample.
n_test (int) – Number of testing examples in each resample.
order (list of length (n_pipelines)) – Names corresponding to df columns.
- Returns:
pvals – One-tailed p-values;
pvals[i, j]is small when pipelineiscores significantly higher than pipelinej.- Return type:
ndarray of shape (n_pipelines, n_pipelines)
References
[1]Nadeau, C., & Bengio, Y. (1999). Inference for the generalization error. Advances in Neural Information Processing Systems 12; extended version in Machine Learning, 52, 239-281 (2003). https://doi.org/10.1023/A:1024068626366