pybop.problems.fitting_problem#
Classes#
Problem class for fitting (parameter estimation) problems. |
Module Contents#
- class pybop.problems.fitting_problem.FittingProblem(model: pybop.BaseModel, parameters: pybop.parameters.parameter.Parameters, dataset: pybop.Dataset, check_model: bool = True, signal: list[str] | None = None, domain: str | None = None, additional_variables: list[str] | None = None, initial_state: dict | None = None)[source]#
Bases:
pybop.BaseProblemProblem class for fitting (parameter estimation) problems.
Extends BaseProblem with specifics for fitting a model to a dataset.
- Parameters:
model (object) – The model to fit.
parameters (pybop.Parameter or pybop.Parameters) – An object or list of the parameters for the problem.
dataset (dictionary) – Dataset object containing the data to fit the model to.
check_model (bool, optional) – Flag to indicate if the model should be checked (default: True).
signal (list[str], optional) – A list of variables to fit (default: [“Voltage [V]”]).
domain (str, optional) – The name of the domain (default: “Time [s]”).
additional_variables (list[str], optional) – Additional variables to observe and store in the solution (default additions are: [“Time [s]”]).
initial_state (dict, optional) – A valid initial state, e.g. the initial open-circuit voltage (default: None) which will trigger a model rebuild on each evaluation. Example: {“Initial open-circuit potential [V]”: 4.1} NOTE: Sensitivities are not support with this arg due to the model rebuilding.
Attributes (Additional)
---------------------
dataset – The dictionary from a Dataset object containing the signal keys and values to fit the model to.
domain_data (np.ndarray) – The domain points in the dataset.
n_domain_data (int) – The number of domain points.
target (np.ndarray) – The target values of the signals.
- _evaluate(func, inputs, calculate_grad=False) dict[str, numpy.ndarray] | tuple[dict[str, numpy.ndarray], dict[str, dict[str, numpy.ndarray]]][source]#
Perform simulation using the specified method and handle exceptions.
- Parameters:
func (callable) – The method to be used for simulation.
inputs (Inputs) – Parameters for evaluation of the model.
- Returns:
The simulation result y(t) and, optionally, the sensitivities dy/dx(t) for each parameter x and signal y.
- Return type:
dict[str, np.ndarray[np.float64]] or tuple[dict[str, np.ndarray], dict[str, dict[str, np.ndarray]]]
- evaluate(inputs: pybop.parameters.parameter.Inputs, eis=False) dict[str, numpy.ndarray] | tuple[dict[str, numpy.ndarray], dict[str, dict[str, numpy.ndarray]]][source]#
Evaluate the model with the given parameters and return the signal.
- Parameters:
inputs (Inputs) – Parameters for evaluation of the model.
- Returns:
The simulated model output y(t) for self.eis == False, and y(ω) for self.eis == True for the given inputs.
- Return type:
dict[str, np.ndarray[np.float64]]
- evaluateS1(inputs: pybop.parameters.parameter.Inputs)[source]#
Evaluate the model with the given parameters and return the signal and its derivatives.
- Parameters:
inputs (Inputs) – Parameters for evaluation of the model.
- Returns:
A tuple containing the simulation result y(t) and the sensitivities dy/dx(t) for each parameter x and signal y evaluated with the given inputs.
- Return type:
tuple[dict[str, np.ndarray[np.float64]], dict[str, dict[str, np.ndarray]]]