class documentation

class DiagonalDecoding(AdaptiveDecoding):

View In Hierarchy

Diagonal linear transformation with exponential update.

Supports self * a, a * self, a / self, self *= a, as if self is an np.array. Problem: np.array does broadcasting.

>>> import cma
>>> from cma.transformations import DiagonalDecoding as DD

References: N. Hansen (2008). Adaptive Encoding: How to render search coordinate system invariant. In PPSN Parallel Problem Solving from Nature X, pp. 205-214.

Method __array__ sigma * self tries to call self.__array__() if isinstance(sigma, np.float64).
Method __imul__ define self *= factor.
Method __init__ len(scaling) determines the dimension.
Method __mul__ multiplication with array or scalar
Method __pow__ Undocumented
Method __rdiv__ Undocumented
Method __rmul__ x * self works (only) if x is a scalar
Method __rtruediv__ Undocumented
Method equals return True if the diagonal equals to x
Method parameters learning rate parameter suggestions.
Method set_i set scaling[index] = value.
Method tolist Undocumented
Method transform apply the transformation / decoding AKA geno-pheno tf
Method transform_covariance_matrix return the covariance matrix D * C * D
Method transform_inverse inverse transformation (encoding), might return None
Method update exponential update of the scaling factors.
Instance Variable dim Undocumented
Instance Variable is_identity Undocumented
Instance Variable scaling Undocumented
Property condition_number return condition number of the squared transformation matrix
Property correlation_matrix return correlation matrix or None
Method _init_ init scaling (only) when not yet done
Instance Variable _parameters Undocumented

Inherited from AdaptiveDecoding:

Method norm return norm of x prior to the transformation
Method update_now update model here, if lazy update is implemented
def __array__(self):

sigma * self tries to call self.__array__() if isinstance(sigma, np.float64).

def __imul__(self, factor):

define self *= factor.

As a shortcut for:

self = self.__imul__(factor)
def __init__(self, scaling):

len(scaling) determines the dimension.

The initial transformation is (typically) np.diag(scaling).

def __mul__(self, x):

multiplication with array or scalar

def __pow__(self, power):

Undocumented

def __rdiv__(self, x):

Undocumented

def __rmul__(self, x):

x * self works (only) if x is a scalar

def __rtruediv__(self, x):

Undocumented

def equals(self, x):

return True if the diagonal equals to x

def parameters(self, mueff, c1_factor=1, cmu_factor=1):

learning rate parameter suggestions.

TODO: either input popsize or input something like fac = 1 + (2...5) / popsize
cmu has already 1/7 as popsize correction
def set_i(self, index, value):

set scaling[index] = value.

To guaranty initialization to non-identity, the use pattern:

de = cma.transformations.DiagonalDecoding()
de._init_(dimension).set_i(3, 4.4)

is available.

def tolist(self):

Undocumented

def transform(self, x):

apply the transformation / decoding AKA geno-pheno tf

def transform_covariance_matrix(self, C):

return the covariance matrix D * C * D

def transform_inverse(self, x):

inverse transformation (encoding), might return None

def update(self, vectors, weights, ignore_indices=None):

exponential update of the scaling factors.

vectors have shape popsize x dimension and are assumed to be standard normal before selection.

weights may be negative and include the learning rate(s).

Variables listed in ignore_indices are not updated.

dim =

Undocumented

is_identity: bool =

Undocumented

scaling =

Undocumented

@property
condition_number =

return condition number of the squared transformation matrix

@property
correlation_matrix =

return correlation matrix or None

def _init_(self, int_or_vector):

init scaling (only) when not yet done

_parameters: dict =

Undocumented