Source code for modeva.models.wrappers.builtin.xgboost

from xgboost import XGBRegressor, XGBClassifier

from .fanova_base import FANOVATreeInterpretBase
from ..sklearn import MoSKLearnRegressor, MoSKLearnClassifier


[docs] class MoXGBRegressor(MoSKLearnRegressor, FANOVATreeInterpretBase): """ A lightweight wrapper of :class:`xgboost.XGBRegressor`. Parameters ---------- name : str, default=None Identifier for the model instance. *args Variable length argument list passed to the underlying XGBRegressor model. **kwargs Arbitrary keyword arguments passed to the underlying XGBRegressor model. """ def __init__(self, name: str = None, *args, **kwargs): super().__init__(name=name, estimator=XGBRegressor(*args, **kwargs))
[docs] def get_params(self, deep=True): """ Get parameters for this estimator. Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns ------- params : dict Parameter names mapped to their values. """ return self.estimator.get_params(deep=deep)
[docs] class MoXGBClassifier(MoSKLearnClassifier, FANOVATreeInterpretBase): """ A lightweight wrapper of :class:`xgboost.XGBClassifier`. Parameters ---------- name : str, default=None Identifier for the model instance. *args Variable length argument list passed to the underlying XGBClassifier model. **kwargs Arbitrary keyword arguments passed to the underlying XGBClassifier model. """ def __init__(self, name: str = None, *args, **kwargs): super().__init__(name=name, estimator=XGBClassifier(*args, **kwargs))
[docs] def get_params(self, deep=True): """ Get parameters for this estimator. Parameters ---------- deep : bool, default=True If True, will return the parameters for this estimator and contained subobjects that are estimators. Returns ------- params : dict Parameter names mapped to their values. """ return self.estimator.get_params(deep=deep)