# Model fitting#

HyperSpy can perform curve fitting of one-dimensional signals (spectra) and
two-dimensional signals (images) in n-dimensional data sets.
Models are defined by adding individual functions (components in HyperSpy’s
terminology) to a `BaseModel`

instance. Those individual
components are then summed to create the final model function that can be
fitted to the data, by adjusting the free parameters of the individual
components.

Models can be created and fit to experimental data in both one and two
dimensions i.e. spectra and images respectively. Most of the syntax is
identical in either case. A one-dimensional model is created when a model
is created for a `Signal1D`

whereas a two-
dimensional model is created for a `Signal2D`

.

Note

Plotting and analytical gradient-based fitting methods are not yet
implemented for the `Model2D`

class.

- Creating a model
- Model components
- Adding components to the model
- Indexing the model
- Getting and setting parameter values and attributes
- Fitting the model to the data
- Optimization algorithms
- Loss functions
- Using gradient information
- Bounded optimization
- Linear least squares
- Optimization results
- Goodness of fit
- Visualizing the model
- Setting the initial parameters
- Exclude data from the fitting process
- Fitting multidimensional datasets
- Visualising the result of the fit

- Storing models
- Fitting big data
- Smart Adaptive Multi-dimensional Fitting (SAMFire)