Fix #3894: Allow loading pickles without self.booster attributes (redux) (#3944)

This commit is contained in:
Philip Hyunsu Cho 2018-11-28 09:31:46 -08:00 committed by GitHub
parent 9c4ff50e83
commit c5130e487a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1444,7 +1444,7 @@ class Booster(object):
One of the importance types defined above.
"""
if self.booster != 'gbtree':
if getattr(self, 'booster', None) is not None and self.booster != 'gbtree':
raise ValueError('Feature importance is not defined for Booster type {}'
.format(self.booster))