pybop._evaluation#

Classes#

BaseEvaluator

Evaluates a function (or callable object) for multiple positions.

PopulationEvaluator

Evaluates a function (or callable object) for multiple positions.

ScalarEvaluator

Evaluates a function (or callable object) for a single input.

SequentialEvaluator

Evaluates a function (or callable object) for a list of input values, and

Module Contents#

class pybop._evaluation.BaseEvaluator(problem: pybop.problems.problem.Problem, minimise: bool, with_sensitivities: bool, logger: pybop._logging.Logger)[source]#

Bases: pints.Evaluator

Evaluates a function (or callable object) for multiple positions.

Applies transformations, if any.

Based on and extends Pints’ Evaluator.

Parameters:
  • problem (pybop.Problem) – The problem to be optimised.

  • minimise (bool) – If True, the cost function is minimised, otherwise maximisation is performed by inverting the sign of the cost function and sensitivities.

  • with_sensitivities (bool) – If True, the sensitivities are calculated as well as the cost.

  • logger (Logger) – The logging object to record the parameter and cost values.

problem#
transformation#
class pybop._evaluation.PopulationEvaluator(problem: pybop.problems.problem.Problem, minimise: bool, with_sensitivities: bool, logger: pybop._logging.Logger)[source]#

Bases: BaseEvaluator

Evaluates a function (or callable object) for multiple positions.

Parameters:
  • function (callable) – The function to evaluate. This function should accept a list-like object of positions to be evaluated.

  • args (sequence, optional) – A sequence containing extra arguments to be passed to the function. If specified, the function will be called as function(x, *args).

_evaluate(positions)[source]#

See evaluate().

class pybop._evaluation.ScalarEvaluator(problem: pybop.problems.problem.Problem, minimise: bool, with_sensitivities: bool, logger: pybop._logging.Logger)[source]#

Bases: BaseEvaluator

Evaluates a function (or callable object) for a single input.

Parameters:
  • function (callable) – The function to evaluate. This function should accept an input and optionally additional arguments, returning either a single value or a tuple.

  • args (sequence, optional) – A sequence containing extra arguments to be passed to the function. If specified, the function will be called as function(x, *args).

_evaluate(x)[source]#

See evaluate().

class pybop._evaluation.SequentialEvaluator(problem: pybop.problems.problem.Problem, minimise: bool, with_sensitivities: bool, logger: pybop._logging.Logger)[source]#

Bases: BaseEvaluator

Evaluates a function (or callable object) for a list of input values, and returns a list containing the calculated function evaluations.

Parameters:
  • function (callable) – The function to evaluate.

  • args (sequence) – An optional tuple containing extra arguments to f. If args is specified, f will be called as f(x, *args).

_evaluate(positions)[source]#

See evaluate().