pybop.costs.feature_distances#

Classes#

ExponentialFeatureDistance

Exponential fit cost function.

FeatureDistance

Base for defining cost functions based on comparing fit functions.

SquareRootFeatureDistance

Square-root fit cost function.

Functions#

indices_of(values, target)

Module Contents#

class pybop.costs.feature_distances.ExponentialFeatureDistance(domain_data: numpy.ndarray, target_data: numpy.ndarray, feature: str = 'inverse_timescale', time_start: float = None, time_end: float = None)[source]#

Bases: FeatureDistance

Exponential fit cost function.

Fits an exponential and compares either its asymptote, its magnitude, or its timescale between model predictions and target data.

_feature_selection(fit)[source]#
_fit_guess(t, y)[source]#
_inverse_fit_function(y, b, c, d)[source]#

Logarithm function to transform data for a linear fit.

_supported_features = ['asymptote', 'magnitude', 'timescale', 'inverse_timescale']#
class pybop.costs.feature_distances.FeatureDistance(domain_data: numpy.ndarray, target_data: numpy.ndarray, feature: str, time_start: float = None, time_end: float = None)[source]#

Bases: pybop.costs.base_cost.BaseCost

Base for defining cost functions based on comparing fit functions.

__call__(y: numpy.ndarray, dy: numpy.ndarray | None = None) float | tuple[float, numpy.ndarray][source]#
_feature_selection(fit)[source]#
_fit(t, y)[source]#

Uses SciPy to fit data. For numerical reasons, the fitting involves applying the fit function to data and comparing to identity.

_fit_guess(t, y)[source]#
_inverse_fit_function(y, *args)[source]#
_domain_data#
_supported_features = []#
_target_data#
end_index#
feature#
start_index#
time_end = None#
time_start = None#
class pybop.costs.feature_distances.SquareRootFeatureDistance(domain_data: numpy.ndarray, target_data: numpy.ndarray, feature: str = 'inverse_slope', time_start: float = None, time_end: float = None)[source]#

Bases: FeatureDistance

Square-root fit cost function.

Fits a square-root fit function and compares either its offset or its slope between model predictions and target data.

_feature_selection(fit)[source]#
_fit_guess(t, y)[source]#
_inverse_fit_function(y, b, c)[source]#

Square function to transform data for a linear fit.

_supported_features = ['offset', 'slope', 'inverse_slope']#
pybop.costs.feature_distances.indices_of(values, target)[source]#