mirror of
https://github.com/microsoft/autogen.git
synced 2025-11-10 06:44:20 +00:00
Docs (#765)
* Small docstring change for clarity * Added tentative changes to docs * Update website/docs/Use-Cases/Task-Oriented-AutoML.md Co-authored-by: Chi Wang <wang.chi@microsoft.com> * Update flaml/model.py Co-authored-by: Chi Wang <wang.chi@microsoft.com> * Updated model.py to reflect `n_jobs = None` suggestion * Updated tutorial to reflect `n_jobs=None` suggestion * Update model.py Improved string Co-authored-by: Chi Wang <wang.chi@microsoft.com> Co-authored-by: Qingyun Wu <qingyun.wu@psu.edu>
This commit is contained in:
parent
29dea3a983
commit
65ad6508ce
@ -921,7 +921,16 @@ class TransformersEstimatorModelSelection(TransformersEstimator):
|
|||||||
|
|
||||||
|
|
||||||
class SKLearnEstimator(BaseEstimator):
|
class SKLearnEstimator(BaseEstimator):
|
||||||
"""The base class for tuning scikit-learn estimators."""
|
"""
|
||||||
|
The base class for tuning scikit-learn estimators.
|
||||||
|
|
||||||
|
Subclasses can modify the function signature of ``__init__`` to
|
||||||
|
ignore the values in ``config`` that are not relevant to the constructor
|
||||||
|
of their underlying estimator. For example, some regressors in ``scikit-learn``
|
||||||
|
don't accept the ``n_jobs`` parameter contained in ``config``. For these,
|
||||||
|
one can add ``n_jobs=None,`` before ``**config`` to make sure ``config`` doesn't
|
||||||
|
contain an ``n_jobs`` key.
|
||||||
|
"""
|
||||||
|
|
||||||
def __init__(self, task="binary", **config):
|
def __init__(self, task="binary", **config):
|
||||||
super().__init__(task, **config)
|
super().__init__(task, **config)
|
||||||
|
|||||||
@ -169,7 +169,7 @@ class MyRegularizedGreedyForest(SKLearnEstimator):
|
|||||||
return space
|
return space
|
||||||
```
|
```
|
||||||
|
|
||||||
In the constructor, we set `self.estimator_class` as `RGFClassifier` or `RGFRegressor` according to the task type. If the estimator you want to tune does not have a scikit-learn style `fit()` and `predict()` API, you can override the `fit()` and `predict()` function of `flaml.model.BaseEstimator`, like [XGBoostEstimator](../reference/model#xgboostestimator-objects).
|
In the constructor, we set `self.estimator_class` as `RGFClassifier` or `RGFRegressor` according to the task type. If the estimator you want to tune does not have a scikit-learn style `fit()` and `predict()` API, you can override the `fit()` and `predict()` function of `flaml.model.BaseEstimator`, like [XGBoostEstimator](../reference/model#xgboostestimator-objects). Importantly, we also add the `task="binary"` parameter in the signature of `__init__` so that it doesn't get grouped together with the `**config` kwargs that determines the parameters with which the underlying estimator (`self.estimator_class`) is constructed. If your estimator doesn't use one of the parameters that it is passed, for example some regressors in `scikit-learn` don't use the `n_jobs` parameter, it is enough to add `n_jobs=None` to the signature so that it is ignored by the `**config` dict.
|
||||||
|
|
||||||
2. Give the custom estimator a name and add it in AutoML. E.g.,
|
2. Give the custom estimator a name and add it in AutoML. E.g.,
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user