8000 [MRG+1] Improved docstring for permutation_test_score (#8379 and #856… · massich/scikit-learn@cb341a5 · GitHub
[go: up one dir, main page]

Skip to content

Commit cb341a5

Browse files
leereevesJoan Massich
authored and
Joan Massich
committed
[MRG+1] Improved docstring for permutation_test_score (scikit-learn#8379 and scikit-learn#8564) (scikit-learn#8569)
1 parent 7c84d9e commit cb341a5

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

sklearn/cross_validation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1905,11 +1905,14 @@ def permutation_test_score(estimator, X, y, cv=None,
19051905
The scores obtained for each permutations.
19061906
19071907
pvalue : float
1908-
The returned value equals p-value if `scoring` returns bigger
1909-
numbers for better scores (e.g., accuracy_score). If `scoring` is
1910-
rather a loss function (i.e. when lower is better such as with
1911-
`mean_squared_error`) then this is actually the complement of the
1912-
p-value: 1 - p-value.
1908+
The p-value, which approximates the probability that the score would
1909+
be obtained by chance. This is calculated as:
1910+
1911+
`(C + 1) / (n_permutations + 1)`
1912+
1913+
Where C is the number of permutations whose score >= the true score.
1914+
1915+
The best possible p-value is 1/(n_permutations + 1), the worst is 1.0.
19131916
19141917
Notes
19151918
-----

sklearn/model_selection/_validation.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -656,11 +656,14 @@ def permutation_test_score(estimator, X, y, groups=None, cv=None,
656656
The scores obtained for each permutations.
657657
658658
pvalue : float
659-
The returned value equals p-value if `scoring` returns bigger
660-
numbers for better scores (e.g., accuracy_score). If `scoring` is
661-
rather a loss function (i.e. when lower is better such as with
662-
`mean_squared_error`) then this is actually the complement of the
663-
p-value: 1 - p-value.
659+
The p-value, which approximates the probability that the score would
660+
be obtained by chance. This is calculated as:
661+
662+
`(C + 1) / (n_permutations + 1)`
663+
664+
Where C is the number of permutations whose score >= the true score.
665+
666+
The best possible p-value is 1/(n_permutations + 1), the worst is 1.0.
664667
665668
Notes
666669
-----

0 commit comments

Comments
 (0)
0