Merge branch 'master' into master
This commit is contained in:
commit
a46706c82e
@ -1,7 +1,7 @@
|
|||||||
Package: xgboost
|
Package: xgboost
|
||||||
Type: Package
|
Type: Package
|
||||||
Title: Extreme Gradient Boosting
|
Title: Extreme Gradient Boosting
|
||||||
Version: 0.4-2
|
Version: 0.4-3
|
||||||
Date: 2015-08-01
|
Date: 2015-08-01
|
||||||
Author: Tianqi Chen <tianqi.tchen@gmail.com>, Tong He <hetong007@gmail.com>,
|
Author: Tianqi Chen <tianqi.tchen@gmail.com>, Tong He <hetong007@gmail.com>,
|
||||||
Michael Benesty <michael@benesty.fr>
|
Michael Benesty <michael@benesty.fr>
|
||||||
|
|||||||
@ -7,11 +7,11 @@
|
|||||||
#ifndef XGBOOST_R_H_ // NOLINT(*)
|
#ifndef XGBOOST_R_H_ // NOLINT(*)
|
||||||
#define XGBOOST_R_H_ // NOLINT(*)
|
#define XGBOOST_R_H_ // NOLINT(*)
|
||||||
|
|
||||||
extern "C" {
|
|
||||||
#include <Rinternals.h>
|
#include <Rinternals.h>
|
||||||
#include <R_ext/Random.h>
|
#include <R_ext/Random.h>
|
||||||
#include <Rmath.h>
|
#include <Rmath.h>
|
||||||
}
|
|
||||||
#include <xgboost/c_api.h>
|
#include <xgboost/c_api.h>
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
|
|||||||
@ -389,6 +389,8 @@ class XGBClassifier(XGBModel, XGBClassifierBase):
|
|||||||
else:
|
else:
|
||||||
evals = ()
|
evals = ()
|
||||||
|
|
||||||
|
self._features_count = X.shape[1]
|
||||||
|
|
||||||
self._le = LabelEncoder().fit(y)
|
self._le = LabelEncoder().fit(y)
|
||||||
training_labels = self._le.transform(y)
|
training_labels = self._le.transform(y)
|
||||||
|
|
||||||
@ -477,6 +479,22 @@ class XGBClassifier(XGBModel, XGBClassifierBase):
|
|||||||
|
|
||||||
return evals_result
|
return evals_result
|
||||||
|
|
||||||
|
@property
|
||||||
|
def feature_importances_(self):
|
||||||
|
"""
|
||||||
|
Returns
|
||||||
|
-------
|
||||||
|
feature_importances_ : array of shape = [n_features]
|
||||||
|
|
||||||
|
"""
|
||||||
|
fs = self.booster().get_fscore()
|
||||||
|
keys = [int(k.replace('f', '')) for k in fs.keys()]
|
||||||
|
fs_dict = dict(zip(keys, fs.values()))
|
||||||
|
all_features_dict = dict.fromkeys(range(0, self._features_count), 0)
|
||||||
|
all_features_dict.update(fs_dict)
|
||||||
|
return np.array(all_features_dict.values())
|
||||||
|
|
||||||
|
|
||||||
class XGBRegressor(XGBModel, XGBRegressorBase):
|
class XGBRegressor(XGBModel, XGBRegressorBase):
|
||||||
# pylint: disable=missing-docstring
|
# pylint: disable=missing-docstring
|
||||||
__doc__ = """Implementation of the scikit-learn API for XGBoost regression.
|
__doc__ = """Implementation of the scikit-learn API for XGBoost regression.
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user