Question

Recently, I have used sklearn(a python meachine learning library) to do a short-text classification task. I found that SelectKBest class can choose K best of features. However, the first argument of SelectKBest is a score function, which "taking two arrays X and y, and returning a pair of arrays (scores, pvalues)". I know that scores, but what is the meaning of pvalues?

Was it helpful?

Solution

In general the p-value indicates how probable a given outcome or a more extreme outcome is under the null hypothesis. In your case of feature selection, the null hypothesis is something like this feature contains no information about the prediction target, where no information is to be interpreted in the sense of the scoring method: If your scoring method tests e.g. univariate linear interaction (f_classif, f_regression in sklearn.feature_selection are options for your scoring function), then the null hypothesis says that this linear interaction is not present.

TL;DR The p-value of a feature selection score indicates the probability that this score or a higher score would be obtained if this variable showed no interaction with the target.

Another general statement: scores are better if greater, p-values are better if smaller (and losses are better if smaller)

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top