def prox_l1(w, alpha):
r"""Proximity operator for l1 norm.
:math:`\\hat{\\alpha}_{l,m} = sign(u_{l,m})\\left||u_{l,m}| - \\alpha \\right|_+`
Parameters
----------
u : ndarray
The vector (of the n-dimensional space) on witch we want
to compute the proximal operator
alpha : float
regularisation parameter
Returns
-------
ndarray : the vector corresponding to the application of the
proximity operator to u
"""
return np.sign(w) * np.maximum(np.abs(w) - alpha, 0.)
评论列表
文章目录