optimal_SVHT_coef: Optimal Hard Threshold for Singular Values

View source: R/optimal_SVHT_coef.R

optimal_SVHT_coefR Documentation

Optimal Hard Threshold for Singular Values

Description

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.

Usage

optimal_SVHT_coef(beta, sigma_known = FALSE)

Arguments

beta

A single value or a vector that represents aspect ratio m/n of the matrix to be denoised. 0<beta<=1.

sigma_known

A logical value. TRUE if noise level known, FALSE if unknown.

Value

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].

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

## 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)

RobertGM111/havok documentation built on July 8, 2023, 8:23 p.m.