Regularization¶

If there is one model that has a misfit that equals the desired tolerance, then there are infinitely many other models which can fit to the same degree. The challenge is to find that model which has the desired characteristics and is compatible with a priori information. A single model can be selected from an infinite ensemble by measuring the length, or norm, of each model. Then a smallest, or sometimes largest, member can be isolated. Our goal is to design a norm that embodies our prior knowledge and, when minimized, yields a realistic candidate for the solution of our problem. The norm can penalize variation from a reference model, spatial derivatives of the model, or some combination of these.

The API¶

class SimPEG.regularization.RegularizationMesh(*args, **kwargs)[source]

Regularization Mesh

This contains the operators used in the regularization. Note that these are not necessarily true differential operators, but are constructed from a discretize Mesh.

param discretize.base.BaseMesh mesh

problem mesh

param numpy.ndarray indActive

bool array, size nC, that is True where we have active cells. Used to reduce the operators so we regularize only on active cells

Required Properties:

• indActive (Array): active indices in mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

property Pac

projection matrix that takes from the reduced space of active cells to full modelling space (ie. nC x nindActive)

Return type

scipy.sparse.csr_matrix

Returns

active cell projection matrix

property Pafx

projection matrix that takes from the reduced space of active x-faces to full modelling space (ie. nFx x nindActive_Fx )

Return type

scipy.sparse.csr_matrix

Returns

active face-x projection matrix

property Pafy

projection matrix that takes from the reduced space of active y-faces to full modelling space (ie. nFy x nindActive_Fy )

Return type

scipy.sparse.csr_matrix

Returns

active face-y projection matrix

property Pafz

projection matrix that takes from the reduced space of active z-faces to full modelling space (ie. nFz x nindActive_Fz )

Return type

scipy.sparse.csr_matrix

Returns

active face-z projection matrix

property aveCC2Fx

averaging from active x-faces to active cell centers

Return type

scipy.sparse.csr_matrix

Returns

averaging matrix from active x-faces to active cell centers

property aveCC2Fy

averaging from active y-faces to active cell centers

Return type

scipy.sparse.csr_matrix

Returns

averaging matrix from active y-faces to active cell centers

property aveCC2Fz

averaging from active z-faces to active cell centers

Return type

scipy.sparse.csr_matrix

Returns

averaging matrix from active z-faces to active cell centers

property aveFx2CC

averaging from active cell centers to active x-faces

Return type

scipy.sparse.csr_matrix

Returns

averaging from active cell centers to active x-faces

property aveFy2CC

averaging from active cell centers to active y-faces

Return type

scipy.sparse.csr_matrix

Returns

averaging from active cell centers to active y-faces

property aveFz2CC

averaging from active cell centers to active z-faces

Return type

scipy.sparse.csr_matrix

Returns

averaging from active cell centers to active z-faces

property average_face_to_cell
property cellDiffx

cell centered difference in the x-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the x-direction

property cellDiffxStencil

cell centered difference stencil (no cell lengths include) in the x-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the x-direction

property cellDiffy

cell centered difference in the y-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the y-direction

property cellDiffyStencil

cell centered difference stencil (no cell lengths include) in the y-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the y-direction

property cellDiffz

cell centered difference in the z-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the z-direction

property cellDiffzStencil

cell centered difference stencil (no cell lengths include) in the y-direction

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active cells in the y-direction

property dim

dimension of regularization mesh (1D, 2D, 3D)

Return type

int

Returns

dimension

property faceDiffx

x-face differences

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active faces in the x-direction

property faceDiffy

y-face differences

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active faces in the y-direction

property faceDiffz

z-face differences

Return type

scipy.sparse.csr_matrix

Returns

differencing matrix for active faces in the z-direction

property indActive

indActive (Array): active indices in mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

property nC

reduced number of cells

Return type

int

Returns

number of cells being regularized

regularization_type = None
property vol

reduced volume vector

Return type

numpy.ndarray

Returns

reduced cell volume

class SimPEG.regularization.BaseRegularization(*args, **kwargs)[source]

Base class for regularization. Inherit this for building your own regularization. The base regularization assumes a weighted l2 style of regularization. However, if you wish to employ a different norm, the methods __call__(), deriv() and deriv2() can be over-written

param discretize.base.BaseMesh mesh

SimPEG mesh

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

counter = None
property mref

mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

property indActive

indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

property cell_weights

cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

property regmesh

regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property mapping

mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

property nP

number of model parameters

deriv(m)[source]

The regularization is:

