svd_soft_thresh <- function(A, lambda) {
tmp <- svd(A)
d_thresh <- pmax(tmp$d - lambda, 0)
ans <- tcrossprod(t(t(tmp$u)*d_thresh),tmp$v)
return(ans)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.