Data fitting is the process of estimating unknown model parameters by minimizing the difference between model predictions and experimental measurements. The Ionworks Pipeline provides a flexible framework for this task.Documentation Index
Fetch the complete documentation index at: https://docs.ionworks.com/llms.txt
Use this file to discover all available pages before exploring further.
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 consists of 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 theObjective, 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:- 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:- 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 |
| CMAES | Global optimization, many local minima |
| PSO | Global optimization, parallelizable |
The examples and options in this section are not exhaustive. See the API reference for full details.
Workflow
Results
The optimization returns aResult object:
Multi-Start Optimization
For problems with multiple local minima, run optimization from different starting points:- Generates initial guesses using Latin Hypercube sampling
- Runs optimizations in parallel
- Returns all results sorted by cost
Related Topics
Objective Functions
Detailed guide to cost functions and objectives
Regularization
Ridge regression and MAP estimation for stability
Sensitivity Analysis
Understanding parameter identifiability
Voltage & Stoichiometry
Fitting electrode stoichiometry windows
Python Examples
Code examples in the Python documentation