class documentation
class GaussSampler(StatisticalModelSamplerWithZeroMeanBaseClass):
Known subclasses: cma.sampler.GaussDiagonalSampler, cma.sampler.GaussFullSampler, cma.sampler.GaussStandardConstant
Constructor: GaussSampler()
Undocumented
| Method | __init__ |
declarative init, doesn't need to be executed |
| Method | set_ |
set Hessian w.r.t. which to compute the eigen spectrum. |
| Method | set_ |
set Hessian from f at x0. |
| Instance Variable | dimension |
Undocumented |
| Property | chin |
approximation of the expected length when isotropic with variance 1. |
| Property | corr |
condition number of the correlation matrix |
| Property | eigenspectrum |
return eigen spectrum w.r.t. H like sqrt(H) C sqrt(H) |
| Instance Variable | _left |
Undocumented |
| Instance Variable | _right |
Undocumented |
Inherited from StatisticalModelSamplerWithZeroMeanBaseClass:
| Method | __imul__ |
Undocumented |
| Method | inverse |
return scalar correction alpha such that X and f fit to f(x) = (x-mean) (alpha * C)**-1 (x-mean) |
| Method | norm |
return Mahalanobis norm of x w.r.t. the statistical model |
| Method | parameters |
return dict with (default) parameters, e.g., c1 and cmu. |
| Method | sample |
return list of i.i.d. samples. |
| Method | to |
return associated linear transformation |
| Method | to |
return inverse of associated linear transformation |
| Method | transform |
transform x as implied from the distribution parameters |
| Method | transform |
Undocumented |
| Method | update |
vectors is a list of samples, weights a corrsponding list of learning rates |
| Property | condition |
Undocumented |
| Property | covariance |
Undocumented |
| Property | variances |
vector of coordinate-wise (marginal) variances |
| Instance Variable | _lam |
Undocumented |
| Instance Variable | _mueff |
Undocumented |
| Instance Variable | _parameters |
Undocumented |
overridden in
cma.sampler.GaussDiagonalSampler, cma.sampler.GaussFullSampler, cma.sampler.GaussStandardConstantdeclarative init, doesn't need to be executed
set Hessian from f at x0.
>>> import numpy as np, cma >>> es = cma.CMAEvolutionStrategy(3 * [1], 1, {'verbose':-9}) >>> es.sm.set_H_by_f(cma.ff.elli, 3 * [0]) # Hessian of cma.ff.elli
Now the eigen spectrum of H^1/2 C H^1/2 where H is the Hessian of cma.ff.elli
is given by the spectrum property.
overridden in
cma.sampler.GaussDiagonalSampler, cma.sampler.GaussFullSampler, cma.sampler.GaussStandardConstantUndocumented
approximation of the expected length when isotropic with variance 1.
The exact value could be computed by:
from scipy.special import gamma return 2**0.5 * gamma((self.dimension+1) / 2) / gamma(self.dimension / 2)
The approximation obeys chin < chin_hat < (1 + 5e-5) * chin.