Norm operators class hierarchy¶
Base class¶
-
class
pyunlocbox.functions.
norm
(lambda_=1, w=1, **kwargs)[source]¶ Bases:
pyunlocbox.functions.func
Base class which defines the attributes of the norm objects.
See generic attributes descriptions of the
pyunlocbox.functions.func
base class.Parameters: lambda_ : float, optional
Regularization parameter \(\lambda\). Default is 1.
w : array_like, optional
Weights for a weighted norm. Default is 1.
L1-norm¶
-
class
pyunlocbox.functions.
norm_l1
(**kwargs)[source]¶ Bases:
pyunlocbox.functions.norm
L1-norm function object.
See generic attributes descriptions of the
pyunlocbox.functions.norm
base class. Note that the constructor takes keyword-only parameters.Notes
- The L1-norm of the vector x is given by \(\lambda \|w \cdot (A(x)-y)\|_1\).
- The L1-norm proximal operator evaluated at x is given by \(\operatorname{arg\,min}\limits_z \frac{1}{2} \|x-z\|_2^2 + \gamma \|w \cdot (A(z)-y)\|_1\) where \(\gamma = \lambda \cdot T\). This is simply a soft thresholding.
Examples
>>> import pyunlocbox >>> f = pyunlocbox.functions.norm_l1() >>> f.eval([1, 2, 3, 4]) 10 >>> f.prox([1, 2, 3, 4], 1) array([ 0., 1., 2., 3.])
L2-norm¶
-
class
pyunlocbox.functions.
norm_l2
(**kwargs)[source]¶ Bases:
pyunlocbox.functions.norm
L2-norm function object.
See generic attributes descriptions of the
pyunlocbox.functions.norm
base class. Note that the constructor takes keyword-only parameters.Notes
- The squared L2-norm of the vector x is given by \(\lambda \|w \cdot (A(x)-y)\|_2^2\).
- The squared L2-norm proximal operator evaluated at x is given by \(\operatorname{arg\,min}\limits_z \frac{1}{2} \|x-z\|_2^2 + \gamma \|w \cdot (A(z)-y)\|_2^2\) where \(\gamma = \lambda \cdot T\).
- The squared L2-norm gradient evaluated at x is given by \(2 \lambda \cdot At(w \cdot (A(x)-y))\).
Examples
>>> import pyunlocbox >>> f = pyunlocbox.functions.norm_l2() >>> x = [1, 2, 3, 4] >>> f.eval(x) 30 >>> f.prox(x, 1) array([ 0.33333333, 0.66666667, 1. , 1.33333333]) >>> f.grad(x) array([2, 4, 6, 8])