2017-01-10 220 views
3

我通过其scikit学习风格的Python接口调用xgboost:xgboost是否有feature_importances_?

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' 

...和xgboost C来自github上++库,提交ef8d92fc52c674c44b824949388e72175f72e4d1

回答