simpeg.regularization.AmplitudeSmallness#
- class simpeg.regularization.AmplitudeSmallness(mesh, norm=2.0, irls_scaled=True, irls_threshold=1e-08, **kwargs)[source]#
Bases:
SparseSmallness
,BaseAmplitude
Sparse smallness regularization on vector amplitudes.
AmplitudeSmallness
is a sparse norm smallness regularization that acts on the amplitudes of the vectors defining the model. Sparse norm functionality allows the use to recover more compact regions of higher amplitude vectors. 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:
- mesh
regularization.RegularizationMesh
Mesh on which the regularization is discretized. Not the mesh used to define the simulation.
- norm
float
, (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_cells
None
, (n_cells
, )numpy.ndarray
of
bool Boolean array defining the set of
RegularizationMesh
cells that are active in the inversion. IfNone
, all cells are active.- mapping
None
,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_model
None
, (n_param
, )numpy.ndarray
Reference model. If
None
, the reference model in the inversion is set to the starting model.- units
None
,str
Units for the model parameters. Some regularization classes behave differently depending on the units; e.g. ‘radian’.
- weights
None
,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. IfFalse
, do not scale.- irls_threshold
float
Constant added to IRLS weights to ensures stability in the algorithm.
- mesh
Attributes
Weighting matrix.
Active cells defined on the regularization mesh.
Deprecated property for 'volume' and user defined weights.
active_cells.indActive has been deprecated.
Scale IRLS weights.
Stability constant for computing IRLS weights.
Mapping from the inversion model parameters to the regularization mesh.
The model parameters.
reference_model.mref has been deprecated.
Number of model parameters.
Number of components in the model.
Norm for the sparse regularization.
The parent objective function
Reference model.
regularization_mesh.regmesh has been deprecated.
Regularization mesh.
Units for the model parameters.
Return the keys for the existing cell weights
Methods
__call__
(m)Evaluate the regularization function for the model provided.
amplitude
(m)Return vector amplitudes 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 the IRLS weights for sparse smallness regularization.
Notes
We define the regularization function (objective function) for sparse amplitude smallness (compactness) as:
\[\phi (\vec{m}) = \int_\Omega \, w(r) \, \Big | \, \vec{m}(r) - \vec{m}^{(ref)}(r) \, \Big |^{p(r)} \, dv\]where \(\vec{m}(r)\) is the model, \(\vec{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 | \vec{m}_i - \vec{m}_i^{(ref)} \Big |^{p_i}\]where \(\mathbf{m}\) are the model parameters, \(\vec{m}_i\) represents the vector defined for mesh cell \(i\), and \(\vec{m}_i^{(ref)}\) defines the reference model vector for cell \(i\). \(\tilde{w}_i\) 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 | \, \vec{m}_i^{(k)} - \vec{m}_i^{(ref)} \, \Big |^{p_i} \approx \sum_i \tilde{w}_i \, r_i^{(k)} \Big | \, \vec{m}_i^{(k)} - \vec{m}_i^{(ref)} \, \Big |^2\]where the IRLS weight \(r_i\) for iteration \(k\) is given by:
\[r_i^{(k)} = \bigg [ \, \Big | \vec{m}_i^{(k-1)} - \vec{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).
The global set of model parameters \(\mathbf{m}\) defined at cell centers is ordered according to its primary (\(p\)), secondary (\(s\)) and tertiary (\(t\)) directions as follows:
\[\begin{split}\mathbf{m} = \begin{bmatrix} \mathbf{m}_p \\ \mathbf{m}_s \\ \mathbf{m}_t \end{bmatrix}\end{split}\]We define the amplitudes of the residual between the model and reference model for all cells as:
\[\mathbf{\bar{m}} = \bigg ( \Big [ \mathbf{m}_p - \mathbf{m}_p^{(ref)} \Big ]^2 + \Big [ \mathbf{m}_s - \mathbf{m}_s^{(ref)} \Big ]^2 + \Big [ \mathbf{m}_t - \mathbf{m}_t^{(ref)} \Big ]^2 \bigg )^{1/2}\]The objective function for IRLS iteration \(k\) is given by:
\[\phi \big ( \mathbf{\bar{m}}^{(k)} \big ) \approx \Big \| \, \mathbf{W}^{(k)} \, \mathbf{\bar{m}}^{(k)} \; \Big \|^2\]where
\(\mathbf{\bar{m}}^{(k)}\) are the absolute values of the residual at iteration \(k\), and
\(\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 = AmplitudeSmallness(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})