Boundaries

Simple boundaries for an optimisation can be created using RectangularBoundaries. More complex types can be made using LogPDFBoundaries or a custom implementation of the Boundaries interface.

class pints.Boundaries[source]

Abstract class representing boundaries on a parameter space.

check(parameters)[source]

Returns True if and only if the given point in parameter space is within the boundaries.

Parameters:

parameters – A point in parameter space

n_parameters()[source]

Returns the dimension of the parameter space these boundaries are defined on.

sample(n=1)[source]

Returns n random samples from within the boundaries, for example to use as starting points for an optimisation.

The returned value is a NumPy array with shape (n, d) where n is the requested number of samples, and d is the dimension of the parameter space these boundaries are defined on.

Note that implementing :meth:`sample()` is optional, so some boundary types may not support it.

Parameters:

n (int) – The number of points to sample

class pints.ComposedBoundaries(*boundaries)[source]

Boundaries composed of one or more other Boundaries.

The resulting N-dimensional Boundaries is composed of one or more Boundaries of dimensions N[i] <= N such that the sum of all N[i] equals N.

The dimensionality of the individual boundaries objects does not have to be the same.

The input parameters of the ComposedBoundaries have to be ordered in the same way as the individual boundaries.

Extends Boundaries.

check(x)[source]

See pints.Boundaries.check().

n_parameters()[source]

See pints.Boundaries.n_parameters().

sample(n=1)[source]

See pints.Boundaries.sample().

class pints.LogPDFBoundaries(log_pdf, threshold=-inf)[source]

Uses a pints.LogPDF (e.g. a LogPrior) as boundaries), accepting log-pdfs above a given threshold as within bounds.

For a pints.LogPrior based on pints.Boundaries, see pints.UniformLogPrior.

Extends pints.Boundaries.

Parameters:
  • log_pdf – A pints.LogPdf to use.

  • threshold – A threshold to determine whether a given log-prior value counts as within bounds. Anything _above_ the threshold counts as within bounds.

check(parameters)[source]

See pints.Boundaries.check().

n_parameters()[source]

See pints.Boundaries.n_parameters().

sample(n=1)[source]

See pints.Boundaries.sample().

Note: This method is implemented only when the error measure is based on a pints.LogPrior that supports sampling.

class pints.RectangularBoundaries(lower, upper)[source]

Represents a set of lower and upper boundaries for model parameters.

A point x is considered within the boundaries if (and only if) lower <= x < upper.

Extends pints.Boundaries.

Parameters:
  • lower – A 1d array of lower boundaries.

  • upper – The corresponding upper boundaries

check(parameters)[source]

See pints.Boundaries.check().

lower()[source]

Returns the lower boundaries for all parameters (as a read-only NumPy array).

n_parameters()[source]

See pints.Boundaries.n_parameters().

range()[source]

Returns the size of the parameter space (i.e. upper - lower).

sample(n=1)[source]

See pints.Boundaries.sample().

upper()[source]

Returns the upper boundary for all parameters (as a read-only NumPy array).