$R(m) = \frac{1}{2}\mathbf{(m-m_\text{ref})^\top W^\top W(m-m_\text{ref})}$

So the derivative is straight forward:

$R(m) = \mathbf{W^\top W (m-m_\text{ref})}$
deriv2(m, v=None)[source]

Second derivative

Parameters
Return type

scipy.sparse.csr_matrix

Returns

WtW, or if v is supplied WtW*v (numpy.ndarray)

The regularization is:

$R(m) = \frac{1}{2}\mathbf{(m-m_\text{ref})^\top W^\top W(m-m_\text{ref})}$

So the second derivative is straight forward:

$R(m) = \mathbf{W^\top W}$
class SimPEG.regularization.BaseComboRegularization(*args, **kwargs)[source]

Required Properties:

• alpha_s (Float): smallness weight, a float, Zero or Identity

• alpha_x (Float): weight for the first x-derivative, a float, Zero or Identity

• alpha_xx (Float): weight for the second x-derivative, a float, Zero or Identity

• alpha_y (Float): weight for the first y-derivative, a float, Zero or Identity

• alpha_yy (Float): weight for the second y-derivative, a float, Zero or Identity

• alpha_z (Float): weight for the first z-derivative, a float, Zero or Identity

• alpha_zz (Float): weight for the second z-derivative, a float, Zero or Identity

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Float): function scaling applied inside the norm, a float, Default: 1.0

Tikhonov Regularization¶

Here we will define regularization of a model, m, in general however, this should be thought of as (m-m_ref) but otherwise it is exactly the same:

$R(m) = \int_\Omega \frac{\alpha_x}{2}\left(\frac{\partial m}{\partial x}\right)^2 + \frac{\alpha_y}{2}\left(\frac{\partial m}{\partial y}\right)^2 \partial v$

Our discrete gradient operator works on cell centers and gives the derivative on the cell faces, which is not where we want to be evaluating this integral. We need to average the values back to the cell-centers before we integrate. To avoid null spaces, we square first and then average. In 2D with ij notation it looks like this:

$\begin{split}R(m) \approx \sum_{ij} \left[\frac{\alpha_x}{2}\left[\left(\frac{m_{i+1,j} - m_{i,j}}{h}\right)^2 + \left(\frac{m_{i,j} - m_{i-1,j}}{h}\right)^2\right] \\ + \frac{\alpha_y}{2}\left[\left(\frac{m_{i,j+1} - m_{i,j}}{h}\right)^2 + \left(\frac{m_{i,j} - m_{i,j-1}}{h}\right)^2\right] \right]h^2\end{split}$

If we let D_1 be the derivative matrix in the x direction

$\mathbf{D}_1 = \mathbf{I}_2\otimes\mathbf{d}_1$
$\mathbf{D}_2 = \mathbf{d}_2\otimes\mathbf{I}_1$

Where d_1 is the one dimensional derivative:

$\begin{split}\mathbf{d}_1 = \frac{1}{h} \left[ \begin{array}{cccc} -1 & 1 & & \\ & \ddots & \ddots&\\ & & -1 & 1\end{array} \right]\end{split}$
$R(m) \approx \mathbf{v}^\top \left[\frac{\alpha_x}{2}\mathbf{A}_1 (\mathbf{D}_1 m) \odot (\mathbf{D}_1 m) + \frac{\alpha_y}{2}\mathbf{A}_2 (\mathbf{D}_2 m) \odot (\mathbf{D}_2 m) \right]$

Recall that this is really a just point wise multiplication, or a diagonal matrix times a vector. When we multiply by something in a diagonal we can interchange and it gives the same results (i.e. it is point wise)

$\mathbf{a\odot b} = \text{diag}(\mathbf{a})\mathbf{b} = \text{diag}(\mathbf{b})\mathbf{a} = \mathbf{b\odot a}$

and the transpose also is true (but the sizes have to make sense…):

$\mathbf{a}^\top\text{diag}(\mathbf{b}) = \mathbf{b}^\top\text{diag}(\mathbf{a})$

So R(m) can simplify to:

$R(m) \approx \mathbf{m}^\top \left[\frac{\alpha_x}{2}\mathbf{D}_1^\top \text{diag}(\mathbf{A}_1^\top\mathbf{v}) \mathbf{D}_1 + \frac{\alpha_y}{2}\mathbf{D}_2^\top \text{diag}(\mathbf{A}_2^\top \mathbf{v}) \mathbf{D}_2 \right] \mathbf{m}$

We will define W_x as:

