Xgboost feature importance

xgboost

#1

https://www.analyticsvidhya.com/blog/2016/03/complete-guide-parameter-tuning-xgboost-with-codes-python/

I was trying the code of xgboost but got error on line
feat_imp = pd.Series(alg.booster().get_fscore()).sort_values(ascending=False)

TypeError: ‘str’ object is not callable

It says alg.booster().get_fscore() is not working fine. I am working on kaggle environment


#2

Hi,
Can you please share the complete code snippet so that the community can better understand and help you debug this?
Regards
Ankit


#3

you can try “alg.get_booster().get_fscore()” instead of “alg.booster().get_fscore()”. it works to me.