Skip to content

ensemble_generalized⚓︎

Non-Gaussian control perturbations (beta, logistic, truncated-Gaussian marginals) with mutation-based gradient estimates.

Beta ⚓︎

Beta marginal on [0, 1] with parameters (a, b) per control.

grad_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to x.

hess_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to x.

pdf(x, theta, **kwargs) ⚓︎

Density of the marginal at x.

ppf(u, theta, **kwargs) ⚓︎

Quantile function of the marginal at u.

BetaMC ⚓︎

Beta marginal parametrised by mode and concentration, on [lb, ub]; the mode is the current control.

grad_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to x.

grad_theta_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to theta.

hess_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to x.

hess_theta_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to theta.

pdf(x, theta, **kwargs) ⚓︎

Density of the marginal at x.

ppf(u, theta, **kwargs) ⚓︎

Quantile function of the marginal at u.

Gaussian ⚓︎

Gaussian marginal centred on the current control, with standard deviation theta.

grad_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to x.

hess_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to x.

pdf(x, theta, **kwargs) ⚓︎

Density of the marginal at x.

ppf(u, theta, **kwargs) ⚓︎

Quantile function of the marginal at u.

GeneralizedEnsemble ⚓︎

Bases: EnsembleOptimizationBase

Control perturbations with a non-Gaussian marginal (beta, logistic, truncated Gaussian, or Gaussian) coupled by a Gaussian copula, and the mutation-based gradient and Hessian estimates that go with them.

Perturbations are drawn as correlated standard normals enZ mapped through the marginal's quantile function; the gradient of the expected objective follows from the score of the sampling density (gradient/hessian), and its derivative with respect to the marginal's own parameter theta (mutation_gradient/mutation_hessian) lets the distribution itself be adapted.

__init__(options, simulator, objective) ⚓︎

Parameters:

Name Type Description Default
options dict

Options for the ensemble class

required
simulator callable

The forward simulator (e.g. flow). If None, no simulation is performed.

required
objective callable

The objective function (e.g. npv)

required

get_corr() ⚓︎

The correlation matrix of the Gaussian copula.

get_theta() ⚓︎

The marginal's parameters, one row per control.

gradient(x, *args, **kwargs) ⚓︎

Estimate the gradient of the expected objective at x from the sampled members (enX, enZ, enF may be passed in; else sampled and evaluated). Also sets avg_hess.

hessian(x, *args, **kwargs) ⚓︎

The Hessian estimate from the last gradient call (recomputed when sample=True).

mutation_gradient(x, *args, **kwargs) ⚓︎

Gradient of the expected objective with respect to the marginal's parameter theta, for adapting the distribution. Also sets nat_hess.

With return_ensembles=True it returns (nat_grad, {'gaussian': enZ, 'objective': enF}) instead, so a caller adapting the correlation matrix -- :class:~popt.optimization_methods.subroutines.cma.CMA -- can reuse the ensemble this gradient came from rather than drawing and simulating another.

mutation_hessian(x, *args, **kwargs) ⚓︎

The theta Hessian estimate from the last mutation_gradient call (recomputed when sample=True).

sample(size=None) ⚓︎

Draw size perturbed controls: correlated normals enZ through the marginal's quantile function, clipped to the bounds. Returns (enX, enZ).

var2eps() ⚓︎

Half-width of the beta perturbation interval that reproduces the control variance.

Logistic ⚓︎

Logistic marginal centred on the current control, with scale theta.

grad_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to x.

hess_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to x.

pdf(x, theta, **kwargs) ⚓︎

Density of the marginal at x.

ppf(u, theta, **kwargs) ⚓︎

Quantile function of the marginal at u.

var_to_scale(var) ⚓︎

The logistic scale giving variance var.

TruncGaussian ⚓︎

Gaussian marginal truncated to [lb, ub], centred on the current control, with standard deviation theta.

grad_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to x.

grad_theta_log_pdf(x, theta, **kwargs) ⚓︎

Derivative of the log density with respect to theta.

hess_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to x.

hess_theta_log_pdf(x, theta, **kwargs) ⚓︎

Second derivative of the log density with respect to theta.

pdf(x, theta, **kwargs) ⚓︎

Density of the marginal at x.

ppf(u, theta, **kwargs) ⚓︎

Quantile function of the marginal at u.

epsilon_trafo(x, enX, eps, lower=None, upper=None) ⚓︎

Map unit-interval beta samples enX to an interval of half-width eps around x, shifted to stay within the bounds.

kappa(m, c) ⚓︎

Kappa(theta) of the beta marginal: the log-partition term of its natural-parameter form.

var_to_concentration(mode, var, lb=0, ub=1) ⚓︎

The beta concentration giving variance var at mode on [lb, ub] (variance capped below 1/12).