Feature Importance with XGBClassifier : <p>Hopefully I'm reading this wrong but in the XGBoost library <a href="http://xgboost.readthedocs.io/en/latest/python/python_api.html#module-xgboost.sklearn" rel="noreferrer">documentation</a>, there is note of extracting the feature importance attributes using <code>feature_importances_</code> much like sklearn's random forest.</p>

<p>However, for some reason, I keep getting this error: <code>AttributeError: 'XGBClassifier' object has no attribute 'feature_importances_'</code></p>

<p>My code snippet is below:</p>

<pre><code>from sklearn import datasets
import xgboost as xg
iris = datasets.load_iris()
X = iris.data
Y = iris.target
Y = iris.target[ Y &lt; 2] # arbitrarily removing class 2 so it can be 0 and 1
X = X[range(1,len(Y)+1)] # cutting the dataframe to match the rows in Y
xgb = xg.XGBClassifier()
fit = xgb.fit(X, Y)
fit.feature_importances_
</code></pre>

<p>It seems that you can compute feature importance using the <code>Booster</code> object by calling the <code>get_fscore</code> attribute. The only reason I'm using <code>XGBClassifier</code> over <code>Booster</code> is because it is able to be wrapped in a sklearn pipeline. Any thoughts on feature extractions? Is anyone else experiencing this?</p>
