Home | Trees | Indices | Help |
|
---|
|
object --+ | BaseDataLogger --+ | CMADataLogger
data logger for class CMAEvolutionStrategy. The logger is identified by its name prefix and (over-)writes or reads according data files. Therefore, the logger must be considered as global variable with unpredictable side effects, if two loggers with the same name and on the same working folder are used at the same time.
import cma es = cma.CMAEvolutionStrategy(...) logger = cma.CMADataLogger().register(es) while not es.stop(): ... logger.add() # add can also take an argument logger.plot() # or a short cut can be used: cma.plot() # plot data from logger with default name logger2 = cma.CMADataLogger('just_another_filename_prefix').load() logger2.plot() logger2.disp()
import cma from matplotlib.pylab import * res = cma.fmin(cma.Fcts.sphere, rand(10), 1e-0) logger = res[-1] # the CMADataLogger logger.load() # by "default" data are on disk semilogy(logger.f[:,0], logger.f[:,5]) # plot f versus iteration, see file header show()
After loading data, the logger has the attributes xmean
, xrecent
,
std
, f
, D
and corrspec
corresponding to xmean,
xrecentbest, stddev, fit, axlen and axlencorr
filename trails.
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
|
|||
Inherited from |
|
|||
default_prefix =
|
|
|||
file_names used in load, however hard-coded in add |
|||
key_names used in load, however hard-coded in plot |
|||
_key_names_with_annotation used in load to add one data row to be modified in plot |
|||
modulo how often to record data, allows calling add without args |
|||
append append to previous data |
|||
counter number of calls to add |
|
|||
Inherited from |
|
|
return dictionary with data. If data entries are None or incomplete, consider calling .load().data() to (re-)load the data from files first.
|
|
load (or reload) data from output files, load() is called in plot() and disp(). Argument Return self with (added) attributes |
append some logging data from CMAEvolutionStrategy class instance The sequence more_data must always have the same length. When used for a different optimizer class, this function can be (easily?) adapted by changing the assignments under INTERFACE in the implemention.
|
plot data from a CMADataLogger (using the files written by the logger). Arguments
Return CMADataLogger itself. Examplesimport cma logger = cma.CMADataLogger() # with default name # try to plot the "default logging" data (e.g. # from previous fmin calls, which is essentially what # also cma.plot() does) logger.plot() cma.savefig('fig325.png') # save current figure logger.closefig() Dependencies: matlabplotlib/pyplot.
|
plot data from a CMADataLogger (using the files written by the logger). Arguments
Return CMADataLogger itself. Examplesimport cma logger = cma.CMADataLogger() # with default name # try to plot the "default logging" data (e.g. # from previous fmin calls, which is essentially what # also cma.plot() does) logger.plot_all() cma.savefig('fig425.png') # save current figure logger.closefig() Dependencies: matlabplotlib/pyplot. |
See Also: plot() |
rude downsampling of a CMADataLogger data file by Arguments
Detailsself.name_prefix+'down' files are written Exampleimport cma cma.downsampling() # takes outcmaes* files cma.plot('outcmaesdown') |
displays selected data from (files written by) the class CMADataLogger. Arguments
Example>>> import cma, numpy as np >>> res = cma.fmin(cma.fcts.elli, 7 * [0.1], 1, {'verb_disp':1e9}) # generate data >>> assert res[1] < 1e-9 >>> assert res[2] < 4400 >>> l = cma.CMADataLogger() # == res[-1], logger with default name, "points to" above data >>> l.disp([0,-1]) # first and last >>> l.disp(20) # some first/last and every 20-th line >>> l.disp(np.r_[0:999999:100, -1]) # every 100-th and last >>> l.disp(np.r_[0, -10:0]) # first and ten last >>> cma.disp(l.name_prefix, np.r_[0::100, -10:]) # the same as l.disp(...) DetailsThe data line with the best f-value is displayed as last line.
See Also: disp() |
Home | Trees | Indices | Help |
|
---|
Generated by Epydoc 3.0.1 on Tue Mar 3 01:17:17 2015 | http://epydoc.sourceforge.net |