simpeg.regularization.SparseSmallness#

class simpeg.regularization.SparseSmallness(mesh, norm=2.0, irls_scaled=True, irls_threshold=1e-08, **kwargs)[source]#

Bases: BaseSparse, Smallness

Sparse smallness (compactness) regularization.

SparseSmallness is used to recover models comprised of compact structures. The level of compactness is controlled by the norm within the regularization function; with more compact structures being recovered when a smaller norm is used. Optionally, custom cell weights can be included to control the degree of compactness being enforced throughout different regions the model.

See the Notes section below for a comprehensive description.

Parameters:
meshregularization.RegularizationMesh

Mesh on which the regularization is discretized. Not the mesh used to define the simulation.

normfloat, (n_cells, ) array_like

The norm defining sparseness in the regularization function. Use a float to define the same norm for all mesh cells, or define an independent norm for each cell. All norm values must be within the interval [0, 2].

active_cellsNone, (n_cells, ) numpy.ndarray of bool

Boolean array defining the set of RegularizationMesh cells that are active in the inversion. If None, all cells are active.

mappingNone, simpeg.maps.BaseMap

The mapping from the model parameters to the active cells in the inversion. If None, the mapping is the identity map.

reference_modelNone, (n_param, ) numpy.ndarray

Reference model. If None, the reference model in the inversion is set to the starting model.

unitsNone, str

Units for the model parameters. Some regularization classes behave differently depending on the units; e.g. ‘radian’.

weightsNone, dict

Weight multipliers to customize the least-squares function. Each key points to a (n_cells, ) numpy.ndarray that is defined on the regularization.RegularizationMesh.

irls_scaledbool

If True, scale the IRLS weights to preserve magnitude of the regularization function. If False, do not scale.

irls_thresholdfloat

Constant added to IRLS weights to ensures stability in the algorithm.

Notes

We define the regularization function (objective function) for sparse smallness (compactness) as:

\[\phi (m) = \int_\Omega \, w(r) \, \Big | \, m(r) - m^{(ref)}(r) \, \Big |^{p(r)} \, dv\]

where \(m(r)\) is the model, \(m^{(ref)}(r)\) is the reference model, \(w(r)\) is a user-defined weighting function and \(p(r) \in [0,2]\) is a parameter which imposes sparseness throughout the recovered model. More compact structures are recovered in regions where \(p\) is small. If the same level of sparseness is being imposed everywhere, the exponent becomes a constant.

For implementation within SimPEG, the regularization function and its variables must be discretized onto a mesh. The discretized approximation for the regularization function (objective function) is expressed in linear form as:

\[\phi (\mathbf{m}) = \sum_i \tilde{w}_i \, \Big | m_i - m_i^{(ref)} \Big |^{p_i}\]

where \(m_i \in \mathbf{m}\) are the discrete model parameters defined on the mesh. \(\tilde{w}_i \in \mathbf{\tilde{w}}\) are amalgamated weighting constants that 1) account for cell dimensions in the discretization and 2) apply user-defined weighting. \(p_i \in \mathbf{p}\) define the norm for each cell (set using norm).

It is impractical to work with the general form directly, as its derivatives with respect to the model are non-linear and discontinuous. Instead, the iteratively re-weighted least-squares (IRLS) approach is used to approximate the sparse norm by iteratively solving a set of convex least-squares problems. For IRLS iteration \(k\), we define:

\[\phi \big (\mathbf{m}^{(k)} \big ) = \sum_i \tilde{w}_i \, \Big | m_i^{(k)} - m_i^{(ref)} \Big |^{p_i} \approx \sum_i \tilde{w}_i \, r_i^{(k)} \Big | m_i^{(k)} - m_i^{(ref)} \Big |^2\]

where the IRLS weight \(r_i\) for iteration \(k\) is given by:

\[r_i^{(k)} = \bigg [ \Big ( m_i^{(k-1)} - m_i^{(ref)} \Big )^2 + \epsilon^2 \; \bigg ]^{{p_i}/2 - 1}\]

and \(\epsilon\) is a small constant added for stability (set using irls_threshold). For the set of model parameters \(\mathbf{m}\) defined at cell centers, the objective function for IRLS iteration \(k\) can be expressed as follows:

\[\phi \big ( \mathbf{m}^{(k)} \big ) \approx \Big \| \, \mathbf{W}^{\! (k)} \big [ \mathbf{m}^{(k)} - \mathbf{m}^{(ref)} \big ] \Big \|^2\]

where

  • \(\mathbf{m}^{(k)}\) are the discrete model parameters at iteration \(k\),

  • \(\mathbf{m}^{(ref)}\) is a reference model (optional, set with reference_model),

  • \(\mathbf{W}^{(k)}\) is the weighting matrix for iteration \(k\). It applies the IRLS weights, user-defined weighting, and accounts for cell dimensions when the regularization function is discretized.

IRLS weights, user-defined weighting and the weighting matrix:

Let \(\mathbf{w_1, \; w_2, \; w_3, \; ...}\) each represent an optional set of custom cell weights. And let \(\mathbf{r_s}^{\!\! (k)}\) represent the IRLS weights for iteration \(k\). The net weighting applied within the objective function is given by:

\[\mathbf{w}^{(k)} = \mathbf{r_s}^{\!\! (k)} \odot \mathbf{v} \odot \prod_j \mathbf{w_j}\]

where \(\mathbf{v}\) are the cell volumes. For a description of how IRLS weights are updated at every iteration, see the documentation for update_weights().

The weighting matrix used to apply the weights is given by:

\[\mathbf{W}^{(k)} = \textrm{diag} \Big ( \sqrt{\mathbf{w}^{(k)} \, } \Big )\]

Each set of custom cell weights is stored within a dict as an (n_cells, ) numpy.ndarray. The weights can be set all at once during instantiation with the weights keyword argument as follows:

>>> reg = SparseSmallness(mesh, weights={'weights_1': array_1, 'weights_2': array_2})

or set after instantiation using the set_weights method:

>>> reg.set_weights(weights_1=array_1, weights_2=array_2})

Attributes

W

Weighting matrix.

active_cells

Active cells defined on the regularization mesh.

cell_weights

Deprecated property for 'volume' and user defined weights.

indActive

active_cells.indActive has been deprecated.

irls_scaled

Scale IRLS weights.

irls_threshold

Stability constant for computing IRLS weights.

mapping

Mapping from the inversion model parameters to the regularization mesh.

model

The model parameters.

mref

reference_model.mref has been deprecated.

nP

Number of model parameters.

norm

Norm for the sparse regularization.

parent

The parent objective function

reference_model

Reference model.

regmesh

regularization_mesh.regmesh has been deprecated.

regularization_mesh

Regularization mesh.

units

Units for the model parameters.

weights_keys

Return the keys for the existing cell weights

Methods

__call__(m)

Evaluate the regularization function for the model provided.

deriv(m)

Gradient of the regularization function evaluated for the model provided.

deriv2(m[, v])

Hessian of the regularization function evaluated for the model provided.

f_m(m)

Evaluate the regularization kernel function.

f_m_deriv(m)

Derivative of the regularization kernel function.

get_lp_weights(f_m)

Compute and return iteratively re-weighted least-squares (IRLS) weights.

get_weights(key)

Cell weights for a given key.

map_class

alias of IdentityMap

remove_weights(key)

Removes the weights for the key provided.

set_weights(**weights)

Adds (or updates) the specified weights to the regularization.

test([x, num, random_seed])

Run a convergence test on both the first and second derivatives.

update_weights(m)

Update the IRLS weights for sparse smallness regularization.