-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'JuliaLogging:master' into fix-MultilineChartContent-not…
…-defined
- Loading branch information
Showing
134 changed files
with
10,970 additions
and
9,796 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
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 |
---|---|---|
|
@@ -6,4 +6,4 @@ test/test_logs | |
docs/Manifest.toml | ||
|
||
gen/proto | ||
gen/protojl | ||
gen/protojl |
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
name = "TensorBoardLogger" | ||
uuid = "899adc3e-224a-11e9-021f-63837185c80f" | ||
authors = ["Filippo Vicentini <[email protected]>"] | ||
version = "0.1.20" | ||
version = "0.1.23" | ||
|
||
[deps] | ||
CRC32c = "8bf52ea8-c179-5cab-976a-9e18b702a9bc" | ||
|
@@ -14,17 +14,20 @@ StatsBase = "2913bbd2-ae8a-5f71-8c99-4fb6c76f3a91" | |
[compat] | ||
FileIO = "1.2.3" | ||
ImageCore = "0.8.1, 0.9" | ||
ProtoBuf = "0.10, 0.11" | ||
ProtoBuf = "1.0.11" | ||
Requires = "0.5, 1" | ||
StatsBase = "0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33" | ||
julia = "1.3" | ||
StatsBase = "0.27, 0.28, 0.29, 0.30, 0.31, 0.32, 0.33, 0.34" | ||
julia = "1.6" | ||
|
||
[extras] | ||
Minio = "4281f0d9-7ae0-406e-9172-b7277c1efa20" | ||
Cairo = "159f3aea-2a34-519c-b102-8c37f9878175" | ||
Fontconfig = "186bb1d3-e1f7-5a2c-a377-96d770f13627" | ||
Gadfly = "c91e804a-d5a3-530f-b6f0-dfbca275c004" | ||
ImageMagick = "6218d12a-5da1-5696-b52f-db25d2ecc6d1" | ||
LightGraphs = "093fc24a-ae57-5d10-9952-331d41423f4d" | ||
Logging = "56ddb016-857b-54e1-b83d-db4d58db5568" | ||
MLDatasets = "eb30cadb-4394-5ae3-aed4-317e484a6458" | ||
Minio = "4281f0d9-7ae0-406e-9172-b7277c1efa20" | ||
Plots = "91a5bcdd-55d7-5caf-9e0b-520d859cae80" | ||
PyPlot = "d330b81b-6aea-500a-939a-2ce795aea3ee" | ||
Test = "8dfed614-e22c-5e08-85e1-65c5234f0b40" | ||
|
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
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
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
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,53 @@ | ||
# Hyperparameter tuning | ||
|
||
We will start this example by setting up a simple random walk experiment, and seeing the effect of the hyperparameter `bias` on the results. | ||
|
||
First, import the packages we will need with: | ||
```julia | ||
using TensorBoardLogger, Logging | ||
using Random | ||
``` | ||
Next, we will create a function which runs the experiment and logs the results, include the hyperparameters stored in the `config` dictionary. | ||
```julia | ||
function run_experiment(id, config) | ||
logger = TBLogger("random_walk/run$id", tb_append) | ||
|
||
# Specify all the metrics we want to track in a list | ||
metric_names = ["scalar/position"] | ||
write_hparams!(logger, config, metric_names) | ||
|
||
epochs = config["epochs"] | ||
sigma = config["sigma"] | ||
bias = config["bias"] | ||
with_logger(logger) do | ||
x = 0.0 | ||
for i in 1:epochs | ||
x += sigma * randn() + bias | ||
@info "scalar" position = x | ||
end | ||
end | ||
nothing | ||
end | ||
``` | ||
Now we can write a script which runs an experiment over a set of parameter values. | ||
```julia | ||
id = 0 | ||
for bias in LinRange(-0.1, 0.1, 11) | ||
for epochs in [50, 100] | ||
config = Dict( | ||
"bias"=>bias, | ||
"epochs"=>epochs, | ||
"sigma"=>0.1 | ||
) | ||
run_experiment(id, config) | ||
id += 1 | ||
end | ||
end | ||
``` | ||
|
||
Below is an example of the dashboard you get when you open Tensorboard with the command: | ||
```sh | ||
tensorboard --logdir=random_walk | ||
``` | ||
|
||
![tuning plot](tuning.png) |
Loading
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
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
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,10 @@ | ||
# Hyperparameter logging | ||
|
||
In additition to logging the experiments, you may wish to also visualise the effect of hyperparameters on some plotted metrics. This can be done by logging the hyperparameters via the `write_hparams!` function, which takes a dictionary mapping hyperparameter names to their values (currently limited to `Real`, `Bool` or `String` types), along with the names of any metrics that you want to view the effects of. | ||
|
||
You can see how the HParams dashboard in Tensorboard can be used to tune hyperparameters on the [tensorboard website](https://www.tensorflow.org/tensorboard/hyperparameter_tuning_with_hparams). | ||
|
||
## API | ||
```@docs | ||
write_hparams! | ||
``` |
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
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,14 @@ | ||
using TensorBoardLogger #import the TensorBoardLogger package | ||
using Logging #import Logging package | ||
using Gadfly, Cairo, Fontconfig | ||
|
||
logger = TBLogger("Gadflylogs", tb_append) #create tensorboard logger | ||
|
||
################log scalars example: y = x²################ | ||
#using logger interface | ||
x = rand(100) | ||
y = rand(100) | ||
p = plot(x=x, y=y, Geom.point); | ||
with_logger(logger) do | ||
@info "gadfly" plot=p | ||
end |
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,38 @@ | ||
using TensorBoardLogger #import the TensorBoardLogger package | ||
using Logging #import Logging package | ||
using Random # Exports randn | ||
|
||
# Run 10 experiments to see a plot | ||
for j in 1:10 | ||
logger = TBLogger("random_walks/run$j", tb_append) | ||
|
||
sigma = 0.1 | ||
epochs = 200 | ||
bias = (rand()*2 - 1) / 10 # create a random bias | ||
use_seed = false | ||
# Add in the a dummy loss metric | ||
with_logger(logger) do | ||
x = 0.0 | ||
for i in 1:epochs | ||
x += sigma * randn() + bias | ||
@info "scalar" loss = x | ||
end | ||
end | ||
|
||
# Hyperparameter is a dictionary of parameter names to their values. This | ||
# supports numerical types, bools and strings. Non-bool numerical types | ||
# are converted to Float64 to be displayed. | ||
hparams_config = Dict{String, Any}( | ||
"sigma"=>sigma, | ||
"epochs"=>epochs, | ||
"bias"=>bias, | ||
"use_seed"=>use_seed, | ||
"method"=>"MC" | ||
) | ||
# Specify a list of tags that you want to show up in the hyperparameter | ||
# comparison | ||
metrics = ["scalar/loss"] | ||
|
||
# Write the hyperparameters and metrics config to the logger. | ||
write_hparams!(logger, hparams_config, metrics) | ||
end |
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
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
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
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
Oops, something went wrong.