Reference#

Helpers#

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.generate_unit_hypercube(dimension)

Generate matrix A and vector b of the unit N-dimensional hypercube.

hopsy.generate_unit_simplex(dimension)

Generate matrix A and vector b of the unit N-dimensional simplex.

hopsy.is_polytope_empty(A, b[, S, h])

Checks whether the polytope given by Ax < b and optionally Sx=h has a solution x.

hopsy.run_multiphase_sampling(problem, ...)

runs multiphase sampling as suggested in https://drops.dagstuhl.de/opus/volltexte/2021/13820/pdf/LIPIcs-SoCG-2021-21.pdf limit_singular_value_ratio=2.3

hopsy.simplify(problem)

Simplifies the polytope defined in the problem by removing redundant constraints and refunction inequality constraints to equality constraints in case of dimension width less than thresh.

hopsy.BirkhoffPolytope(size)

Birkhoff polytope helper that manages transformation of states and constraints

hopsy.LP(*args, **kwargs)

Singleton for controlling PolyRound parameters for Linear Programming.

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.round(problem[, simplify])

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

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

Adds box constraints to all dimensions.

hopsy.add_equality_constraints(problem, ...)

Adds equality constraints as specified.

hopsy.back_transform(problem, points)

Transforms samples back from the sampling space (typically rounded) to the original parameter space.

hopsy.transform(problem, points)

Transforms samples from the parameter space to the sampling space (typically rounded).

Proposals#

Random#

Sampling#

hopsy.MarkovChain(problem[, proposal, ...])

Given a hopsy.Problem a MarkovChain object can be constructed.

hopsy.setup(problem, random_seed[, ...])

hopsy.sample(markov_chains, rngs, n_samples)

Draw n_samples from every passed chain in markov_chains using the respective random number generator from rngs.

Diagnostics#

hopsy.ess(data[, series, method, relative, ...])

Calculate estimate of the effective sample size (ess).

hopsy.mcse(data[, series, method, prob, ...])

Calculate Markov Chain Standard Error statistic.

hopsy.rhat(data[, series, method, dask_kwargs])

Compute estimate of rank normalized splitR-hat for a set of traces.

Tuning#

hopsy.tune(mcs, rngs, target, n_tuning[, k, ...])

Thompson Sampling-based tuning method for specifying meaningful hyperparameters for Markov chain proposal distributions.