Created
November 14, 2020 12:22
-
-
Save EliaCereda/149f125232e6d53e9eca83bc91608047 to your computer and use it in GitHub Desktop.
WandB Ray Tune Nested Config Test Case
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import wandb | |
from wandb.sweeps.config import tune | |
from wandb.sweeps.config.tune.suggest.hyperopt import HyperOptSearch | |
from wandb.sweeps.config.hyperopt import hp | |
tune_config = tune.run( | |
'example.py', | |
search_alg=HyperOptSearch( | |
hp.choice('classifier_type', [ | |
{ | |
'type': 'naive_bayes', | |
}, | |
{ | |
'type': 'svm', | |
'C': hp.uniform('svm_C', 0, 1), | |
'kernel': hp.choice('svm_kernel', [ | |
{'ktype': 'linear'}, | |
{'ktype': 'RBF', 'width': hp.uniform('svm_rbf_width', 0, 1)}, | |
]), | |
}, | |
{ | |
'type': 'dtree', | |
'criterion': hp.choice('dtree_criterion', ['gini', 'entropy']), | |
'max_depth': hp.choice('dtree_max_depth', | |
[None, hp.uniform('dtree_max_depth_int', 3, 1, 1)]), | |
'min_samples_split': hp.uniform('dtree_min_samples_split', 2, 1, 1), | |
}, | |
]), | |
metric="valid/accuracy", | |
mode="max"), | |
num_samples=100) | |
# Save sweep as yaml config file | |
tune_config.save("raytune-nested-test.yaml") | |
# Create the sweep | |
wandb.sweep(tune_config) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment