Constant Model¶
- class pints.toy.ConstantModel(n, force_multi_output=False)[source]¶
Toy model that’s constant over time, linear over the parameters, mostly useful for unit testing.
For an n-dimensional model, evaluated with parameters
p = [p_1, p_2, ..., p_n]
, the simulated values are time-invariant, so that for any timet
\[f(t) = (p_1, 2 p_2, 3 p_3, ..., n p_n)\]The derivatives with respect to the parameters are time-invariant, and simply equal
\[\begin{split}\frac{\partial{f_i(t)}}{dp_j} = \begin{cases} i, i = j\\0, i \neq j \end{cases}\end{split}\]Extends
pints.ForwardModelS1
.- Parameters:
n (int) – The number of parameters (and outputs) the model should have.
force_multi_output (boolean) – Set to
True
to always return output of the shape(n_times, n_outputs)
, even ifn_outputs == 1
.
Example
times = np.linspace(0, 1, 100) m = pints.ConstantModel(2) m.simulate([1, 2], times)
In this example, the returned output is
[1, 4]
at every point in time.