R/prox.R

Defines functions prox

Documented in prox

prox <-
function(B, threshold, group) {
    B. = B
    for (g in 1:max(group)) {
        SVD = svd(B[group == g, ])
        D = (SVD$d - threshold)*(SVD$d - threshold > 0)
        B.[group == g, ] = SVD$u %*% (D * t(SVD$v))
    }
    B.
}

Try the npmr package in your browser

Any scripts or data that you put into this service are public.

npmr documentation built on May 2, 2019, 3:16 p.m.