[tune] Usability tweaks#2874
Conversation
|
Test FAILed. |
ericl
left a comment
There was a problem hiding this comment.
Shall we also add num iters to the summary line?
| messages.append(" - {}:\t{}".format(t, t.progress_string())) | ||
| sorted_trials = sorted(trials, key=lambda t: t.experiment_tag) | ||
| if len(trials) > limit: | ||
| tail_length = math.floor(limit/2) |
There was a problem hiding this comment.
Consider int div '//' instead
|
Isn't Code: from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import ray
from ray.tune import run_experiments, register_trainable
from ray.tune.schedulers import AsyncHyperBandScheduler
from ray.tune.suggest import HyperOptSearch
def easy_objective(config, reporter):
import time
time.sleep(0.2)
assert type(config["activation"]) == str, \
"Config is incorrect: {}".format(type(config["activation"]))
for i in range(100):
reporter(
timesteps_total=i,
neg_mean_loss=-(config["height"] - 14)**2 +
abs(config["width"] - 3))
time.sleep(0.02)
if __name__ == '__main__':
import argparse
from hyperopt import hp
parser = argparse.ArgumentParser()
parser.add_argument(
"--smoke-test", action="store_true", help="Finish quickly for testing")
args, _ = parser.parse_known_args()
ray.init(redirect_output=True)
register_trainable("exp", easy_objective)
space = {
'width': hp.uniform('width', 0, 20),
'height': hp.uniform('height', -100, 100),
'activation': hp.choice("activation", ["relu", "tanh"])
}
config = {
"my_exp": {
"run": "exp",
"num_samples": 10 if args.smoke_test else 1000,
"stop": {
"training_iteration": 100
},
}
}
algo = HyperOptSearch(space, max_concurrent=4, reward_attr="neg_mean_loss")
scheduler = AsyncHyperBandScheduler(reward_attr="neg_mean_loss")
run_experiments(config, search_alg=algo, scheduler=scheduler)gives me output: on this branch right now. |
|
Hm weird, maybe it was something else.
…On Fri, Sep 14, 2018, 1:34 PM Richard Liaw ***@***.***> wrote:
Isn't iter already shown?
Code:
from __future__ import absolute_importfrom __future__ import divisionfrom __future__ import print_function
import rayfrom ray.tune import run_experiments, register_trainablefrom ray.tune.schedulers import AsyncHyperBandSchedulerfrom ray.tune.suggest import HyperOptSearch
def easy_objective(config, reporter):
import time
time.sleep(0.2)
assert type(config["activation"]) == str, \
"Config is incorrect: {}".format(type(config["activation"]))
for i in range(100):
reporter(
timesteps_total=i,
neg_mean_loss=-(config["height"] - 14)**2 +
abs(config["width"] - 3))
time.sleep(0.02)
if __name__ == '__main__':
import argparse
from hyperopt import hp
parser = argparse.ArgumentParser()
parser.add_argument(
"--smoke-test", action="store_true", help="Finish quickly for testing")
args, _ = parser.parse_known_args()
ray.init(redirect_output=True)
register_trainable("exp", easy_objective)
space = {
'width': hp.uniform('width', 0, 20),
'height': hp.uniform('height', -100, 100),
'activation': hp.choice("activation", ["relu", "tanh"])
}
config = {
"my_exp": {
"run": "exp",
"num_samples": 10 if args.smoke_test else 1000,
"stop": {
"training_iteration": 100
},
}
}
algo = HyperOptSearch(space, max_concurrent=4, reward_attr="neg_mean_loss")
scheduler = AsyncHyperBandScheduler(reward_attr="neg_mean_loss")
run_experiments(config, search_alg=algo, scheduler=scheduler)
gives me output:
== Status ==
Using AsyncHyperBand: num_stopped=0
Bracket: Iter 90.000: None | Iter 30.000: None | Iter 10.000: None
Bracket: Iter 90.000: None | Iter 30.000: None
Bracket: Iter 90.000: None
Resources requested: 4/48 CPUs, 0/1 GPUs
Result logdir: /home/eecs/rliaw/ray_results/my_exp
RUNNING trials:
- exp_10_n=tanh,t=-17.95,h=8.5007: RUNNING
- exp_11_n=tanh,t=-37.719,h=8.6749: RUNNING
- exp_12_n=relu,t=-17.59,h=5.3634: RUNNING
- exp_9_n=tanh,t=58.015,h=6.2248: RUNNING [pid=27364], 1 s, 1 iter, 39 ts
TERMINATED trials:
- exp_1_n=relu,t=-16.999,h=13.989: TERMINATED [pid=23841], 4 s, 4 iter, 99 ts
- exp_2_n=tanh,t=-15.736,h=8.2097: TERMINATED [pid=23842], 4 s, 4 iter, 99 ts
- exp_3_n=relu,t=71.59,h=9.7102: TERMINATED [pid=23830], 4 s, 4 iter, 99 ts
- exp_4_n=tanh,t=-27.854,h=9.1752: TERMINATED [pid=23824], 4 s, 4 iter, 99 ts
- exp_5_n=tanh,t=-58.677,h=9.5805: TERMINATED [pid=23811], 4 s, 4 iter, 99 ts
- exp_6_n=tanh,t=64.094,h=1.6311: TERMINATED [pid=23839], 4 s, 4 iter, 99 ts
- exp_7_n=tanh,t=76.081,h=18.001: TERMINATED [pid=23844], 4 s, 4 iter, 99 ts
- exp_8_n=tanh,t=-29.688,h=4.1828: TERMINATED [pid=27191], 4 s, 4 iter, 99 ts
on this branch right now.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2874 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAA6Sthx4m5INTfeArjqWVq6wsJpGQl0ks5ubBLFgaJpZM4Wotj9>
.
|
|
OK cool. Right now the TODO is that trials need to be sorted numerically rather than by string... |
|
Should now look like: |
| def _naturalize(string): | ||
| """Provides a natural representation for string for nice sorting.""" | ||
| splits = re.split('([0-9]+)', string) | ||
| return [int(text) if text.isdigit() else text.lower() for text in splits] |
|
Test PASSed. |
|
Test PASSed. |
What do these changes do?
Related issue number
Addresses #2873 #2872.