-
-
Save ayanatherate/3b62afed28184e91812fa7f76676cd94 to your computer and use it in GitHub Desktop.
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 SelectFromModel | |
from sklearn.linear_model import LogisticRegression | |
embeded_lr_selector = SelectFromModel(LogisticRegression(penalty="l1"), max_features=num_feats) | |
embeded_lr_selector.fit(X_norm, y) | |
embeded_lr_support = embeded_lr_selector.get_support() | |
embeded_lr_feature = X.loc[:,embeded_lr_support].columns.tolist() | |
print(str(len(embeded_lr_feature)), 'selected features') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment