Learn R Programming

decorrelate (version 0.1.6.4)

sv_threshold: Singular value thresholding

Description

Singular value thresholding evaluates the optimal number of singular values to retain

Usage

sv_threshold(n, p, d)

Value

Number of singular values to retain

Arguments

n

number of samples

p

number of features

d

singular values

References

Gavish, M., & Donoho, D. L. (2014). The optimal hard threshold for singular values is 4/sqrt(3). IEEE Transactions on Information Theory, 60(8), 5040-5053.

Examples

Run this code
# simulate data

n <- 500
p <- 5000
Y <- Rfast::matrnorm(n, p, seed = 1)

# SVD
dcmp <- svd(Y)

# how many components to retain
sv_threshold(n, p, dcmp$d)

# in this case the data has no structure, so no components are retained

Run the code above in your browser using DataLab