This model returns a value that doesn't change over time, and is mainly useful for testing purposes.
The returned value is constant in time, but varies linearly with the given parameters: It returns a vector where at each time point $\boldsymbol{f}(t) = (a_1, 2 a_2, 3 a_3, ... , k a_k)$ for the user-determined parameter vector $(a_1, a_2, a_3, ... , a_k)$.
For a single output, the model takes 1 parameter:
from __future__ import print_function
import pints
import pints.toy as toy
import numpy as np
import matplotlib.pyplot as plt
# Load a forward model
model = toy.ConstantModel(1)
# The number of parameters equals the number of outputs
print(model.n_parameters(), model.n_outputs())
# Create some toy data
real_parameters = [1]
times = np.linspace(0, 1000, 1000)
values = model.simulate([2], times)
# Plot
plt.plot(times, values, label = 'f(t) = 2')
plt.xlabel('Time')
plt.ylabel('Values')
plt.legend()
plt.show()
1 1
We can do the same with multiple outputs
# Load a forward model
model = toy.ConstantModel(3)
# The number of parameters equals the number of outputs
print(model.n_parameters(), model.n_outputs())
# Create some toy data
real_parameters = [1]
times = np.linspace(0, 1000, 1000)
values = model.simulate([2, -1, 4], times)
# Plot
plt.plot(times, values[:, 0], label = 'f_1(t) = 1 * 2')
plt.plot(times, values[:, 1], label = 'f_2(t) = 2 * -1')
plt.plot(times, values[:, 2], label = 'f_3(t) = 3 * 4')
plt.xlabel('Time')
plt.ylabel('Values')
plt.legend()
plt.show()
3 3