The addition of self.booster attribute broke backward compatibility.
This commit is contained in:
parent
7d3149a21f
commit
f9302a56fb
@ -518,7 +518,7 @@ class XGBModel(XGBModelBase):
|
||||
feature_importances_ : array of shape ``[n_features]``
|
||||
|
||||
"""
|
||||
if self.booster != 'gbtree':
|
||||
if getattr(self, 'booster', None) is not None and self.booster != 'gbtree':
|
||||
raise AttributeError('Feature importance is not defined for Booster type {}'
|
||||
.format(self.booster))
|
||||
b = self.get_booster()
|
||||
@ -542,7 +542,7 @@ class XGBModel(XGBModelBase):
|
||||
-------
|
||||
coef_ : array of shape ``[n_features]`` or ``[n_classes, n_features]``
|
||||
"""
|
||||
if self.booster != 'gblinear':
|
||||
if getattr(self, 'booster', None) is not None and self.booster != 'gblinear':
|
||||
raise AttributeError('Coefficients are not defined for Booster type {}'
|
||||
.format(self.booster))
|
||||
b = self.get_booster()
|
||||
@ -571,7 +571,7 @@ class XGBModel(XGBModelBase):
|
||||
-------
|
||||
intercept_ : array of shape ``(1,)`` or ``[n_classes]``
|
||||
"""
|
||||
if self.booster != 'gblinear':
|
||||
if getattr(self, 'booster', None) is not None and self.booster != 'gblinear':
|
||||
raise AttributeError('Intercept (bias) is not defined for Booster type {}'
|
||||
.format(self.booster))
|
||||
b = self.get_booster()
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user