How is ANOVA used for function selection

1. Univariate analysis

from sklearn.feature_selection import SelectPercentile

Various functions for calculating the importance of the feature selection:
f_classif : 
Compute the ANOVA F-value for the provided sample.
f_regression : 
1) Compute the correlation between each regressor and the target,

(X [:, i] −mean (X [:, i])) (y − mean (y)) std (X [:, i]) std (y) (X [:, i] −mean (X [:, i])) (y − mean (y)) std (X [:, i]) std (y)

2) It is converted to an F score then to a p-value.
F, p = f_classif (X_train, y_train)


2. Model-based function selection

from sklearn.feature_selection import SelectFromModel

3. RFE, feature deletion step by step

from sklearn.feature_selection import RFE

4. Selection of the serialized functions

from mlxtend.feature_selection import SequentialFeatureSelector


Article last published on: 20