Penalties

Penalty classes for adding penalty terms to objective functions.

Classes

class ionworkspipeline.data_fits.objective_functions.regularizers.Penalty(fun, regularizer_weight=None)

A penalty function that takes a dictionary of inputs and returns a value.

Parameters

funpybamm.Symbol or Number

The penalty expression as a pybamm symbol or a constant number.

regularizer_weightfloat, optional

The weight applied to the penalty term. Default is 1.0.

Extends: ionworkspipeline.data_fits.objective_functions.regularizers.regularizers.Regularizer

class ionworkspipeline.data_fits.objective_functions.regularizers.PenaltySet(regularizers: list | tuple | ndarray, scalar_output: bool, x_to_inputs, regularizer_set_weight: float | None = None)

A collection of penalty terms that can be evaluated together.

Parameters

regularizerslist, tuple or ndarray

Collection of penalty terms.

scalar_outputbool

Whether the set returns scalar or array outputs.

x_to_inputscallable

Function converting parameter vectors to input dictionaries.

regularizer_set_weightfloat, optional

Weight applied to the entire penalty set. Default is 1.0.

Extends: ionworkspipeline.data_fits.objective_functions.regularizers.regularizers.RegularizerSet

property base_regularizer_type

type: The base type for regularizers in this set.