inversion_ideas.Smallness#
- class inversion_ideas.Smallness(mesh, *, active_cells=None, cell_weights=None, reference_model=None)#
Smallness regularization.
Regularize a weighted norm of model values.
- Parameters:
- meshdiscretize.base.BaseMesh
Mesh to use in the regularization.
- active_cells(n_cells) array or None, optional
Array full of bools that indicate the active cells in the mesh. It must have the same amount of elements as cells in the mesh.
- cell_weights(n_active) array or dict of (n_active) arrays or None, optional
Array with cell weights. For multiple cell weights, pass a dictionary where keys are strings and values are the different weights arrays. If None, no cell weights are going to be used.
- reference_model(n_active) array or None, optional
Array with values for the reference model. It must have the same number of elements as active cells in the mesh.
Attributes
Regularization weights on cells.
Number of model parameters.
Name of the objective function.
Diagonal matrix with the square root of regularization weights on cells.
n_active
Methods
__call__(model)Evaluate the regularization on a given model.
gradient(model)Gradient vector.
hessian(model)Hessian matrix.
hessian_diagonal(model)Get the main diagonal of the Hessian.
info()Get information about the objective function.
set_name(value)Set name for the objective function.
Notes
Implement a discretized version of the smallness regularization defined as follows:
\[\phi_s(\mathbf{m}) = \int_\Omega w(\mathbf{r}) |m(\mathbf{r}) - m^\text{ref}(\mathbf{r})|^2 \text{d}\mathbf{r},\]where \(w(\mathbf{r})\) is the value of weights on the point \(\mathbf{r}\), \(m\) and \(m^\text{ref}\) are the model and reference model, respectively.
When discretizing it into the
mesh, the smallness regularization can be expressed by:\[\phi_s(\mathbf{m}) = \sum\limits_{i=0}^M w_i V_i |m_i - m_i^\text{ref}|^2 = \lVert \mathbf{W} \mathbf{V} (\mathbf{m} - \mathbf{m}^\text{ref}) \rVert^2,\]where \(\mathbf{W} = [\sqrt{w_1}, \dots, \sqrt{w_M}]\) are the square roots of the cell weights, \(\mathbf{V} = [\sqrt{V_1}, \dots, \sqrt{V_M}]\) are the square root of cell volumes, \(\mathbf{m} = [m_1, \dots, m_M]\) and \(\mathbf{m}^\text{ref} = [m_1^\text{ref}, \dots, m_M^\text{ref}]\) are the model and reference model vectors, respectively.
Attributes#
- Smallness.cell_weights#
Regularization weights on cells.
- Smallness.n_active#
- Smallness.n_params#
- Smallness.name#
Name of the objective function.
- Smallness.weights_matrix#
Diagonal matrix with the square root of regularization weights on cells.
- Smallness.active_cells#
Methods#
Methods documentation
- Smallness.__call__(model)#
Evaluate the regularization on a given model.
- Parameters:
- model(n_params) array
Array with model values.
- Smallness.gradient(model)#
Gradient vector.
- Parameters:
- model(n_params) array
Array with model values.
- Smallness.hessian(model)#
Hessian matrix.
- Parameters:
- model(n_params) array
Array with model values.
- Smallness.hessian_diagonal(model)#
Get the main diagonal of the Hessian.
- Parameters:
- model(n_params) array
Array with model values.
- Returns:
- (n_params,) array
Array containing the diagonal of the Hessian.
- Smallness.info()#
Get information about the objective function.
- Smallness.set_name(value)#
Set name for the objective function.