, xgb.XGBRegressor(), , , , pandas.DataFrame() numpy.array(), dmatrix(). , , gamma XGBRegressor.
fit = alg.fit(dtrain[ft_cols].values, dtrain['y'].values)
ft_weights = pd.DataFrame(fit.feature_importances_, columns=['weights'], index=ft_cols)
After installing the regressor, it fit.feature_importances_returns an array of weights, which I assume is in the same order as the columns of the pandas dataframe functions.
My current setup is Ubuntu 16.04, Anaconda distro, python 3.6, xgboost 0.6 and sklearn 18.1.
source
share