from sklearn.ensemble import RandomForestRegressor, RandomForestClassifier
from .fanova_base import FANOVATreeInterpretBase
from ..sklearn import MoSKLearnRegressor, MoSKLearnClassifier
[docs]
class MoRandomForestRegressor(MoSKLearnRegressor, FANOVATreeInterpretBase):
"""
A lightweight wrapper of :class:`sklearn.ensemble.RandomForestRegressor`.
Parameters
----------
name : str, default=None
Identifier for the model instance.
*args
Variable length argument list passed to the underlying RandomForestRegressor model.
**kwargs
Arbitrary keyword arguments passed to the underlying RandomForestRegressor model.
"""
def __init__(self, name: str = None, *args, **kwargs):
super().__init__(name=name, estimator=RandomForestRegressor(*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 MoRandomForestClassifier(MoSKLearnClassifier, FANOVATreeInterpretBase):
"""
A lightweight wrapper of :class:`sklearn.ensemble.RandomForestClassifier`.
Parameters
----------
name : str, default=None
Identifier for the model instance.
*args
Variable length argument list passed to the underlying RandomForestClassifier model.
**kwargs
Arbitrary keyword arguments passed to the underlying RandomForestClassifier model.
"""
def __init__(self, name: str = None, *args, **kwargs):
super().__init__(name=name, estimator=RandomForestClassifier(*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)