Skip to content

Commit 800912c

Browse files
committed
Update docstrings of include and exclude parameters of the estimators (#1332)
* Update docstrings and types * doc typo fix * flake'd
1 parent c2ecbcd commit 800912c

File tree

3 files changed

+67
-23
lines changed

3 files changed

+67
-23
lines changed

autosklearn/automl.py

+10-6
Original file line numberDiff line numberDiff line change
@@ -172,8 +172,8 @@ def __init__(self,
172172
memory_limit=3072,
173173
metadata_directory=None,
174174
debug_mode=False,
175-
include=None,
176-
exclude=None,
175+
include: Optional[Dict[str, List[str]]] = None,
176+
exclude: Optional[Dict[str, List[str]]] = None,
177177
resampling_strategy='holdout-iterative-fit',
178178
resampling_strategy_arguments=None,
179179
n_jobs=None,
@@ -1844,10 +1844,14 @@ def show_models(self):
18441844

18451845
return sio.getvalue()
18461846

1847-
def _create_search_space(self, tmp_dir, backend, datamanager,
1848-
include=None,
1849-
exclude=None,
1850-
):
1847+
def _create_search_space(
1848+
self,
1849+
tmp_dir,
1850+
backend,
1851+
datamanager,
1852+
include: Optional[Dict[str, List[str]]] = None,
1853+
exclude: Optional[Dict[str, List[str]]] = None,
1854+
):
18511855
task_name = 'CreateConfigSpace'
18521856

18531857
self._stopwatch.start_task(task_name)

autosklearn/estimators.py

+54-15
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,8 @@ def __init__(
3434
max_models_on_disc=50,
3535
seed=1,
3636
memory_limit=3072,
37-
include=None,
38-
exclude=None,
37+
include: Optional[Dict[str, List[str]]] = None,
38+
exclude: Optional[Dict[str, List[str]]] = None,
3939
resampling_strategy='holdout',
4040
resampling_strategy_arguments=None,
4141
tmp_folder=None,
@@ -97,24 +97,63 @@ def __init__(
9797
Memory limit in MB for the machine learning algorithm.
9898
`auto-sklearn` will stop fitting the machine learning algorithm if
9999
it tries to allocate more than ``memory_limit`` MB.
100-
101-
**Important notes:**
102-
100+
101+
**Important notes:**
102+
103103
* If ``None`` is provided, no memory limit is set.
104-
* In case of multi-processing, ``memory_limit`` will be *per job*, so the total usage is
104+
* In case of multi-processing, ``memory_limit`` will be *per job*, so the total usage is
105105
``n_jobs x memory_limit``.
106106
* The memory limit also applies to the ensemble creation process.
107107
108-
include : dict, optional (None)
109-
If None, all possible algorithms are used. Otherwise specifies
110-
set of algorithms for each added component is used. Include and
111-
exclude are incompatible if used together on the same component
108+
include : Optional[Dict[str, List[str]]] = None
109+
If None, all possible algorithms are used.
110+
111+
Otherwise, specifies a step and the components that are included in search.
112+
See ``/pipeline/components/<step>/*`` for available components.
113+
114+
Incompatible with parameter ``exclude``.
115+
116+
**Possible Steps**:
117+
118+
* ``"data_preprocessor"``
119+
* ``"balancing"``
120+
* ``"feature_preprocessor"``
121+
* ``"classifier"`` - Only for when when using ``AutoSklearnClasssifier``
122+
* ``"regressor"`` - Only for when when using ``AutoSklearnRegressor``
123+
124+
**Example**:
125+
126+
.. code-block:: python
127+
128+
include = {
129+
'classifier': ["random_forest"],
130+
'feature_preprocessor': ["no_preprocessing"]
131+
}
132+
133+
exclude : Optional[Dict[str, List[str]]] = None
134+
If None, all possible algorithms are used.
135+
136+
Otherwise, specifies a step and the components that are excluded from search.
137+
See ``/pipeline/components/<step>/*`` for available components.
138+
139+
Incompatible with parameter ``include``.
140+
141+
**Possible Steps**:
142+
143+
* ``"data_preprocessor"``
144+
* ``"balancing"``
145+
* ``"feature_preprocessor"``
146+
* ``"classifier"`` - Only for when when using ``AutoSklearnClasssifier``
147+
* ``"regressor"`` - Only for when when using ``AutoSklearnRegressor``
148+
149+
**Example**:
150+
151+
.. code-block:: python
112152
113-
exclude : dict, optional (None)
114-
If None, all possible algorithms are used. Otherwise specifies
115-
set of algorithms for each added component is not used.
116-
Incompatible with include. Include and exclude are incompatible
117-
if used together on the same component
153+
exclude = {
154+
'classifier': ["random_forest"],
155+
'feature_preprocessor': ["no_preprocessing"]
156+
}
118157
119158
resampling_strategy : string or object, optional ('holdout')
120159
how to to handle overfitting, might need 'resampling_strategy_arguments'

autosklearn/smbo.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
from typing import Dict, List, Optional
12
import copy
23
import json
34
import logging
@@ -231,8 +232,8 @@ def __init__(self, config_space, dataset_name,
231232
metadata_directory=None,
232233
resampling_strategy='holdout',
233234
resampling_strategy_args=None,
234-
include=None,
235-
exclude=None,
235+
include: Optional[Dict[str, List[str]]] = None,
236+
exclude: Optional[Dict[str, List[str]]] = None,
236237
disable_file_output=False,
237238
smac_scenario_args=None,
238239
get_smac_object_callback=None,

0 commit comments

Comments
 (0)