Add Pints optimisation methods
Closed this issue · 1 comments
Feature description
This issue is to support adding Pints methods into PyBOP. Pints has multiple entry points for this, including the ForwardModel class, the Problem classes, and the OptimisationController with the underlying ask()
and tell()
API. We already have support for the ForwardModel definition via our BaseModel class, with an MLE example showing how PyBOP and Pints can interact.
Motivation
No response
Possible implementation
No response
Additional context
No response
My current thoughts on an API for this is as follows:
problem = pybop.SingleOutputProblem(model, parameters, signal, dataset)
cost = pybop.SumofErrors(problem)
optim = pybop.Optimisation(cost,x0,method,bounds=bounds)
results = optim.run()
This essentially splits the functionality of our current pybop.Optimisation()
class into more manageable classes with clearer divisions. This is similar to the pints classes, with a few differences around the Problem()
class. In this structure, the SumofErrors class would inherit a base cost function class.
The functionality is as follows:
- The
SingleOutputProblem
stores the optimisation parameters, runs the model viamodel.simulate()
, and returns the results with respect to the signal definition. - The
SumofErrors
class calls the problem class and evaluates the returned prediction and the ground truth from the dataset. - The
Optimisation
object wraps everything together and passes it to to selected optimiser. This class
Let me know if anyone has additional thoughts on this, or an alternative idea. Otherwise, I'm going to start implementing it and will open a PR for review once it's completed.