module documentation
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 | 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 | smartlogygrid |
turn on grid and also minor grid depending on y-limits |
Variable | __author__ |
Undocumented |
Variable | last |
Undocumented |
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 |
def plot(name=None, fig=None, abscissa=1, iteridx=None, plot_mean=False, foffset=1e-19, x_opt=None, fontsize=7, downsample_to=3000.0, xsemilog=None, xnormalize=None, addcols=None, **kwargs):
¶
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 'outcma/cma'
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 len(x_opt) == dimension, the difference to
x_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
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 |