dist⚓︎
Descriptive description.
GenOptDistribution
⚓︎
Class that contains all the operations on the mutation distribution of GenOpt
__init__(x, cov, theta0=[20.0, 20.0], func=None, ne=None)
⚓︎
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
(array_like, shape(d))
|
Initial control vector. Used initally to get the dimensionality of the problem. |
required |
cov
|
(array_like, shape(d, d))
|
Initial covaraince matrix. Used to construct the correlation matrix and epsilon parameter of GenOpt |
required |
theta0
|
list, of length 2 ([alpha, beta])
|
Initial alpha and beta parameter of the marginal Beta distributions. |
[20.0, 20.0]
|
func
|
callable(optional)
|
An objective function that can be used later for the gradeint. Can also be passed directly to the gradeint fucntion. |
None
|
ne
|
int
|
|
None
|
corr_gradient()
⚓︎
Returns the mutation gradeint of the correlation matrix
epsilon_transformation(x, enX)
⚓︎
Performs the epsilon transformation, X ∈ [0, 1] ---> Y ∈ [x-ε, x+ε]
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
(array_like, shape(d))
|
Current state vector. |
required |
enX
|
(array_like, shape(ne, d))
|
Ensemble matrix X sampled from GenOpt distribution |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
(array_like, shape(ne, d))
|
Epsilon transfromed ensemble matrix, Y |
fisher_matrix(alpha, beta)
⚓︎
gradient(x, *args, **kwargs)
⚓︎
Calcualtes the average gradient of func using Stein's Lemma. Described in GenOpt paper.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
x
|
(array_like, shape(d))
|
Current state vector. |
required |
args
|
(theta, corr)
|
theta (parameters of distribution), shape (d,2) corr (correlation matrix), shape (d,d) |
()
|
kwargs
|
func : callable objectvie function ne : ensemble size |
{}
|
Returns:
Name | Type | Description |
---|---|---|
out |
(array_like, shape(d))
|
The average gradient. |
mutation_gradient(x=None, *args, **kwargs)
⚓︎
Returns the mutation gradient of theta. It is actually calulated in self.ensemble_gradient.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
kwargs
|
return_ensemble : bool If True, all the ensemble matrices are also returned in a dictionary. |
{}
|
Returns:
Name | Type | Description |
---|---|---|
out |
(array_like, shape(d, 2))
|
Mutation gradeint of theta |
NB! If return_ensembles=True, the ensmebles are also returned!
|
|
sample(size)
⚓︎
Samples the mutation distribution as described in the GenOpt paper (NOT PUBLISHED YET!)
Parameters:
Name | Type | Description | Default |
---|---|---|---|
size
|
int
|
Ensemble size (ne). Size of the sample to be drawn. |
required |
Returns:
Name | Type | Description |
---|---|---|
out |
(tuple, (enZ, enX))
|
enZ : array_like, shape (ne,d) Zero-mean Gaussain ensemble, drawn with the correlation matrix, corr enX : array_like, shape (ne,d) The drawn ensemble matrix, X ~ p(x|θ,R) (GenOpt pdf) |
update_distribution(theta, corr)
⚓︎
Updates the parameters (theta and corr) of the distirbution.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
theta
|
(array_like, shape(d, 2))
|
Contains the alpha (first column) and beta (second column) of the marginal distirbutions. |
required |
corr
|
(array_like, shape(d, d))
|
Correlation matrix |
required |