pybop.costs.feature_distances#
Classes#
Exponential fit cost function. |
|
Base for defining cost functions based on comparing fit functions. |
|
Square-root fit cost function. |
Functions#
|
Module Contents#
- class pybop.costs.feature_distances.ExponentialFeatureDistance(dataset: pybop.processing.dataset.Dataset, target: str = None, feature: str = 'inverse_timescale', time_start: float = None, time_end: float = None)[source]#
Bases:
FeatureDistanceExponential fit cost function.
Fits an exponential and compares either its asymptote, its magnitude, or its timescale between model predictions and target data.
Supported features: - “asymptote”: The exponential fit value at infinite time. - “magnitude”: The prefactor of the exponential term. - “timescale”: The denominator in the exponential argument. - “inverse_timescale”: 1 over “timescale”; may perform better.
- _supported_features = ['asymptote', 'magnitude', 'timescale', 'inverse_timescale']#
- class pybop.costs.feature_distances.FeatureDistance(dataset: pybop.processing.dataset.Dataset, target: str = None, feature: str = None, time_start: float = None, time_end: float = None)[source]#
Bases:
pybop.costs.base_cost.BaseCostBase for defining cost functions based on comparing fit functions.
- Parameters:
dataset (pybop.Dataset) – Dataset object containing the target data.
target (str, optional) – The name of the target variable.
feature (str, optional) – The name of the parameter to use for fitting, must be one of the supported features.
time_start (float, optional) – Set the time (in seconds) from which onwards the data shall be fitted, counted from the start of the data. Default is the start.
time_end (float, optional) – Set the time (in seconds) until which the data shall be fitted, counted from the start of the data. Default is the end.
- __call__(y: numpy.ndarray, dy: numpy.ndarray | None = None) float | tuple[float, numpy.ndarray][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.
- evaluate(solution: pybop.simulators.solution.Solution, inputs: pybop.parameters.parameter.Inputs | None = None, calculate_sensitivities: bool = False) pybop.costs.evaluation.Evaluation[source]#
Evaluate the feature distance for the given solution.
- _supported_features = []#
- end_index#
- feature = None#
- start_index#
- time_end = None#
- time_start = None#
- class pybop.costs.feature_distances.SquareRootFeatureDistance(dataset: pybop.processing.dataset.Dataset, target: str = None, feature: str = 'inverse_slope', time_start: float = None, time_end: float = None)[source]#
Bases:
FeatureDistanceSquare-root fit cost function.
Fits a square-root fit function and compares either its offset or its slope between model predictions and target data.
Supported features: - “offset”: The value of the square-root fit at the start. - “slope”: The prefactor of the square-root over time. - “inverse_slope”: 1 over “slope”; may perform better.
- _supported_features = ['offset', 'slope', 'inverse_slope']#