mirror of
https://github.com/wassname/ray.git
synced 2026-08-07 11:27:43 +08:00
[tune] Deprecate ambiguous function values (use tune.function / tune.sample_from instead) (#3457)
* wip * exclude
This commit is contained in:
@@ -29,7 +29,7 @@ ray.tune.suggest
|
||||
|
||||
.. automodule:: ray.tune.suggest
|
||||
:members:
|
||||
:exclude-members: function, grid_search, SuggestionAlgorithm
|
||||
:exclude-members: function, sample_from, grid_search, SuggestionAlgorithm
|
||||
:show-inheritance:
|
||||
|
||||
.. autoclass:: ray.tune.suggest.SuggestionAlgorithm
|
||||
|
||||
@@ -141,8 +141,8 @@ The following shows grid search over two nested parameters combined with random
|
||||
"my_experiment_name": {
|
||||
"run": my_trainable,
|
||||
"config": {
|
||||
"alpha": lambda spec: np.random.uniform(100),
|
||||
"beta": lambda spec: spec.config.alpha * np.random.normal(),
|
||||
"alpha": tune.sample_from(lambda spec: np.random.uniform(100)),
|
||||
"beta": tune.sample_from(lambda spec: spec.config.alpha * np.random.normal()),
|
||||
"nn_layers": [
|
||||
tune.grid_search([16, 64, 256]),
|
||||
tune.grid_search([16, 64, 256]),
|
||||
@@ -153,7 +153,7 @@ The following shows grid search over two nested parameters combined with random
|
||||
|
||||
|
||||
.. note::
|
||||
Lambda functions will be evaluated during trial variant generation. If you need to pass a literal function in your config, use ``tune.function(...)`` to escape it.
|
||||
Use ``tune.sample_from(...)`` to sample from a function during trial variant generation. If you need to pass a literal function in your config, use ``tune.function(...)`` to escape it.
|
||||
|
||||
For more information on variant generation, see `basic_variant.py <https://github.com/ray-project/ray/blob/master/python/ray/tune/suggest/basic_variant.py>`__.
|
||||
|
||||
@@ -169,8 +169,8 @@ By default, each random variable and grid search point is sampled once. To take
|
||||
"my_experiment_name": {
|
||||
"run": my_trainable,
|
||||
"config": {
|
||||
"alpha": lambda spec: np.random.uniform(100),
|
||||
"beta": lambda spec: spec.config.alpha * np.random.normal(),
|
||||
"alpha": tune.sample_from(lambda spec: np.random.uniform(100)),
|
||||
"beta": tune.sample_from(lambda spec: spec.config.alpha * np.random.normal()),
|
||||
"nn_layers": [
|
||||
tune.grid_search([16, 64, 256]),
|
||||
tune.grid_search([16, 64, 256]),
|
||||
|
||||
Reference in New Issue
Block a user