Learn R Programming

ShiVa (version 1.0.1)

soft_thresholding: Soft Thresholding

Description

Applies the soft thresholding operation to a numeric input, commonly used in Lasso and sparse modeling to induce shrinkage and sparsity.

Usage

soft_thresholding(z, lambda)

Value

A numeric value after applying soft thresholding: \(\text{sign}(z) \cdot \max(|z| - \lambda, 0)\).

Arguments

z

A numeric value to be thresholded.

lambda

A non-negative numeric value indicating the threshold level (degree of shrinkage).