Post-processing
The optzer writes some messages to stdout and we recommend it redirected to out.optzer
as,
optzer --nproc 4 --random-seed 42 | tee out.optzer
In addition to the stdout, optzer writes db.optzer.json
file which contains all the trial parameters and their loss values.
The db.optzer.json
can be loaded using pandas.read_json as,
import pandas as pd
db = pd.read_json('db.optzer.json',orient='records',lines=True)
print(db)
The options orient
and lines
are required to load it successfully.
You can convert the db.optzer.json
to CSV format using the script optzer-db2csv
as,
optzer-db2csv db.optzer.json out.csv
Then you can plot it with gnuplot, for example,
gnuplot
gnuplot> p 'out.csv' us 2:3 w p
gnuplot> p 'out.csv' us 4:3 w p pt 5, '' us 5:3 w p pt 7
The script optzer-out2md
will extract loss information from out.optzer
and tidy it up to markdown format.
optzer-out2md out.optzer
This will gives you the following table in markdown format.
| Target | Weight | Loss |
|----------|---------|--------|
| simple | 1.000 | 0.0235 |
| total | ----- | 0.0235 |
This table will be shown as below if the markdown is processed correctly…
Target | Weight | Loss |
---|---|---|
simple | 1.000 | 0.0235 |
total | —– | 0.0235 |
To get the best data calculated during the optzer, the optzer-get-best
script extracts and copy them to best_data
directory as,
optzer-get-best
ls best_data/
The best parameters are written in in.vars.optzer.best
file.
And you can extract and map them into the parameter files that can be read from external programs as,
mkdir 00_test
cd 00_test
optzer-out2prms ../in.vars.optzer.best ../in.params.simple
or
optzer-db2prms ../db.optzer.json ../in.params.simple
- Above example is for the case of
optzer/examples/01_simple_example
. One can specify severalin.params.XXX
files that contain placeholders for the parameters. - This script should be performed different directory from the working directory of the optzer to avoid replacing
in.params.XXX
files. (The script will raise an Error in such a case.)