Thanks to visit codestin.com
Credit goes to github.com

Skip to content

permutation_test_score documentation: pvalue when scoring is a loss function #8564

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
leereeves opened this issue Mar 9, 2017 · 2 comments
Closed

Comments

@leereeves
Copy link
Contributor

leereeves commented Mar 9, 2017

While reviewing issue #8379 I noticed this statement in the docstring explaining the return value from permutation_test_score:

If scoring is rather a loss function (i.e. when lower is better such as with mean_squared_error) then this is actually the complement of the p-value: 1 - p-value.

If I understand correctly that's not quite true. permutation_test_score returns:

pvalue = (np.sum(permutation_scores >= score) + 1.0) / (n_permutations + 1)

But one minus this value is:

pvalue = np.sum(permutation_scores < score) / (n_permutations + 1)

which is not the same as the value obtained with the appropriate comparison for a scoring function where lower is better:

pvalue = (np.sum(permutation_scores <= score) + 1.0) / (n_permutations + 1)

In particular, one minus this value can be 0.0, while the minimum p-value is 1 / ( n_permutations + 1 ) as was discussed in issue #8379.

@jnothman
Copy link
Member

jnothman commented Mar 9, 2017 via email

@leereeves
Copy link
Contributor Author

leereeves commented Mar 10, 2017

Done.

I also verified that scoring with mean_squared_error does return the same pvalue as accuracy_score, not 1-pvalue as the comment claimed, to be sure it was out of date. Can confirm.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants