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.
Overview:
-
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)
wheren
is the requested number of samples, andd
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.
LogPDFBoundaries
(log_pdf, threshold=-inf)[source]¶ Uses a
pints.LogPDF
(e.g. aLogPrior
) as boundaries), accepting log-likelihoods above a given threshold as within bounds.For a
pints.LogPrior
based onpints.Boundaries
, seepints.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.
-
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.
- log_pdf – A
-
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