From c9740eb5a9a0abac7ce555a51db162959a33f77c Mon Sep 17 00:00:00 2001 From: hershg Date: Fri, 24 May 2019 22:09:14 -0700 Subject: [PATCH] refactored code to use metric,mode instead of reward_attr for schedulers (#4120) --- ci/long_running_tests/workloads/pbt.py | 3 ++- doc/source/tune-schedulers.rst | 8 +++++--- python/ray/tune/examples/async_hyperband_example.py | 3 ++- python/ray/tune/examples/ax_example.py | 2 +- python/ray/tune/examples/bayesopt_example.py | 2 +- python/ray/tune/examples/genetic_example.py | 2 +- python/ray/tune/examples/hyperband_example.py | 3 ++- python/ray/tune/examples/hyperopt_example.py | 2 +- python/ray/tune/examples/mnist_pytorch.py | 3 ++- python/ray/tune/examples/mnist_pytorch_trainable.py | 2 +- python/ray/tune/examples/nevergrad_example.py | 2 +- python/ray/tune/examples/pbt_example.py | 3 ++- python/ray/tune/examples/pbt_ppo_example.py | 3 ++- python/ray/tune/examples/pbt_tune_cifar10_with_keras.py | 3 ++- python/ray/tune/examples/sigopt_example.py | 2 +- python/ray/tune/examples/skopt_example.py | 4 ++-- python/ray/tune/examples/tune_cifar10_gluon.py | 3 ++- python/ray/tune/examples/tune_mnist_async_hyperband.py | 3 ++- python/ray/tune/examples/tune_mnist_keras.py | 3 ++- python/ray/tune/examples/tune_mnist_ray_hyperband.py | 2 +- python/ray/tune/tests/test_experiment_analysis.py | 3 ++- python/ray/tune/tests/test_trial_scheduler.py | 8 +++++--- 22 files changed, 42 insertions(+), 27 deletions(-) diff --git a/ci/long_running_tests/workloads/pbt.py b/ci/long_running_tests/workloads/pbt.py index 86473d86ec4d..5e63596c4a79 100644 --- a/ci/long_running_tests/workloads/pbt.py +++ b/ci/long_running_tests/workloads/pbt.py @@ -37,7 +37,8 @@ pbt = PopulationBasedTraining( time_attr="training_iteration", - reward_attr="episode_reward_mean", + metric="episode_reward_mean", + mode="max", perturbation_interval=10, hyperparam_mutations={ "lr": [0.1, 0.01, 0.001, 0.0001], diff --git a/doc/source/tune-schedulers.rst b/doc/source/tune-schedulers.rst index cbb105ff5806..f9734181eb37 100644 --- a/doc/source/tune-schedulers.rst +++ b/doc/source/tune-schedulers.rst @@ -7,7 +7,7 @@ By default, Tune schedules trials in serial order with the ``FIFOScheduler`` cla tune.run( ... , scheduler=AsyncHyperBandScheduler()) -Tune includes distributed implementations of early stopping algorithms such as `Median Stopping Rule `__, `HyperBand `__, and an `asynchronous version of HyperBand `__. These algorithms are very resource efficient and can outperform Bayesian Optimization methods in `many cases `__. Currently, all schedulers take in a ``reward_attr``, which is assumed to be maximized. +Tune includes distributed implementations of early stopping algorithms such as `Median Stopping Rule `__, `HyperBand `__, and an `asynchronous version of HyperBand `__. These algorithms are very resource efficient and can outperform Bayesian Optimization methods in `many cases `__. Currently, all schedulers take in a ``metric``, which is minimized or maximized according to ``mode``. Current Available Trial Schedulers: @@ -25,7 +25,8 @@ Tune includes a distributed implementation of `Population Based Training (PBT) < pbt_scheduler = PopulationBasedTraining( time_attr='time_total_s', - reward_attr='mean_accuracy', + metric='mean_accuracy', + mode='max', perturbation_interval=600.0, hyperparam_mutations={ "lr": [1e-3, 5e-4, 1e-4, 5e-5, 1e-5], @@ -52,7 +53,8 @@ The `asynchronous version of HyperBand