We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 9f5b645 commit 8b6a226Copy full SHA for 8b6a226
XGB Feature Importance
@@ -0,0 +1,10 @@
1
+def importance_XGB(model):
2
+ impdf = []
3
+ for ft, score in model.get_fscore().iteritems():
4
+ impdf.append({'feature': ft, 'importance': score})
5
+ impdf = pd.DataFrame(impdf)
6
+ impdf = impdf.sort_values(by='importance', ascending=False).reset_index(drop=True)
7
+ impdf['importance'] /= impdf['importance'].sum()
8
+ return impdf
9
+
10
+ importance_XGB(model)
0 commit comments