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

@leereeves

Description

@leereeves

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions