The Data Fitting Problem
Given experimental data and a model with unknown parameters, we seek parameters that minimize a cost function: In battery modeling, this typically means:- Model: Physics-based simulation (SPMe, DFN, etc.)
- Data: Voltage, current, temperature measurements
- Parameters: Diffusivities, reaction rates, capacities, etc.
Core Components
The data fitting framework has three main components:Objectives
Define what to minimize: the difference between model and data
Parameters
Specify which parameters to fit and their bounds
Optimizer
Choose how to search the parameter space
Why Separate Components?
Separating the objective, cost, and optimizer provides several benefits:- Reusable objectives: The same objective can be used with different cost functions (e.g., RMSE vs. feature extraction)
- Sequential refinement: Objectives can be reused within a pipeline—first for approximate values, then for fine-tuning
- Combined objectives: Multiple objectives can be combined to simultaneously optimize over different datasets (e.g., constant-current discharge at different C-rates or temperatures)
Objectives
An objective computes the cost for a given set of parameters. It:- Runs the model with the proposed parameters
- Compares model output to experimental data
- Returns a scalar cost value
Parameters
Parameters define what the optimizer can adjust. Each parameter has:- Initial value: Starting point for optimization
- Bounds: Physical limits on the parameter
- Transform: Optional scaling (e.g., log-transform for diffusivities)
Optimizers
The optimizer searches for parameters that minimize the cost.| Optimizer | Best for |
|---|---|
| L-BFGS-B | Smooth problems, fast local optimization |
| Nelder-Mead | Non-smooth problems, no gradients needed |
| CMA-ES | Global optimization, many local minima |
| DifferentialEvolution | Global optimization, parallelizable |
| BayesianOptimization | Expensive simulations, ≤ ~10 parameters, small evaluation budget |
| TuRBO | Expensive simulations evaluated in parallel batches |
| SOBER | Wide parallel batches via quadrature-style selection |
To configure and submit a data fit, see Pipelines → Data Fitting.
Workflow
Results
A data fit returns the best-fit parameter values together with the final cost. When running with multiple starts, the framework records every run sorted by cost so you can inspect the spread and check whether the optimizer converged to the global optimum.Multi-Start Optimization
For problems with multiple local minima, run optimization from different starting points. The framework automatically:- Generates initial guesses using Latin Hypercube sampling
- Runs optimizations in parallel
- Returns all results sorted by cost
Related Topics
Objective Functions
Cost functions and objective types.
Regularization
Ridge regression and MAP estimation for stability.
Sensitivity Analysis
Understanding parameter identifiability.
Voltage & Stoichiometry
Fitting electrode stoichiometry windows.