$\mathbf{W}_x = \sqrt{\alpha_x}\text{diag}\left(\sqrt{\mathbf{A}_1^\top\mathbf{v}}\right) \mathbf{D}_1$

And then W as a tall matrix of all of the different regularization terms:

$\begin{split}\mathbf{W} = \left[ \begin{array}{c} \mathbf{W}_s\\ \mathbf{W}_x\\ \mathbf{W}_y\end{array} \right]\end{split}$

Then we can write

$R(m) \approx \frac{1}{2}\mathbf{m^\top W^\top W m}$

The API¶

class SimPEG.regularization.Tikhonov(*args, **kwargs)[source]

L2 Tikhonov regularization with both smallness and smoothness (first order derivative) contributions.

$\phi_m(\mathbf{m}) = \alpha_s \| W_s (\mathbf{m} - \mathbf{m_{ref}} ) \|^2 + \alpha_x \| W_x \frac{\partial}{\partial x} (\mathbf{m} - \mathbf{m_{ref}} ) \|^2 + \alpha_y \| W_y \frac{\partial}{\partial y} (\mathbf{m} - \mathbf{m_{ref}} ) \|^2 + \alpha_z \| W_z \frac{\partial}{\partial z} (\mathbf{m} - \mathbf{m_{ref}} ) \|^2$

Note if the key word argument mrefInSmooth is False, then mref is not included in the smoothness contribution.

param discretize.base.BaseMesh mesh

SimPEG mesh

param IdentityMap mapping

regularization mapping, takes the model from model space to the thing you want to regularize

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param bool mrefInSmooth

(default = False) put mref in the smoothness component?

param float alpha_s

(default 1e-6) smallness weight

param float alpha_x

(default 1) smoothness weight for first derivative in the x-direction

param float alpha_y

(default 1) smoothness weight for first derivative in the y-direction

param float alpha_z

(default 1) smoothness weight for first derivative in the z-direction

param float alpha_xx

(default 1) smoothness weight for second derivative in the x-direction

param float alpha_yy

(default 1) smoothness weight for second derivative in the y-direction

param float alpha_zz

(default 1) smoothness weight for second derivative in the z-direction

Required Properties:

• alpha_s (Float): smallness weight, a float, Zero or Identity

• alpha_x (Float): weight for the first x-derivative, a float, Zero or Identity

• alpha_xx (Float): weight for the second x-derivative, a float, Zero or Identity

• alpha_y (Float): weight for the first y-derivative, a float, Zero or Identity

• alpha_yy (Float): weight for the second y-derivative, a float, Zero or Identity

• alpha_z (Float): weight for the first z-derivative, a float, Zero or Identity

• alpha_zz (Float): weight for the second z-derivative, a float, Zero or Identity

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Float): function scaling applied inside the norm, a float, Default: 1.0

class SimPEG.regularization.Small(*args, **kwargs)[source]

Small regularization - L2 regularization on the difference between a model and a reference model. Cell weights may be included. A volume contribution is included

$r(m) = \frac{1}{2}(\mathbf{m} - \mathbf{m_ref})^ op \mathbf{W}^T \mathbf{W} (\mathbf{m} - \mathbf{m_{ref}})$

where $$\mathbf{m}$$ is the model, $$\mathbf{m_{ref}}$$ is a reference model and $$\mathbf{W}$$ is a weighting matrix (default diag(np.sqrt(vol)). If cell weights are provided, then it is diag(np.sqrt(vol * cell_weights)))

Optional Inputs

param discretize.base.BaseMesh mesh

SimPEG mesh

param int nP

number of parameters

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property W

Weighting matrix

class SimPEG.regularization.SmoothDeriv(*args, **kwargs)[source]

Base Smooth Regularization. This base class regularizes on the first spatial derivative in the provided orientation

Optional Inputs

param discretize.base.BaseMesh mesh

SimPEG mesh

param int nP

number of parameters

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

param bool mrefInSmooth

include the reference model in the smoothness computation? (eg. look at Deriv of m (False) or Deriv of (m-mref) (True))

param numpy.ndarray cell_weights

vector of cell weights (applied in all terms)

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property mrefInSmooth

mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

property W

Weighting matrix that constructs the first spatial derivative stencil in the specified orientation

class SimPEG.regularization.SmoothDeriv2(*args, **kwargs)[source]

Base Smooth Regularization. This base class regularizes on the second spatial derivative in the provided orientation

Optional Inputs

param discretize.base.BaseMesh mesh

SimPEG mesh

param int nP

number of parameters

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

