comocma.sofomore_logger.SofomoreDataLogger(interfaces.BaseDataLogger)
class documentationcomocma.sofomore_logger
(View In Hierarchy)
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.ff.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 cma.s.figshow()
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.
See Also | disp (), plot () |
Method | __init__ | initialize logging of data from a CMAEvolutionStrategy instance, default modulo=1 means logging with each call |
Method | register | register a Sofomore instance for logging, append=True appends to previous data logged under the same name, by default previous data are overwritten. |
Method | initialize | reset logger, overwrite original files, modulo : log only every modulo call |
Method | add | append some logging data from Sofomore class instance es , if number_of_times_called % modulo equals to zero, never if modulo==0. |
Method | load | Undocumented |
Method | plot | Undocumented |
Method | plot_front | Undocumented |
Method | plot_ratios | Undocumented |
Method | plot_divers | Undocumented |
Method | plot_stds | Undocumented |
Method | _enter_plotting | assumes that a figure is open |
Method | _finalize_plotting | Undocumented |
Method | _xlabel | Undocumented |
CMAEvolutionStrategy
instance, default modulo=1 means logging with each callSofomore
instance for logging,
append=True appends to previous data logged under the same name,
by default previous data are overwritten.modulo
: log only every modulo callappend some logging data from Sofomore
class instance es
,
if number_of_times_called % modulo equals to zero, never if modulo==0.
more_data is a list of additional data to be recorded where each data entry must 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.