Skip to content

Instantly share code, notes, and snippets.

@FelixChop
Last active June 1, 2018 09:47
Show Gist options
  • Save FelixChop/63c2ed63576f29c5eef1fe4b790a7103 to your computer and use it in GitHub Desktop.
Save FelixChop/63c2ed63576f29c5eef1fe4b790a7103 to your computer and use it in GitHub Desktop.
from sklearn.ensemble import RandomForestClassifier # from xgboost import XGBClassifier
model = RandomForestClassifier() # XGBClassifier()
model.fit(X, y)
pd.DataFrame({'Variable':X.columns,
'Importance':model.feature_importances_}).sort_values('Importance', ascending=False)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment