View source: R/hard_threshold.R
hard_threshold | R Documentation |
hard_threshold()
implements the hard-thresholding operator on a given
matrix D
, making D
sparser: elements of D
whose absolute value are less
than a given threshold thresh
are set to 0, i.e. D[|D| < thresh] = 0
.
This is used in the non-convex PCP function rrmc()
to provide a non-convex
replacement for the prox_l1()
method used in the convex PCP function
root_pcp()
. It is used to iteratively model the sparse S
matrix with the
help of an adaptive threshold (thresh
changes over the course of
optimization).
hard_threshold(D, thresh)
D |
The input data matrix. |
thresh |
The scalar-valued hard-threshold acting on |
The hard-thresholded matrix.
set.seed(42)
D <- matrix(rnorm(25), 5, 5)
S <- hard_threshold(D, thresh = 1)
D
S
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.