Feature description
At the moment, the private cost evaluate methods (cost._evaluate/evaluateS1) complete their computation via side-effects i.e. inputs is passed, but not used, with self.y & self.dy being the objects to operate on:
|
def _evaluate(self, inputs: Inputs): |
This issue is to update these methods as follows:
- Rename to
cost.compute and cost.computeS1
- Change the method args to be an object of signals that the cost is calculated on
- Add object checks to the precomputed signal values
Motivation
Opens up an additional API for users to compute a cost directly without triggering and problem.evaluate creating an advanced workflow that can be used for custom cost methods. An example is shown below, although the logic is meaningless.
for i in range(10):
eval = problem.evaluate([val1, val2])
for i in range(100):
eval += np.random.normal(0, sigma, len(t_eval))
cost.compute(eval)
Possible implementation
The MAP method may need a large refactor.
Additional context
Initial discussion on #435
Feature description
At the moment, the private cost evaluate methods (cost._evaluate/evaluateS1) complete their computation via side-effects i.e.
inputsis passed, but not used, withself.y&self.dybeing the objects to operate on:PyBOP/pybop/costs/fitting_costs.py
Line 109 in 8b09214
This issue is to update these methods as follows:
cost.computeandcost.computeS1Motivation
Opens up an additional API for users to compute a cost directly without triggering and
problem.evaluatecreating an advanced workflow that can be used for custom cost methods. An example is shown below, although the logic is meaningless.Possible implementation
The MAP method may need a large refactor.
Additional context
Initial discussion on #435