# Data Misfit¶

The data misfit using an l_2 norm is:

$\mu_\text{data} = {1\over 2}\left| \mathbf{W}_d (\mathbf{d}_\text{pred} - \mathbf{d}_\text{obs}) \right|_2^2$

If the field, u, is provided, the calculation of the data is fast:

\begin{align}\begin{aligned}\mathbf{d}_\text{pred} = \mathbf{Pu(m)}\\\mathbf{R} = \mathbf{W}_d (\mathbf{d}_\text{pred} - \mathbf{d}_\text{obs})\end{aligned}\end{align}

Where P is a projection matrix that brings the field on the full domain to the data measurement locations; u is the field of interest; d_obs is the observed data; and $$\mathbf{W}_d$$ is the weighting matrix.

The derivative of this, with respect to the model, is:

$\frac{\partial \mu_\text{data}}{\partial \mathbf{m}} = \mathbf{J}^\top \mathbf{W}_d \mathbf{R}$

The second derivative is:

$\frac{\partial^2 \mu_\text{data}}{\partial^2 \mathbf{m}} = \mathbf{J}^\top \mathbf{W}_d \mathbf{W}_d \mathbf{J}$

## The API¶

class SimPEG.DataMisfit.BaseDataMisfit(survey, **kwargs)[source]

Note

You should inherit from this class to create your own data misfit term.

debug = False

Print debugging information

counter = None

Set this to a SimPEG.Utils.Counter() if you want to count things

eval(m, f=None)[source]
Parameters: m (numpy.array) – geophysical model f (Fields) – fields float data misfit
evalDeriv(m, f=None)[source]
Parameters: m (numpy.array) – geophysical model f (Fields) – fields numpy.array data misfit derivative
eval2Deriv(m, v, f=None)[source]
Parameters: m (numpy.array) – geophysical model v (numpy.array) – vector to multiply f (Fields) – fields numpy.array data misfit derivative

## Common Data Misfits¶

### l2 norm¶

class SimPEG.DataMisfit.l2_DataMisfit(survey, **kwargs)[source]

The data misfit with an l_2 norm:

$\mu_\text{data} = {1\over 2}\left| \mathbf{W}_d (\mathbf{d}_\text{pred} - \mathbf{d}_\text{obs}) \right|_2^2$
Wd

getWd(survey)

The data weighting matrix.

The default is based on the norm of the data plus a noise floor.

Return type: scipy.sparse.csr_matrix Wd
eval(m, f=None)[source]
evalDeriv(m, f=None)[source]
eval2Deriv(m, v, f=None)[source]