module documentation

VD-CMA and VkD-CMA

Usage examples, VD-CMA:

>>> import cma
>>> from cma import restricted_gaussian_sampler as rgs
>>> es = cma.CMAEvolutionStrategy(20 * [1], 1,
...          rgs.GaussVDSampler.extend_cma_options({
...             'seed': 6,
...             'ftarget': 1e-8,
...             'verbose': -9,  # helpful for automatic testing
...     }))
>>> es = es.optimize(cma.fitness_transformations.Rotated(cma.ff.cigar, seed=6), iterations=None)
>>> assert es.result.fbest <= 1e-8
>>> assert es.result.evaluations <= 6480, es.result.evaluations  # was: == 6372 6480 6144

It is recommended to always use extend_cma_options() to set the options appropriately, even when no other options are passed through.

>>> len(rgs.GaussVDSampler.extend_cma_options())
2
>>> len(rgs.GaussVkDSampler.extend_cma_options())
3

The use case for VkD-CMA looks identical:

>>> es = cma.CMAEvolutionStrategy(20 * [1], 1,
...          rgs.GaussVkDSampler.extend_cma_options({
...             'seed': 7,
...             'ftarget': 1e-8,
...             'verbose': -9,  # helpful for automatic testing
...     }))
>>> es = es.optimize(cma.fitness_transformations.Rotated(cma.ff.cigar, seed=3), iterations=None)
>>> assert es.result.fbest <= 1e-8
>>> assert es.result.evaluations < 6210, es.result.evaluations  # was == 6204

TODO: correct the interface of __init__, remove unnecessaries

TODO: 2017/05/10: pass the option to sampler 2017/05/10: how to give sigma to update?

MEMO: 2017/05/08: line 2958 of evolution_strategy.py: cc is assigned from sp.cc 2017/05/08: line 3021 of evolution_strategy.py: weights are multiplied by c1 and cmu 2017/05/08: line 3021 of evolution_strategy.py: first element of vectors is pc 2017/05/07: hsig interface 2017/05/07: CMAAdaptSigmaNone not working 2017/05/07: dimension passed to __init__ in not int. 2017/05/06: 'AdaptSigma = CMAAdaptSigmaTPA' won't work. AssertionError happens in _update_ps. 2017/05/06: correlation_matrix is not declared in StatisticalModelSamplerWithZeroMeanBaseClass. However, it is used in evolution_strategy.py. 2017/05/06: the following line of code in ask_geno assumes that the result of sample is an ndarray, rather than list. ary = self.sigma_vec * self.sm.sample(Niid)/

Class ExponentialMovingAverage Exponential Moving Average, Variance, and SNR (Signal-to-Noise Ratio)
Class GaussVDSampler Restricted Gaussian Sampler for VD-CMA VD-CMA: Linear Time/Space Comparison-based Natural Gradient Optimization The covariance matrix is limited as C = D * (I + v*v^t) * D, where D is a diagonal, v is a vector.
Class GaussVkDSampler Restricted Gaussian Sampler for VkD-CMA O(N*k^2 + k^3) Time/Space Variant of CMA-ES with C = D * (I + V * V^T) * D