Check booster for dart in feature importance. (#4073)
* Check booster for dart in feature importance.
This commit is contained in:
parent
301cef4638
commit
4fac9874e0
@ -1448,8 +1448,7 @@ class Booster(object):
|
|||||||
importance_type: str, default 'weight'
|
importance_type: str, default 'weight'
|
||||||
One of the importance types defined above.
|
One of the importance types defined above.
|
||||||
"""
|
"""
|
||||||
|
if getattr(self, 'booster', None) is not None and self.booster not in {'gbtree', 'dart'}:
|
||||||
if getattr(self, 'booster', None) is not None and self.booster != 'gbtree':
|
|
||||||
raise ValueError('Feature importance is not defined for Booster type {}'
|
raise ValueError('Feature importance is not defined for Booster type {}'
|
||||||
.format(self.booster))
|
.format(self.booster))
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user