| Title: | Robust Singular Value Decomposition using Density Power Divergence |
|---|---|
| Description: | Computing singular value decomposition with robustness is a challenging task. This package provides an implementation of computing robust SVD using density power divergence (<doi:10.48550/arXiv.2109.10680>). It combines the idea of robustness and efficiency in estimation based on a tuning parameter. It also provides utility functions to simulate various scenarios to compare performances of different algorithms. |
| Authors: | Subhrajyoty Roy [aut, cre] |
| Maintainer: | Subhrajyoty Roy <[email protected]> |
| License: | MIT + file LICENSE |
| Version: | 1.0.1 |
| Built: | 2026-05-18 08:13:38 UTC |
| Source: | https://github.com/subroy13/rsvddpd |
AddOutlier returns a matrix with outliers randomly added to a matrix
given certain proportion of contamination
AddOutlier(X, proportion, value, seed = NULL, method = "element")AddOutlier(X, proportion, value, seed = NULL, method = "element")
X |
|
proportion |
|
value |
|
seed |
|
method |
|
A matrix with elements / rows / columns contaminated.
Due to randomization, it is possible that the none of the entries of the matrix become contaminated. In that case, it is recommended to use different seed value.
X = matrix(1:20, nrow = 4, ncol = 5) AddOutlier(X, 0.5, 10, seed = 1234)X = matrix(1:20, nrow = 4, ncol = 5) AddOutlier(X, 0.5, 10, seed = 1234)
cv.alpha returns the optimal robustness parameter
cv.alpha(X, alphas = 10)cv.alpha(X, alphas = 10)
X |
|
alphas |
|
A list containing
The choices of the robust parameters.
Corresponding cross validation score.
Best choice of the robustness parameter.
S. Roy, A. Basu and A. Ghosh (2021), A New Robust Scalable Singular Value Decomposition Algorithm for Video Surveillance Background Modelling https://arxiv.org/abs/2109.10680
rank.rSVDdpd estimates the optimal rank of a given matrix under
robust SVD using Density Power Divergence (DPD) criteria.
rank.rSVDdpd(X, alpha = 0.5, maxrank = NULL)rank.rSVDdpd(X, alpha = 0.5, maxrank = NULL)
X |
|
alpha |
|
maxrank |
|
The function computes three penalized criteria for rank determination:
DIC — Divergence Information Criterion.
RCC — Robust Cross-Validation Criterion.
DICMR — Modified Divergence Information Criterion with Matrix Rank penalty (recommended).
The function computes a full robust SVD (up to maxrank) using
rSVDdpd. It then evaluates the DPD divergence at different
candidate ranks and applies penalty adjustments for model complexity.
The final estimated rank minimizes the penalized criterion.
A named integer vector of length 3, giving the estimated ranks according to each criterion:
DIC — estimated rank from DIC.
RCC — estimated rank from RCC.
DICMR — estimated rank from DICMR (recommended).
X <- matrix(rnorm(100), 10, 10) rank.rSVDdpd(X, alpha = 0.3, maxrank = 5)X <- matrix(rnorm(100), 10, 10) rank.rSVDdpd(X, alpha = 0.3, maxrank = 5)
rSVDdpd returns the singular value decomposition of a matrix with robust
singular values in presence of outliers
rSVDdpd( X, alpha, nd = NA, maxrank = NA, tol = 1e-04, eps = 1e-04, maxiter = 100L, initu = NULL, initv = NULL )rSVDdpd( X, alpha, nd = NA, maxrank = NA, tol = 1e-04, eps = 1e-04, maxiter = 100L, initu = NULL, initv = NULL )
X |
|
alpha |
|
nd |
|
maxrank |
|
tol |
|
eps |
|
maxiter |
|
initu |
|
initv |
|
The usual singular value decomposition is highly prone to error in
presence of outliers, since it tries to minimize the norm of the errors
between the matrix and its best lower rank approximation. While there is
considerable effort to impose robustness using norm of the errors instead
of norm, such estimation lacks efficiency. Application of density power
divergence bridges the gap.
The parameter alpha should be between 0 and 1, if not, then a warning is shown.
Lower alpha means less robustness
but more efficiency in estimation, while higher alpha means high robustness but
less efficiency in estimation. The recommended value of alpha is 0.3.
The function tries to obtain the best rank one approximation of a matrix by minimizing
this density power divergence of the true errors with that of a normal distribution centered
at the origin.
A list containing different components of the decomposition
d - The robust singular values, namely the diagonal entries of .
u - The matrix of left singular vectors . Each column is a singular vector.
v - The matrix of right singular vectors . Each column is a singular vector.
S. Roy, A. Basu and A. Ghosh (2021), A New Robust Scalable Singular Value Decomposition Algorithm for Video Surveillance Background Modelling https://arxiv.org/abs/2109.10680
X = matrix(1:20, nrow = 4, ncol = 5) rSVDdpd(X, alpha = 0.3)X = matrix(1:20, nrow = 4, ncol = 5) rSVDdpd(X, alpha = 0.3)
simSVD simulates various models for the errors in the data matrix, and summarize
performance of a singular value decomposition algorithm under presence or absence of
outlying data introduced through various outlying schemes, using Monte Carlo approach.
simSVD( trueSVD, svdfun, B = 100, seed = NULL, dist = "normal", tau = 0.95, outlier = FALSE, out_method = "element", out_value = 10, out_prop = 0.1, return_details = FALSE, ... )simSVD( trueSVD, svdfun, B = 100, seed = NULL, dist = "normal", tau = 0.95, outlier = FALSE, out_method = "element", out_value = 10, out_prop = 0.1, return_details = FALSE, ... )
trueSVD |
|
svdfun |
|
B |
|
seed |
|
dist |
|
tau |
|
outlier |
|
out_method |
|
out_value |
|
out_prop |
a |
return_details |
|
... |
extra arguments to be passed to |
Based on whether return_details is TRUE or FALSE, returns a list with two or one components.
Simulations :
Lambda - A matrix containing obtained singular values from all Monte Carlo Simulations.
Left - A matrix containing the dissimilarities between left singular vectors of true SVD and obtained SVD.
Right - A matrix containing the dissimilarities between right singular vectors of true SVD and obtained SVD.
Summary :
Bias - A numeric vector showing biases of the singular vectors obtained by svdfun algorithm.
MSE - A numeric vector showing MSE of the singular vectors obtained by svdfun algorithm.
Variance - A numeric vector showing variances of the singular vectors obtained by svdfun algorithm.
Left - A numeric vector showing average dissimilarities between true and estimated left singular vectors.
Right - A numeric vector showing average dissimilarities between true and estimated right singular vectors.
If return_details is FALSE, only Summary component of the larger list is returned.