> ## 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.

# データフィッティング入門

> Estimate battery model parameters from voltage and current measurements using least-squares optimization.

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:

$$
\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:

<CardGroup cols={3}>
  <Card title="Objectives" icon="bullseye">
    Define what to minimize: the difference between model and data
  </Card>

  <Card title="Parameters" icon="sliders">
    Specify which parameters to fit and their bounds
  </Card>

  <Card title="Optimizer" icon="magnifying-glass">
    Choose how to search the parameter space
  </Card>
</CardGroup>

### 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.

| 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              |

<Note>
  データフィットの構成と送信方法については、[Pipelines → Data Fitting](/ja/pipelines/data-fitting/overview) を参照してください。
</Note>

## Workflow

<Steps>
  <Step title="Prepare Data">
    Load experimental data and preprocess as needed
  </Step>

  <Step title="Define Model">
    Set up the physics-based model with fixed parameters
  </Step>

  <Step title="Create Objectives">
    Specify what data to fit and how to compare
  </Step>

  <Step title="Set Parameters">
    Choose which parameters to fit and their bounds
  </Step>

  <Step title="Run Optimization">
    Execute the fitting and analyze results
  </Step>
</Steps>

## 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

<CardGroup cols={2}>
  <Card title="Objective Functions" icon="bullseye" href="/ja/guide/data-fitting/objective-functions">
    Cost functions and objective types.
  </Card>

  <Card title="Regularization" icon="scale-balanced" href="/ja/guide/data-fitting/regularization">
    Ridge regression and MAP estimation for stability.
  </Card>

  <Card title="Sensitivity Analysis" icon="chart-line" href="/ja/guide/data-fitting/sensitivity-analysis">
    Understanding parameter identifiability.
  </Card>

  <Card title="Voltage & Stoichiometry" icon="sliders" href="/ja/guide/data-fitting/voltage-stoichiometry-limits">
    Fitting electrode stoichiometry windows.
  </Card>
</CardGroup>
