-
-
Save ayanatherate/97f6cbcc551e05bc04afd74a6c279394 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 chi2 | |
| from sklearn.preprocessing import MinMaxScaler | |
| X_norm = MinMaxScaler().fit_transform(X) | |
| chi_selector = SelectKBest(chi2, k=num_feats) | |
| chi_selector.fit(X_norm, y) | |
| chi_support = chi_selector.get_support() | |
| chi_feature = X.loc[:,chi_support].columns.tolist() | |
| print(str(len(chi_feature)), 'selected features') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment