logger class mainly to be used with CMAEvolutionStrategy
Class |
|
data logger for class CMAEvolutionStrategy . |
Class |
|
log an arbitrary number of data (a data row) per "timestep". |
Class |
|
use to fake a Logger in non-verbose setting |
Function | custom |
reduce wasted margin area from 19.0% to 4.0% and make both grids default and |
Function | disp |
displays selected data from (files written by) the class CMADataLogger . |
Function | plot |
plot data from files written by a CMADataLogger , the call cma.plot(name, **argsdict) is a shortcut for cma.CMADataLogger(name).plot(**argsdict) |
Function | plot |
create tar file filename [+ ...] + '.tar.gz' of folder name . |
Function | smartlogygrid |
turn on grid and also minor grid depending on y-limits |
Variable | __author__ |
Undocumented |
Variable | last |
Undocumented |
Function | _fix |
minimize space wasted below x=0 |
Function | _monotone |
make x monotone if not iabscissa. |
reduce wasted margin area from 19.0% to 4.0% and make both grids default and
show legend when labels are available.
displays selected data from (files written by) the class
CMADataLogger
.
The call cma.disp(name, idx) is a shortcut for cma.CMADataLogger(name).disp(idx).
Arguments
name
- name of the logger, filename prefix,
None
evaluates to the default 'outcma/cma' idx
- indices corresponding to rows in the data file; by default the first five, then every 100-th, and the last 10 rows. Too large index values are removed.
The best ever observed iteration is also printed by default.
Examples
import cma from numpy import r_ # assume some data are available from previous runs cma.disp(None, r_[0, -1]) # first and last cma.disp(None, r_[0:int(1e9):100, -1]) # every 100-th and last cma.disp(idx=r_[0, -10:0]) # first and ten last cma.disp(idx=r_[0:int(1e9):1000, -10:0])
See Also | |
CMADataLogger.disp |
plot data from files written by a CMADataLogger
,
the call cma.plot(name, **argsdict) is a shortcut for
cma.CMADataLogger(name).plot(**argsdict)
Arguments
name
- name of the logger, filename prefix, None evaluates to the default 'outcmaes/'
fig
- filename or figure number, or both as a tuple (any order)
abscissa
- 0==plot versus iteration count, 1==plot versus function evaluation number
iteridx
- iteration indices to plot
x_opt
- If
isscalar(x_opt)
it is interpreted as iteration number and the difference of x to the respective iteration is plotted. If it is a negative scalar the respective index rather than the iteration is used. Namely in particular, x_opt=0 subtracts the initial solution X0 and x_opt=-1 subtracts the final solution of the data. If len(x_opt) == dimension, the difference tox_opt
is plotted, otherwise the first row of x_opt are the indices of the variables to be plotted and the second row, if present, is used to take the difference. xsemilog
- customized semilog plot for x-values
fshift
- is added to plotted and shown f-values
Return None
Examples
cma.plot() # the optimization might be still # running in a different shell cma.s.figsave('fig325.png') cma.s.figclose() cdl = cma.CMADataLogger().downsampling().plot() # in case the file sizes are large
Details
Data from codes in other languages (C, Java, Matlab, Scilab) have the same format and can be plotted just the same.
See Also | |
CMADataLogger , CMADataLogger.plot |
create tar file filename [+ ...] + '.tar.gz' of folder name
.
The resulting tar file serves to recreate the current cma.plot
elsewhere.
name
defaults to the folder plotted with cma.plot
by default.
filename
defaults to name
while adding a unique time stamp if
unique
is true.
Return the path of the created file (may be absolute or relative).
Details
This is a convenience replacement for executing tar -czf filename.tar.gz name in a system shell where name defaults to the default plot data folder and filename is created to be unique.
This function calls CMADataLogger.zip
to do the real work.