GroupL2SoftThresholding#
- class mrinufft.trajectories.GroupL2SoftThresholding(shape: tuple[int, ...], alphas: ndarray[tuple[int, ...], dtype[_ScalarType_co]])[source]#
Bases:
ProxOperatorGroup L2 Soft Thresholding (Shrinkage) Operator.
This operator applies a soft-thresholding on the L2 norm of vectors grouped along the last dimension. It is effectively the proximal operator of the Group Lasso (L2,1) penalty.
The logic follows: \(y = x * max(0, ||x|| - alpha) / ||x||\)
- Parameters:
Methods
__init__Affine addition
Chain
Gradient of the Moreau envelope of the function.
Postcomposition
Precomposition
Apply the Group L2 Soft Thresholding.
Attributes
Adjoint operator - swaps prox and proxdual
- __call__(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]]) bool[source]#
Evaluate the regularization function value (L2,1 norm weighted by alphas).
Note: This returns the penalty value, not a boolean check.
Note
This function uses
numpyfor all CPU arrays, andcupyfor all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.- Return type:
- prox(x: ndarray[tuple[int, ...], dtype[_ScalarType_co]], tau: float, eps: float = 1e-10) ndarray[tuple[int, ...], dtype[_ScalarType_co]][source]#
Apply the Group L2 Soft Thresholding.
y = x * ( ||x||_2 - (alphas * tau) )_+ / ||x||_2
Note
This function uses
numpyfor all CPU arrays, andcupyfor all on-gpu array. It will convert all its array argument to the respective array library. The outputs will be converted back to the original array module and device.
- _adjoint() _AdjointOperator[source]#
Adjoint operator - swaps prox and proxdual
- Return type:
_AdjointOperator
- affine_addition(v: ndarray[tuple[int, ...], dtype[number]]) ProxOperator[source]#
Affine addition
Adds the dot-product of vector
vand vectorx(which is passed todualorproxdual) to the current function.This method can also be accessed via the
+operator.- Parameters:
v (
numpy.ndarray) – Vector- Return type:
ProxOperator
Notes
The proximal operator of a function \(g=f(\mathbf{x}) + \mathbf{v}^T \mathbf{x}\) is defined as:
\[prox_{\tau g} (\mathbf{x}) = prox_{\tau f} (\mathbf{x} - \tau \mathbf{v})\]
- chain(g: ProxOperator) ProxOperator[source]#
Chain
Chains two proximal operators. This must be used with care only when aware that the combination of two proximal operators can be simply obtained by chaining them
- Parameters:
g (
pyproximal.proximal.ProxOperator) – Rigth operator- Return type:
ProxOperator
Notes
The proximal operator of the chain of two operators is defined as:
\[prox_{\tau f g} (\mathbf{x}) = prox_{\tau g}(prox_{\tau f g}(x))\]
- grad(x: ndarray[tuple[int, ...], dtype[number]]) ndarray[tuple[int, ...], dtype[number]][source]#
Gradient of the Moreau envelope of the function.
This method is only called if the user does not provide a gradient because the function is not differentiable. In this case, the gradient of the Moreau envelope of the function is computed instead:
\[\nabla_\mathbf{x} M_{\sigma f) = \frac{1}{sigma} (\mathbf{x} - \prox_{\sigma f}(\mathbf{x}))\]- Parameters:
x (
numpy.ndarray) – Vector- Returns:
g – Gradient vector
- Return type:
- postcomposition(sigma: float) ProxOperator[source]#
Postcomposition
Multiplies a scalar
sigmato the current function.This method can also be accessed via the
*operator.- Parameters:
sigma (
float) – Scalar- Return type:
ProxOperator
Notes
The proximal operator of a function \(g= \sigma f(\mathbf{x})\) is defined as:
\[prox_{\tau g} (\mathbf{x}) = prox_{\sigma \tau f} (\mathbf{x})\]
- precomposition(a: float, b: float | ndarray[tuple[int, ...], dtype[number]]) ProxOperator[source]#
Precomposition
Multiplies and add scalars
aandbtoxwhen evaluating the proximal function- Parameters:
- Return type:
ProxOperator
Notes
The proximal operator of a function \(g= f(a \mathbf{x} + b)\) is defined as:
\[prox_{\tau g} (\mathbf{x}) = \frac{1}{a} ( prox_{a^2 \tau f} (a \mathbf{x} + b) - b)\]