cbx.dynamics.PolarCBO#

class cbx.dynamics.PolarCBO(f, kernel='Gaussian', kappa=1.0, kernel_factor_mode='alpha', compute_consensus=None, **kwargs)[source]#

Bases: CBO

This class implements the PolarCBO algorithm as proposed in [1].

Parameters:
  • f (objective) – The objective function \(f\) of the system.

  • kernel (optional) –

    The kernel function \(k(\cdot, \cdot)\) that is used to compute the particle dependent consensus \(c(x_i)\). You can choose from the following options:
    • ’Gaussian’: The Gaussian kernel \(k(x_i, x_j) = e^{-\frac{1}{2\kappa^2} ||x_i - x_j||^2}\).

    • ’Laplace’: The Laplace kernel \(k(x_i, x_j) = e^{-\frac{1}{\kappa} ||x_i - x_j||}\)

    • ’Constant’: The constant kernel \(k(x_i, x_j) = \begin{cases} 1, & ||x_i - x_j|| \leq \kappa \\ \infty, & \text{else} \end{cases}\) .

    • ’InverseQuadratic’: The inverse quadratic kernel \(k(x_i, x_j) = \frac{1}{1 + \kappa^{-1} \cdot ||x_i - x_j||^2}\)

    • ’Taz’: The Taz kernel

    You can also specify a custom class implementing a neg_log function, i.e., the negative logarithm of the kernel.

  • kappa (float, optional) – The kernel parameter \(\kappa\).

  • kernel_factor_mode (str, optional) – Decides how to scale the kernel, additionally to the factor \(\kappa\). - ‘alpha’: the kernel is addittionally multiplied by \(\kappa\). Default. - ‘const’: the kernel is not scaled addtionally.

References

set_kernel(kernel)[source]#

Sets the kernel for the model.

Parameters:

object) (kernel (str or) – If a string, it must be a key in the kernel_dict attribute of the class. If an object, it will be directly assigned as the kernel.

Return type:

None

Raises:

ValueError – If the provided kernel name is not found in the kernel_dict attribute.:

compute_consensus()[source]#

Updates the weighted mean of the particles.

Parameters:

None

Return type:

None

update_covariance()[source]#

Update the covariance matrix \(\mathsf{C}(x_i)\) of the noise model

Parameters:

None

Return type:

None.