Created
April 8, 2020 22:00
-
-
Save smazzanti/a43f96186ab1973d95fa0f87906cb6fd 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 boruta import BorutaPy | |
# instantiate random forest | |
forest = RandomForestRegressor(n_jobs = -1, max_depth = 5) | |
# fit boruta | |
boruta_selector = BorutaPy(forest, n_estimators = 'auto', random_state = 0) | |
boruta_selector.fit(np.array(X_trn), np.array(y_trn)) | |
# store results | |
boruta_ranking = boruta_selector.ranking_ | |
selected_features = np.array(feature_names)[boruta_ranking <= 2] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment