This package provides some utilities for robust factorization of matrices, useful for, e.g., matrix completion and denoising.
We try to find the low-rank matrix
L = lowrank(100,10,3)
S = 10sparserandn(100,10)
Ln = L + S
res = rpca(Ln, verbose=false)
@show opnorm(L - res.L)/opnorm(L)
L = lowrank(100,10,3) # A low-rank matrix
D = randn(100,10) # A dense noise matrix
S = 10sparserandn(100,10) # A sparse noise matrix (large noise)
Ln = L + D + S # Ln is the sum of them all
λ = 1/sqrt(maximum(size(L)))
res1 = rpca(Ln, verbose=false)
res2 = rpca(Ln, verbose=false, proxD=SqrNormL2(λ/std(D))) # proxD parameter might need tuning
@show opnorm(L - res1.L)/opnorm(L), opnorm(L - res2.L)/opnorm(L)
rpca
Works very well, uses "The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices", Zhouchen Lin, Minming Chen, Leqin Wu, Yi Ma, https://people.eecs.berkeley.edu/~yima/psfile/Lin09-MP.pdfrpca_fista
requires tuning.rpca_admm
requires tuning.
The rpca
function is the recommended default choice:
rpca(Ln::Matrix; λ=1.0 / √(maximum(size(A))), iters=1000, tol=1.0e-7, ρ=1.5, verbose=false, nonnegL=false, nonnegS=false, nukeA=true)
It solves the following problem:
Reference:
"The Augmented Lagrange Multiplier Method for Exact Recovery of Corrupted Low-Rank Matrices", Zhouchen Lin, Minming Chen, Leqin Wu, Yi Ma, https://people.eecs.berkeley.edu/~yima/psfile/Lin09-MP.pdf
Arguments:
Ln
: Input data matrixλ
: Sparsity regularizationiters
: Maximum number of iterationstol
: Toleranceρ
: Algorithm tuning paramverbose
: Print statusnonnegL
: Hard thresholding on AnonnegS
: Hard thresholding on EproxL
: Defaults toNuclearNorm(1/2)
proxD
: Defaults tonothing
proxS
: Defaults toNormL1(λ))
To speed up convergence you may either increase the tolerance or increase ρ
. Increasing tol
is often the best solution.