View source: R/optimal_SVHT_coef.R
optimal_SVHT_coef | R Documentation |
A function for the calculation of the coefficient determining optimal location of hard threshold for matrix denoising by singular values hard thresholding when noise level is known or unknown. Recreation of MATLAB code by Matan Gavish and David Donoho.
optimal_SVHT_coef(beta, sigma_known = FALSE)
beta |
A single value or a vector that represents aspect ratio m/n of the matrix to
be denoised. 0< |
sigma_known |
A logical value. TRUE if noise level known, FALSE if unknown. |
Optimal location of hard threshold, up the median data singular value (sigma
unknown) or up to sigma*sqrt(n)
(sigma known); a vector of the same dimension
as beta
, where coef[i]
is the coefficient corresponding to beta[i]
.
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.
## Not run:
# Usage in known noise level:
# Given an m-by-n matrix \code{Y} known to be low rank and observed in white noise
# with mean zero and known variance \code{sigma^2}, form a denoised matrix \code{Xhat} by:
sigma <- .2
USV <- svd(Y)
y <- USV$d
y[y < (optimal_SVHT_coef(m/n,1) * sqrt(n) * sigma) ] <- 0
Xhat <- USV$u * diag(y) * t(USV$v)
# Given an m-by-n matrix \code{Y} known to be low rank and observed in white
# noise with mean zero and unknown variance, form a denoised matrix \code{Xhat} by:
USV <- svd(Y)
y <- USV$d
y[y < (optimal_SVHT_coef(m/n,0) * median(y)) ] <- 0
Xhat <- USV$u * diag(y) * t(USV$v)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.