[tune] update param & install hints for Search Algos (#12242)

* fix(tune): change objective_name param to metric for AxSearch

* fix(tune): install hints for search algos
This commit is contained in:
Kaushik B 2020-11-23 05:09:41 +05:30 committed by GitHub
parent eb89c567e2
commit 643c07e451
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 16 additions and 8 deletions

View file

@ -42,7 +42,7 @@ class AxSearch(Searcher):
(list of two values, lower bound first), "values" for choice
parameters (list of values), and "value" for fixed parameters
(single value).
objective_name (str): Name of the metric used as objective in this
metric (str): Name of the metric used as objective in this
experiment. This metric must be present in `raw_data` argument
to `log_data`. This metric must also be present in the dict
reported/returned by the Trainable.
@ -53,7 +53,7 @@ class AxSearch(Searcher):
outcome_constraints (list[str]): Outcome constraints of form
"metric_name >= bound", like "m1 <= 3."
ax_client (AxClient): Optional AxClient instance. If this is set, do
not pass any values to these parameters: `space`, `objective_name`,
not pass any values to these parameters: `space`, `metric`,
`parameter_constraints`, `outcome_constraints`.
use_early_stopped_trials: Deprecated.
max_concurrent (int): Deprecated.
@ -75,7 +75,7 @@ class AxSearch(Searcher):
intermediate_result = config["x1"] + config["x2"] * i
tune.report(score=intermediate_result)
ax_search = AxSearch(objective_name="score")
ax_search = AxSearch(metric="score")
tune.run(
config=config,
easy_objective,
@ -99,7 +99,7 @@ class AxSearch(Searcher):
intermediate_result = config["x1"] + config["x2"] * i
tune.report(score=intermediate_result)
ax_search = AxSearch(space=parameters, objective_name="score")
ax_search = AxSearch(space=parameters, metric="score")
tune.run(easy_objective, search_alg=ax_search)
"""
@ -113,7 +113,9 @@ class AxSearch(Searcher):
ax_client: Optional[AxClient] = None,
use_early_stopped_trials: Optional[bool] = None,
max_concurrent: Optional[int] = None):
assert ax is not None, "Ax must be installed!"
assert ax is not None, """Ax must be installed!
You can install AxSearch with the command:
`pip install ax-platform sqlalchemy`."""
if mode:
assert mode in ["min", "max"], "`mode` must be 'min' or 'max'."

View file

@ -106,7 +106,9 @@ class TuneBOHB(Searcher):
mode: Optional[str] = None,
seed: Optional[int] = None):
from hpbandster.optimizers.config_generators.bohb import BOHB
assert BOHB is not None, "HpBandSter must be installed!"
assert BOHB is not None, """HpBandSter must be installed!
You can install HpBandSter with the command:
`pip install hpbandster ConfigSpace`."""
if mode:
assert mode in ["min", "max"], "`mode` must be 'min' or 'max'."
self._max_concurrent = max_concurrent

View file

@ -100,7 +100,9 @@ class NevergradSearch(Searcher):
mode: Optional[str] = None,
max_concurrent: Optional[int] = None,
**kwargs):
assert ng is not None, "Nevergrad must be installed!"
assert ng is not None, """Nevergrad must be installed!
You can install Nevergrad with the command:
`pip install nevergrad`."""
if mode:
assert mode in ["min", "max"], "`mode` must be 'min' or 'max'."

View file

@ -144,7 +144,9 @@ class SigOptSearch(Searcher):
if connection is not None:
self.conn = connection
else:
assert sgo is not None, "SigOpt must be installed!"
assert sgo is not None, """SigOpt must be installed!
You can install SigOpt with the command:
`pip install -U sigopt`."""
assert "SIGOPT_KEY" in os.environ, \
"SigOpt API key must be stored as " \
"environ variable at SIGOPT_KEY"