Created
November 6, 2020 09:41
-
-
Save seahrh/c5a5e841340f5f805fe2b86bfbb326e9 to your computer and use it in GitHub Desktop.
Put feature importance scores in dataframe
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
feature_important = clf.get_booster().get_score(importance_type="weight") | |
keys = list(feature_important.keys()) | |
values = list(feature_important.values()) | |
data = pd.DataFrame(data=values, index=keys, columns=["score"]).sort_values(by = "score", ascending=False) | |
# Top 10 features | |
data.head(20) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment