Problem Description#

hopsy ships with a number of simple models, also known as target functions. Together with the polytope

\[\mathcal{P} := \{ x : Ax \leq b \}\]

the model forms a hopsy.Problem.

The simple models provided are

  • hopsy.Gaussian: A multivariate Gaussian which can also have invariant dimensions, meaning it ignores some dimensions of the input vector. This is interesting for simulating non-identifiabilities.

  • hopsy.Mixture: A mixture model, which is a weighted linear combination of arbitrary model components.

  • hopsy.Rosenbrock: Rosenbrock’s banana function, a popular test function for computational optimization.

In order to implement custom models, the hopsy.PyModel class is provided, which interfaces Python-implemented models with the hops-C++-API. The custom model has to at least implement the hopsy.PyModel.compute_negative_log_likelihood() method, which should return the negative log-likelihood of the target distribution. Depending on the algorithm you aim to use, it might also be necessary to further implement

  • hopsy.PyModel.compute_log_likelihood_gradient()

  • hopsy.PyModel.compute_expected_fisher_information()

For more details on signature and return type, please refer to hopsy.PyModel or

Problem#

The hopsy.Problem classes contain the full description of the problem, we aim to sample. A problem consists mainly of the domain, that is the inequality \(Ax \leq b\), and the target distribution, the hopsy.Model object.

Linear Transformations#

Often, it is desirable to apply linear transformations on the polytope to precondition the problem. However, the states and the space of interest, may be the untransformed space. For polytopes, the most common transformation is a “rounding” transformation. Thus, it is possible to set unrounding transformations and shifts for the problem, such the produced states lie in the correct space. This assumes, that the transformation was already applied to the \(A\) and \(b\) matrix, which are passed to the model. In order to compute rounding transformations, we recommend to use the PolyRound[1] toolbox. For more details about rounding, please refer to xyz.

Reference#

Models#

hopsy.Model

Base model class.

hopsy.Gaussian(self[, mean, covariance, ...])

Gaussian model which can be invariant in some dimensions of the input vector.

hopsy.Mixture(self, components[, weights])

The Mixture is a weighted sum of \(n\) components, so its unnormalized density is given as

hopsy.Rosenbrock

A multi-dimensional Rosenbrock function in \(2n\) dimensions.

Problem#

hopsy.Problem

hopsy.add_box_constraints(problem, ...[, ...])

Adds box constraints to all dimensions.

hopsy.compute_chebyshev_center(problem[, ...])

Computes the Chebyshev center, that is the midpoint of a (non-unique) largest inscribed ball in the polytope defined by \(Ax \leq b\).

hopsy.round(problem[, simplify])

Rounds the polytope defined by the inequality \(Ax \leq b\) using PolyRound.