Last active
July 15, 2020 12:08
-
-
Save Ayushijain09/a4bce2c23bf0bb12f85cdc7b741a7d5f to your computer and use it in GitHub Desktop.
Anova feature selection
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from sklearn.feature_selection import SelectKBest | |
from sklearn.feature_selection import f_regression | |
fvalue_selector = SelectKBest(f_regression, k=20) #select features with 20 best ANOVA F-Values | |
X_train_new = fvalue_selector.fit_transform(X_train, y_train) | |
print(X_train.shape, X_train_new.shape) #output (143, 59) (143, 20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment