pybop.costs.weighted_cost#

Classes#

WeightedCost

A subclass for constructing a linear combination of cost functions as

Module Contents#

class pybop.costs.weighted_cost.WeightedCost(*costs, weights: list[float] | None = None)[source]#

Bases: pybop.costs.base_cost.BaseCost

A subclass for constructing a linear combination of cost functions as a single weighted cost function.

Parameters:
  • costs (pybop.BaseCost) – The individual PyBOP cost objects.

  • weights (list[float]) – A list of values with which to weight the cost values.

evaluate_batch(solution: list[pybop.simulators.solution.Solution], inputs: list[pybop.parameters.parameter.Inputs], calculate_sensitivities: bool = False) pybop.costs.evaluation.Evaluation[source]#

Computes the cost function for the given predictions.

Parameters:
  • solution (list[Solution]) – A list of simulation results.

  • inputs (list[Inputs]) – The corresponding list of input parameters.

  • calculate_sensitivities (bool) – Whether to also return the sensitivities (default: False).

set_target(target: list[list[str]] | list[str] | str | None = None, dataset: pybop.processing.dataset.Dataset | None = None)[source]#

Set the target variable for all costs. Expecting a list of list[str] the same length as self.costs.

_domain#
costs#
property target#