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
Trueif 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
nrandom 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)wherenis the requested number of samples, anddis 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
Boundariesis composed of one or moreBoundariesof dimensionsN[i] <= Nsuch that the sum of allN[i]equalsN.The dimensionality of the individual boundaries objects does not have to be the same.
The input parameters of the
ComposedBoundarieshave to be ordered in the same way as the individual boundaries.Extends
Boundaries.
- class pints.LogPDFBoundaries(log_pdf, threshold=-inf)[source]¶
Uses a
pints.LogPDF(e.g. aLogPrior) as boundaries), accepting log-pdfs above a given threshold as within bounds.For a
pints.LogPriorbased onpints.Boundaries, seepints.UniformLogPrior.Extends
pints.Boundaries.- Parameters:
log_pdf – A
pints.LogPdfto use.threshold – A threshold to determine whether a given log-prior value counts as within bounds. Anything _above_ the threshold counts as within bounds.
- sample(n=1)[source]¶
See
pints.Boundaries.sample().Note: This method is implemented only when the error measure is based on a
pints.LogPriorthat supports sampling.
- class pints.RectangularBoundaries(lower, upper)[source]¶
Represents a set of lower and upper boundaries for model parameters.
A point
xis 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