Toy base classes¶
- class pints.toy.ToyLogPDF[source]¶
Abstract base class for toy distributions.
Extends
pints.LogPDF.- __call__(x)¶
Evaluates this LogPDF for parameters
x.
- distance(samples)[source]¶
Calculates a measure of distance from
samplesto some characteristic of the underlying distribution.
- evaluateS1(x)¶
Evaluates this LogPDF, and returns the result plus the partial derivatives of the result with respect to the parameters.
The returned data is a tuple
(L, L')whereLis a scalar value andL'is a sequence of lengthn_parameters.Note that the derivative returned is of the log-pdf, so
L' = d/dp log(f(p)), evaluated atp=x.This is an optional method that is not always implemented.
- n_parameters()¶
Returns the dimension of the space this
LogPDFis defined over.
- class pints.toy.ToyModel[source]¶
Defines an interface for toy problems.
Note that toy models should extend both
ToyModeland one of the forward model classes, i.e.pints.ForwardModelorForwardModelS1.
- class pints.toy.ToyODEModel[source]¶
Defines an interface for toy problems where the underlying model is an ordinary differential equation (ODE) that describes some time-series generating model.
Note that toy ODE models should extend both
pints.toy.ToyODEModeland one of the forward model classes, e.g.pints.ForwardModelorpints.ForwardModelS1.To use this class as the basis for a
pints.ForwardModel, the method_rhs()should be reimplemented.Models implementing
_rhs(),jacobian()and_dfdp()can be used to create apints.ForwardModelS1.Extends:
pints.toy.ToyODEModel.- _dfdp(y, t, p)[source]¶
Returns the derivative of the ODE RHS at time
t, with respect to model parametersp.- Parameters:
y – The state vector at time
t(with lengthn_outputs).t – The time to evaluate at (as a scalar).
p – A vector of model parameters (of length
n_parameters).
- Return type:
A matrix of dimensions
n_outputsbyn_parameters.
- _rhs(y, t, p)[source]¶
Returns the evaluated RHS (
dy/dt) for a given state vectory, timet, and parameter vectorp.- Parameters:
y – The state vector at time
t(with lengthn_outputs).t – The time to evaluate at (as a scalar).
p – A vector of model parameters (of length
n_parameters).
- Return type:
A vector of length
n_outputs.
- jacobian(y, t, p)[source]¶
Returns the Jacobian (the derivative of the RHS ODE with respect to the outputs) at time
t.- Parameters:
y – The state vector at time
t(with lengthn_outputs).t – The time to evaluate at (as a scalar).
p – A vector of model parameters (of length
n_parameters).
- Return type:
A matrix of dimensions
n_outputsbyn_outputs.
- n_states()[source]¶
Returns number of states in underlying ODE. Note: will not be same as
n_outputs()for models where only a subset of states are observed.
- suggested_parameters()¶
Returns an NumPy array of the parameter values that are representative of the model.
For example, these parameters might reproduce a particular result that the model is famous for.
- suggested_times()¶
Returns an NumPy array of time points that is representative of the model