Utilities¶
Math¶
-
plasticnet.utils.math.soft_thresh(lam, x)[source]¶ Soft thresholding operator. Takes a numpy ndarray of floats and returns and element-wise soft-thesholded version.
Element-wise, the soft-thresholding operator \(S_\lambda(x)\) is given by:
\[\begin{split}S_\lambda(x) = \begin{cases} x + \lambda, & \text{if} \quad x < -\lambda \\ 0 , & \text{if} \quad -\lambda < x < \lambda \\ x - \lambda, & \text{if} \quad x > \lambda \end{cases}\end{split}\]where \(\lambda\) is a scalar tresholding parameter.
Parameters: - lam (float) – threshold value
- x (numpy.ndarray) – array of floats to be soft thresholded
Returns: soft thresholded array of floats
Return type: