Nothing
S_soft = function(z,lambda){
## -----------------------------------------------------------------------------------------------------------------
## The name of the function: S_soft
## -----------------------------------------------------------------------------------------------------------------
## Description:
## Define the soft threshold operator.
## -----------------------------------------------------------------------------------------------------------------
## Required preceding functions or packages: No
## -----------------------------------------------------------------------------------------------------------------
## Input:
## @ z: a float value or a vector, the independent variable.
## @ lambda: a float value, the tuning parameter.
## -----------------------------------------------------------------------------------------------------------------
## Output:
## @ The result of the soft threshold operator.
## -----------------------------------------------------------------------------------------------------------------
norm.z = sqrt(sum(z^2))
if(norm.z!=0){
n.x = 1 - lambda/norm.z
rho = n.x*(n.x > 0)*z
} else{
rho = z
}
return(rho)
}
Any scripts or data that you put into this service are public.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.