-
Notifications
You must be signed in to change notification settings - Fork 862
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* hparam support * add test and doc * fix test for py2 * fix CI test again * minor improves * further improvements
- Loading branch information
Showing
11 changed files
with
2,012 additions
and
2 deletions.
There are no files selected for viewing
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
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
from tensorboardX import SummaryWriter | ||
import time | ||
import random | ||
|
||
|
||
hparam = {'lr': [0.1, 0.01, 0.001], | ||
'bsize': [1, 2, 4], | ||
'n_hidden': [100, 200]} | ||
|
||
metrics = {'accuracy', 'loss'} | ||
|
||
def train(lr, bsize, n_hidden): | ||
x = random.random() | ||
return x, x*5 | ||
|
||
with SummaryWriter() as w: | ||
for lr in hparam['lr']: | ||
for bsize in hparam['bsize']: | ||
for n_hidden in hparam['n_hidden']: | ||
accu, loss = train(lr, bsize, n_hidden) | ||
|
||
w.add_hparams({'lr': lr, 'bsize': bsize, 'n_hidden': n_hidden}, | ||
{'accuracy': accu, 'loss': loss}) | ||
|
Oops, something went wrong.