Check booster for dart in feature importance. (#4073)

* Check booster for dart in feature importance.
This commit is contained in:
Jiaming Yuan 2019-01-22 16:03:54 +08:00 committed by GitHub
parent 301cef4638
commit 4fac9874e0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1448,8 +1448,7 @@ class Booster(object):
importance_type: str, default 'weight'
One of the importance types defined above.
"""
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 ValueError('Feature importance is not defined for Booster type {}'
.format(self.booster))