misfit¶
-
emg3d.optimize.
misfit
(simulation)[source]¶ Misfit or cost function.
The data misfit or weighted least-squares functional using an \(l_2\) norm is given by
(35)¶\[ \phi = \frac{1}{2} \sum_s\sum_r\sum_f \left\lVert W_{s,r,f} \left( \textbf{d}_{s,r,f}^\text{pred} -\textbf{d}_{s,r,f}^\text{obs} \right) \right\rVert^2 \, ,\]where \(s, r, f\) stand for source, receiver, and frequency, respectively; \(\textbf{d}^\text{obs}\) are the observed electric and magnetic data, and \(\textbf{d}^\text{pred}\) are the synthetic electric and magnetic data. As of now the misfit does not include any regularization term.
The data weight of observation \(d_i\) is given by \(W_i = \varsigma^{-1}_i\), where \(\varsigma_i\) is the standard deviation of the observation, see
emg3d.surveys.Survey.standard_deviation
.Note
You can easily implement your own misfit function (to include, e.g., a regularization term) by monkey patching this misfit function with your own:
def my_misfit_function(simulation): '''Returns the misfit as a float.''' # Computing the misfit... return misfit # Monkey patch optimize.misfit: emg3d.optimize.misfit = my_misfit_function # And now all the regular stuff, initiate a Simulation etc simulation = emg3d.Simulation(survey, grid, model) simulation.misfit # => will return your misfit # (will also be used for the adjoint-state gradient).
- Parameters
- simulationSimulation
The simulation; a
emg3d.simulations.Simulation
instance.
- Returns
- misfitfloat
Value of the misfit function.