xgboost 模型 getfscore:'str' 对象不可调用

Cha*_*han 2 callable python-2.7 xgboost

feat_imp = pd.Series(xgbPara.booster().get_fscore()).sort_values(ascending=False) 

TypeError: 'str' object is not callable
Run Code Online (Sandbox Code Playgroud)

我可以在pycharm中运行它,但是当我在pyspark中运行它时,会出现类型错误。

谁能告诉我为什么?谢谢?

Rul*_*uli 8

替换xgbPara.booster()xgbPara.get_booster(),如果这不起作用,则您的版本不匹配,您需要升级 sklearn、xgboost 或两者。希望这可以帮助。