This is a tool for optimization of two random matrix models; compound Wishart model and signal-plus-noise (information-plus-noise) model.
The compound Wishart model is
We consider a signal-plus-noise random matrices as follows:
for a given
If
Our algorithm is based on the paper "Cauchy noise loss for stochastic optimization of random matrix models via free deterministic equivalents (https://arxiv.org/abs/1804.03154)".
python 3.6, cython, numpy, scipy, tqdm, matplotlib. We recommend to use the platform Anaconda.
$ git clone https://github.com/ThayaFluss/cnl.git
$ bash setup.bash
cd src
python -m unittest tests/*.py
cd src
For the probabilistic singular value decomposition based on Cauchy noise loss;
X #numpy.array of shape [p,d]
from psvd import *
U,D,V, sigma = psvd_cnl(X)
For the rank estimation of
X #numpy.array of shape [p,d]
from psvd import *
rank, a, sigma = rank_estimation(X) #estimated rank and parameters a, sigma.
For example; (https://github.com/ThayaFluss/cnl/blob/master/demo_rank_estimation.py)
p_dim = 100
dim = 50
min_singular = 0.3
true_rank = 30
import numpy as np
a_true = np.random.uniform(min_singular, 1, dim)
for i in range(dim-true_rank):
a_true[i] = 0
from matrix_util import *
D = rectangular_diag(a_true, p_dim=p_dim, dim=dim)
from random_matrices import *
U = haar_unitary(p_dim)
V = haar_unitary(dim)
A_true = U @ D @ V ; #random rotation
X = signal_plus_noise(A_true, sigma=0.1) ### sample matrix
from psvd import *
rank, a, sigma = rank_estimation(X) ### estimated rank and parameters
print(rank, true_rank) ### compare with the true_rank !
To validate algorithms in the same way as the numerical experiments in the paper;
git checkout arXiv1804
cd src
$ python validate_train_sc.py
$ python validate_train_cw.py