【发布时间】:2017-05-24 17:19:32
【问题描述】:
我正在通过其 scikit-learn 风格的 Python 接口调用 xgboost:
model = xgboost.XGBRegressor()
%time model.fit(trainX, trainY)
testY = model.predict(testX)
一些 sklearn 模型通过属性feature_importances 告诉您它们为特征分配的重要性。 XGBRegressor 似乎不存在这种情况:
model.feature_importances_
AttributeError Traceback (most recent call last)
<ipython-input-36-fbaa36f9f167> in <module>()
----> 1 model.feature_importances_
AttributeError: 'XGBRegressor' object has no attribute 'feature_importances_'
奇怪的是:对于我的一个合作者来说,feature_importances_ 属性就在那里!可能是什么问题?
这些是我拥有的版本:
In [2]: xgboost.__version__
Out[2]: '0.6'
In [4]: sklearn.__version__
Out[4]: '0.18.1'
...以及来自 github 的 xgboost C++ 库,提交 ef8d92fc52c674c44b824949388e72175f72e4d1。
【问题讨论】:
标签: python c++ machine-learning scikit-learn xgboost