Skip to content

Commit

Permalink
Add a goal hyperparameter to Gama base (#133)
Browse files Browse the repository at this point in the history
This lets GAMA automagically configure the AutoML pipeline based on the
user's intent.
  • Loading branch information
PGijsbers authored Nov 30, 2021
1 parent f1e37f1 commit d5edb29
Show file tree
Hide file tree
Showing 3 changed files with 35 additions and 5 deletions.
10 changes: 10 additions & 0 deletions docs/source/releases.rst
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
Release Notes
=============

Version 21.0.1
--------------

Features:
- Add a ``goal`` hyperparameter to all GAMA estimators which let you specify the goal
of your AutoML execution. Currently ``simplicity`` can be specified to create a
simple model, and ``performance`` can be used to generate the best possible model.
It is still possible to manually set the search and post processing methods.


Version 21.0.0
--------------

Expand Down
2 changes: 1 addition & 1 deletion gama/__version__.py
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# format: YY.minor.micro
__version__ = "21.0.0"
__version__ = "21.0.1"
28 changes: 24 additions & 4 deletions gama/gama.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,10 +93,11 @@ def __init__(
n_jobs: Optional[int] = None,
max_memory_mb: Optional[int] = None,
verbosity: int = logging.WARNING,
search: BaseSearch = AsyncEA(),
post_processing: BasePostProcessing = BestFitPostProcessing(),
search: Optional[BaseSearch] = None,
post_processing: Optional[BasePostProcessing] = None,
output_directory: Optional[str] = None,
store: str = "logs",
goal: str = "simplicity",
):
"""
Expand Down Expand Up @@ -148,12 +149,14 @@ def __init__(
verbosity: int (default=logging.WARNING)
Sets the level of log messages to be automatically output to terminal.
search: BaseSearch (default=AsyncEA())
search: BaseSearch, optional
Search method to use to find good pipelines. Should be instantiated.
Default depends on ``goal``.
post_processing: BasePostProcessing (default=BestFitPostProcessing())
post_processing: BasePostProcessing, optional
Post-processing method to create a model after the search phase.
Should be an instantiated subclass of BasePostProcessing.
Default depends on ``goal``.
output_directory: str, optional (default=None)
Directory to use to save GAMA output. This includes both intermediate
Expand All @@ -166,7 +169,24 @@ def __init__(
- 'models': keep only cache with models and predictions
- 'logs': keep only the logs
- 'all': keep logs and cache with models and predictions
goal: str (default='simplicity')
Determines the steps of the AutoML pipeline when they are not
provided explicitly, based on the given goal.
One of:
- simplicity: Create a simple pipeline with good performance.
- performance: Try to get the best performing model.
"""
if search is None:
search = AsyncEA()
if post_processing is None:
if goal == 'simplicity':
post_processing = BestFitPostProcessing()
elif goal == 'performance':
post_processing = EnsemblePostProcessing()
else:
raise ValueError(f"Unknown value for `goal`: '{goal}'")

if not output_directory:
output_directory = f"gama_{str(uuid.uuid4())}"
self.output_directory = os.path.abspath(os.path.expanduser(output_directory))
Expand Down

0 comments on commit d5edb29

Please sign in to comment.