param bool mrefInSmooth

include the reference model in the smoothness computation? (eg. look at Deriv of m (False) or Deriv of (m-mref) (True))

param numpy.ndarray cell_weights

vector of cell weights (applied in all terms)

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property W

Weighting matrix that takes the second spatial derivative in the specified orientation

class SimPEG.regularization.Simple(*args, **kwargs)[source]

Simple regularization that does not include length scales in the derivatives.

$r(\mathbf{m}) = \alpha_s \phi_s + \alpha_x \phi_x + \alpha_y \phi_y + \alpha_z \phi_z$

where:

Required Inputs

param discretize.base.BaseMesh mesh

a SimPEG mesh

Optional Inputs

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

param bool mrefInSmooth

include the reference model in the smoothness computation? (eg. look at Deriv of m (False) or Deriv of (m-mref) (True))

param numpy.ndarray cell_weights

vector of cell weights (applied in all terms)

Weighting Parameters

param float alpha_s

weighting on the smallness (default 1.)

param float alpha_x

weighting on the x-smoothness (default 1.)

param float alpha_y

weighting on the y-smoothness (default 1.)

param float alpha_z

weighting on the z-smoothness(default 1.)

Required Properties:

• alpha_s (Float): smallness weight, a float, Zero or Identity

• alpha_x (Float): weight for the first x-derivative, a float, Zero or Identity

• alpha_xx (Float): weight for the second x-derivative, a float, Zero or Identity

• alpha_y (Float): weight for the first y-derivative, a float, Zero or Identity

• alpha_yy (Float): weight for the second y-derivative, a float, Zero or Identity

• alpha_z (Float): weight for the first z-derivative, a float, Zero or Identity

• alpha_zz (Float): weight for the second z-derivative, a float, Zero or Identity

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Float): function scaling applied inside the norm, a float, Default: 1.0

class SimPEG.regularization.SimpleSmall(*args, **kwargs)[source]

Simple Small regularization - L2 regularization on the difference between a model and a reference model. Cell weights may be included. This does not include a volume contribution.

$r(m) = \frac{1}{2}(\mathbf{m} - \mathbf{m_ref})^ op \mathbf{W}^T \mathbf{W} (\mathbf{m} - \mathbf{m_{ref}})$

where $$\mathbf{m}$$ is the model, $$\mathbf{m_{ref}}$$ is a reference model and $$\mathbf{W}$$ is a weighting matrix (default Identity). If cell weights are provided, then it is diag(np.sqrt(cell_weights)))

Optional Inputs

param discretize.base.BaseMesh mesh

SimPEG mesh

param int nP

number of parameters

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property W

Weighting matrix

class SimPEG.regularization.SimpleSmoothDeriv(*args, **kwargs)[source]

Base Simple Smooth Regularization. This base class regularizes on the first spatial derivative, not considering length scales, in the provided orientation

Optional Inputs

param discretize.base.BaseMesh mesh

SimPEG mesh

param int nP

number of parameters

param IdentityMap mapping

regularization mapping, takes the model from model space to the space you want to regularize in

param numpy.ndarray mref

reference model

param numpy.ndarray indActive

active cell indices for reducing the size of differential operators in the definition of a regularization mesh

param numpy.ndarray cell_weights

cell weights

param bool mrefInSmooth

include the reference model in the smoothness computation? (eg. look at Deriv of m (False) or Deriv of (m-mref) (True))

param numpy.ndarray cell_weights

vector of cell weights (applied in all terms)

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

property mrefInSmooth

mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

property W

Weighting matrix that takes the first spatial difference with normalized length scales in the specified orientation

property length_scales

Normalized cell based weighting

Sparse Regularization¶

We have also implemented several sparse regularizations with a variable norm.

The API¶

class SimPEG.regularization.Sparse(*args, **kwargs)[source]

The regularization is:

$R(m) = \frac{1}{2}\mathbf{(m-m_\text{ref})^\top W^\top R^\top R W(m-m_\text{ref})}$

where the IRLS weight

$R = \eta TO FINISH LATER!!!$

So the derivative is straight forward:

$R(m) = \mathbf{W^\top R^\top R W (m-m_\text{ref})}$

The IRLS weights are recomputed after each beta solves. It is strongly recommended to do a few Gauss-Newton iterations before updating.

Required Properties:

• alpha_s (Float): smallness weight, a float, Zero or Identity

• alpha_x (Float): weight for the first x-derivative, a float, Zero or Identity

• alpha_xx (Float): weight for the second x-derivative, a float, Zero or Identity

