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

Skip to content

Commit cd66c5a

Browse files
leereevesjnothman
authored andcommitted
[MRG+1] Improved docstring for permutation_test_score (#8379 and #8564) (#8569)
1 parent e548ea6 commit cd66c5a

File tree

2 files changed

+16
-10
lines changed

2 files changed

+16
-10
lines changed

sklearn/cross_validation.py

+8-5
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

+8-5
Original file line numberDiff line numberDiff line change
@@ -596,11 +596,14 @@ def permutation_test_score(estimator, X, y, groups=None, cv=None,
596596
The scores obtained for each permutations.
597597
598598
pvalue : float
599-
The returned value equals p-value if `scoring` returns bigger
600-
numbers for better scores (e.g., accuracy_score). If `scoring` is
601-
rather a loss function (i.e. when lower is better such as with
602-
`mean_squared_error`) then this is actually the complement of the
603-
p-value: 1 - p-value.
599+
The p-value, which approximates the probability that the score would
600+
be obtained by chance. This is calculated as:
601+
602+
`(C + 1) / (n_permutations + 1)`
603+
604+
Where C is the number of permutations whose score >= the true score.
605+
606+
The best possible p-value is 1/(n_permutations + 1), the worst is 1.0.
604607
605608
Notes
606609
-----

0 commit comments

Comments
 (0)
0