Closed cesar-bonilla-olx closed 6 years ago
@cesar-bonilla-olx please also check the master branch, some issues you mention are already fixed, we didn't make a PyPI release with them yet.
Yes, sorry, now I see, is the same that I was going to propose, so good. Done!
There is another cool thing to add --> is_regression=False to avoid the problem of (None, False) in the _decision_path
def _check_booster_args(xgb, is_regression=False):
# type: (Any, bool) -> Tuple[Booster, bool]
if isinstance(xgb, Booster):
booster = xgb
else:
if hasattr(xgb, 'get_booster'):
booster = xgb.get_booster()
else: # xgb < 0.7
booster = xgb.booster()
_is_regression = isinstance(xgb, XGBRegressor)
if is_regression is not None and is_regression != _is_regression:
raise ValueError(
'Inconsistent is_regression={} passed. '
'You don\'t have to pass it when using scikit-learn API'
.format(is_regression))
is_regression = _is_regression
return booster, is_regression
For example, working with XGBoost 0.8, and Scikit Learn 0.19.2 I've got errors from method def
_check_booster_args(xgb,` `is_regression=None):
because doesn't handle atribute xgb._Booster instead of call xbg.booster(). I will propose a PR for that