• alpha_y (Float): weight for the first y-derivative, a float, Zero or Identity

• alpha_yy (Float): weight for the second y-derivative, a float, Zero or Identity

• alpha_z (Float): weight for the first z-derivative, a float, Zero or Identity

• alpha_zz (Float): weight for the second z-derivative, a float, Zero or Identity

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• eps_p (Float): Threshold value for the model norm, a float

• eps_q (Float): Threshold value for the model gradient norm, a float

• gradientType (String): type of gradient, a unicode string, Default: components

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• model (Array): current model, a list or numpy array of <class ‘float’> with shape (*)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• norms (Array): Norms used to create the sparse regularization, a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *), Default: [[2. 2. 2. 2.]]

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Float): function scaling applied inside the norm, a float, Default: 1.0

• scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

• scales (Array): General nob for scaling, a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *), Default: [[1. 1. 1. 1.]]

• space (String): type of model, a unicode string, Default: linear

property norms

norms (Array): Norms used to create the sparse regularization, a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *), Default: [[2. 2. 2. 2.]]

property eps_p

eps_p (Float): Threshold value for the model norm, a float

property eps_q

eps_q (Float): Threshold value for the model gradient norm, a float

property model

model (Array): current model, a list or numpy array of <class ‘float’> with shape (*)

property space

space (String): type of model, a unicode string, Default: linear

gradientType (String): type of gradient, a unicode string, Default: components

property scales

scales (Array): General nob for scaling, a list or numpy array of <class ‘float’>, <class ‘int’> with shape (*, *), Default: [[1. 1. 1. 1.]]

property scaledIRLS

scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

l2model = None
class SimPEG.regularization.SparseSmall(*args, **kwargs)[source]

Sparse smallness regularization

Inputs

param int norm

norm on the smallness

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• epsilon (Float): Threshold value for the model norm, a float, Default: 0.001

• gradientType (String): type of gradient, a unicode string, Default: components

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• model (Array): current model, a list or numpy array of <class ‘float’> with shape (*)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• norm (Array): norm used, a list or numpy array of <class ‘float’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Array): General nob for scaling, a list or numpy array of <class ‘float’> with shape (*)

• scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

• space (String): By default inherit the objctive, a unicode string, Default: linear

property scaledIRLS

scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

property f_m
property W
R(f_m)[source]
deriv(m)[source]

The regularization is:

$R(m) = \frac{1}{2}\mathbf{(m-m_\text{ref})^\top W^\top W(m-m_\text{ref})}$

So the derivative is straight forward:

$R(m) = \mathbf{W^\top W (m-m_\text{ref})}$
class SimPEG.regularization.SparseDeriv(*args, **kwargs)[source]

Base Class for sparse regularization on first spatial derivatives

Required Properties:

• cell_weights (Array): regularization weights applied at cell centers, a list or numpy array of <class ‘float’> with shape (*)

• epsilon (Float): Threshold value for the model norm, a float, Default: 0.001

• gradientType (String): type of gradient, a unicode string, Default: components

• indActive (Array): indices of active cells in the mesh, a list or numpy array of <class ‘bool’>, <class ‘int’> with shape (*)

• mapping (IdentityMap): mapping which is applied to model in the regularization, an instance of IdentityMap, Default: IdentityMap(,)

• model (Array): current model, a list or numpy array of <class ‘float’> with shape (*)

• mref (Array): reference model, a numpy, Zero or Identity array of <class ‘float’>, <class ‘int’> with shape (*)

• mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

• norm (Array): norm used, a list or numpy array of <class ‘float’> with shape (*)

• regmesh (RegularizationMesh): regularization mesh, an instance of RegularizationMesh

• scale (Array): General nob for scaling, a list or numpy array of <class ‘float’> with shape (*)

• scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

• space (String): By default inherit the objctive, a unicode string, Default: linear

property mrefInSmooth

mrefInSmooth (Boolean): include mref in the smoothness calculation?, a boolean, Default: False

property scaledIRLS

scaledIRLS (Boolean): Scale the gradients of the IRLS norms, a boolean, Default: True

R(f_m)[source]
deriv(m)[source]

The regularization is:

$R(m) = \frac{1}{2}\mathbf{(m-m_\text{ref})^\top W^\top W(m-m_\text{ref})}$

So the derivative is straight forward:

$R(m) = \mathbf{W^\top W (m-m_\text{ref})}$
property f_m
property cellDiffStencil
property W
property length_scales

Normalized cell based weighting