Skip to main content
Data fitting is the process of estimating unknown model parameters by minimizing the difference between model predictions and experimental measurements.

The Data Fitting Problem

Given experimental data and a model with unknown parameters, we seek parameters θ\theta that minimize a cost function: θ^=argminθ  C(θ)=argminθi(yimodel(θ)yidata)2\hat{\theta} = \arg\min_\theta \; C(\theta) = \arg\min_\theta \sum_i \left( y_i^{\text{model}}(\theta) - y_i^{\text{data}} \right)^2 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:
  1. Runs the model with the proposed parameters
  2. Compares model output to experimental data
  3. Returns a scalar cost value
Multiple objectives can be combined for fitting to different experiments simultaneously. The most common objective for time-series voltage data is a current-driven objective, which feeds the measured current into the model and compares the predicted voltage against the measured voltage.

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.
OptimizerBest for
L-BFGS-BSmooth problems, fast local optimization
Nelder-MeadNon-smooth problems, no gradients needed
CMA-ESGlobal optimization, many local minima
DifferentialEvolutionGlobal optimization, parallelizable
BayesianOptimizationExpensive simulations, ≤ ~10 parameters, small evaluation budget
TuRBOExpensive simulations evaluated in parallel batches
SOBERWide parallel batches via quadrature-style selection
To configure and submit a data fit, see Pipelines → Data Fitting.

Workflow

1

Prepare Data

Load experimental data and preprocess as needed
2

Define Model

Set up the physics-based model with fixed parameters
3

Create Objectives

Specify what data to fit and how to compare
4

Set Parameters

Choose which parameters to fit and their bounds
5

Run Optimization

Execute the fitting and analyze results

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

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.