Skip to content

Commit

Permalink
Fix #4497: Enable feature importance property for DART booster (#4525)
Browse files Browse the repository at this point in the history
  • Loading branch information
hcho3 committed May 31, 2019
1 parent ea44417 commit c2a3902
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion python-package/xgboost/sklearn.py
Original file line number Diff line number Diff line change
Expand Up @@ -536,7 +536,7 @@ def feature_importances_(self):
feature_importances_ : array of shape ``[n_features]``
"""
if getattr(self, 'booster', None) is not None and self.booster != 'gbtree':
if getattr(self, 'booster', None) is not None and self.booster not in {'gbtree', 'dart'}:
raise AttributeError('Feature importance is not defined for Booster type {}'
.format(self.booster))
b = self.get_booster()
Expand Down

0 comments on commit c2a3902

Please sign in to comment.