Skip to content

Commit

Permalink
Merge branch 'master' into sklearn
Browse files Browse the repository at this point in the history
  • Loading branch information
terrytangyuan committed Feb 29, 2016
2 parents 803a6fe + 728b65c commit fdd520d
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ def inner(preds, dmatrix):
return func(labels, preds)
return inner


class XGBModel(XGBModelBase):
# pylint: disable=too-many-arguments, too-many-instance-attributes, invalid-name
"""Implementation of the Scikit-Learn API for XGBoost.
Expand Down Expand Up @@ -500,7 +501,8 @@ def feature_importances_(self):
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())
all_features = np.fromiter(all_features_dict.values(), np.float32)
return all_features / all_features.sum()


class XGBRegressor(XGBModel, XGBRegressorBase):
Expand Down

0 comments on commit fdd520d

Please sign in to comment.