Skip to content

Commit d5edb29

Browse files
authored
Add a goal hyperparameter to Gama base (#133)
This lets GAMA automagically configure the AutoML pipeline based on the user's intent.
1 parent f1e37f1 commit d5edb29

3 files changed

Lines changed: 35 additions & 5 deletions

File tree

docs/source/releases.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,16 @@
11
Release Notes
22
=============
33

4+
Version 21.0.1
5+
--------------
6+
7+
Features:
8+
- Add a ``goal`` hyperparameter to all GAMA estimators which let you specify the goal
9+
of your AutoML execution. Currently ``simplicity`` can be specified to create a
10+
simple model, and ``performance`` can be used to generate the best possible model.
11+
It is still possible to manually set the search and post processing methods.
12+
13+
414
Version 21.0.0
515
--------------
616

gama/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# format: YY.minor.micro
2-
__version__ = "21.0.0"
2+
__version__ = "21.0.1"

gama/gama.py

Lines changed: 24 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,11 @@ def __init__(
9393
n_jobs: Optional[int] = None,
9494
max_memory_mb: Optional[int] = None,
9595
verbosity: int = logging.WARNING,
96-
search: BaseSearch = AsyncEA(),
97-
post_processing: BasePostProcessing = BestFitPostProcessing(),
96+
search: Optional[BaseSearch] = None,
97+
post_processing: Optional[BasePostProcessing] = None,
9898
output_directory: Optional[str] = None,
9999
store: str = "logs",
100+
goal: str = "simplicity",
100101
):
101102
"""
102103
@@ -148,12 +149,14 @@ def __init__(
148149
verbosity: int (default=logging.WARNING)
149150
Sets the level of log messages to be automatically output to terminal.
150151
151-
search: BaseSearch (default=AsyncEA())
152+
search: BaseSearch, optional
152153
Search method to use to find good pipelines. Should be instantiated.
154+
Default depends on ``goal``.
153155
154-
post_processing: BasePostProcessing (default=BestFitPostProcessing())
156+
post_processing: BasePostProcessing, optional
155157
Post-processing method to create a model after the search phase.
156158
Should be an instantiated subclass of BasePostProcessing.
159+
Default depends on ``goal``.
157160
158161
output_directory: str, optional (default=None)
159162
Directory to use to save GAMA output. This includes both intermediate
@@ -166,7 +169,24 @@ def __init__(
166169
- 'models': keep only cache with models and predictions
167170
- 'logs': keep only the logs
168171
- 'all': keep logs and cache with models and predictions
172+
173+
goal: str (default='simplicity')
174+
Determines the steps of the AutoML pipeline when they are not
175+
provided explicitly, based on the given goal.
176+
One of:
177+
- simplicity: Create a simple pipeline with good performance.
178+
- performance: Try to get the best performing model.
169179
"""
180+
if search is None:
181+
search = AsyncEA()
182+
if post_processing is None:
183+
if goal == 'simplicity':
184+
post_processing = BestFitPostProcessing()
185+
elif goal == 'performance':
186+
post_processing = EnsemblePostProcessing()
187+
else:
188+
raise ValueError(f"Unknown value for `goal`: '{goal}'")
189+
170190
if not output_directory:
171191
output_directory = f"gama_{str(uuid.uuid4())}"
172192
self.output_directory = os.path.abspath(os.path.expanduser(output_directory))

0 commit comments

Comments
 (0)