Contents
Clean Slate
clear all
clc
setup_MC
Generate the Unknown Low Rank Matrix
M = 500;
L = 500;
N = 4;
A = randn(M,N);
X = randn(N,L);
Z = A*X;
error_function = @(qval) 20*log10(norm(qval - Z,'fro') / norm(Z,'fro'));
AWGN Noise
SNR = 50;
nuw = norm(reshape(Z,[],1))^2/M/L*10^(-SNR/10);
Y = Z + sqrt(nuw)*randn(size(Z));
Observe a fraction of the noisy matrix entries
p1 = 0.3;
omega = false(M,L);
ind = randperm(M*L);
omega(ind(1:ceil(p1*M*L))) = true;
Y(~omega) = 0;
Define options for BiG-AMP
opt = BiGAMPOpt;
if p1 <= 0.2
opt.sparseMode = 1;
end
opt.error_function = error_function;
problem = BiGAMPProblem();
problem.M = M;
problem.N = N;
problem.L = L;
[problem.rowLocations,problem.columnLocations] = find(omega);
Specify Prior objects for BiG-AMP
gX = AwgnEstimIn(0, 1);
gA = AwgnEstimIn(0, 1);
if opt.sparseMode
gOut = AwgnEstimOut(reshape(Y(omega),1,[]), nuw);
else
gOut = AwgnEstimOut(Y, nuw);
end
Run BiG-AMP
results = [];
disp('Starting BiG-AMP')
tstart = tic;
[estFin,~,estHist] = ...
BiGAMP(gX, gA, gOut, problem, opt);
tGAMP = toc(tstart);
loc = length(results) + 1;
results{loc}.name = 'BiG-AMP';
results{loc}.err = estHist.errZ(end);
results{loc}.time = tGAMP;
results{loc}.errHist = estHist.errZ;
results{loc}.timeHist = estHist.timing;
Starting BiG-AMP
Run EM-BiG-AMP
disp('Starting EM-BiG-AMP')
disp(['The true value of nuw was ' num2str(nuw)])
tstart = tic;
[estFin,~,~,estHist] = ...
EMBiGAMP_MC(Y,problem,opt);
tGAMP = toc(tstart);
loc = length(results) + 1;
results{loc}.name = 'EM-BiG-AMP';
results{loc}.err = opt.error_function(estFin.Ahat*estFin.xhat);
results{loc}.time = tGAMP;
results{loc}.errHist = estHist.errZ;
results{loc}.timeHist = estHist.timing;
Starting EM-BiG-AMP
The true value of nuw was 3.9111e-05
It 0001 nuX = 9.676e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 3.870e-02 SNR = 20.00 Error = -57.1047 numIt = 0030
It 0002 nuX = 1.629e-01 meanX = 0.000e+00 tol = 1.070e-05 nuw = 4.174e-05 SNR = 49.71 Error = -62.5965 numIt = 0030
It 0003 nuX = 1.631e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.689e-05 SNR = 50.25 Error = -62.5963 numIt = 0031
It 0004 nuX = 1.631e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.887e-05 SNR = 50.25 Error = -62.5967 numIt = 0031
Run EM-BiG-AMP with rank learning using rank contraction
problem.N = [];
disp('Starting EM-BiG-AMP with rank contraction')
disp(['Note that the true rank was ' num2str(N)])
tstart = tic;
[estFin,~,~,estHist] = ...
EMBiGAMP_MC(Y,problem,opt);
tGAMP = toc(tstart);
loc = length(results) + 1;
results{loc}.name = 'EM-BiG-AMP (Rank Contraction)';
results{loc}.err = error_function(estFin.Ahat*estFin.xhat);
results{loc}.time = tGAMP;
results{loc}.errHist = estHist.errZ;
results{loc}.timeHist = estHist.timing;
results{loc}.rank = size(estFin.xhat,1);
Starting EM-BiG-AMP with rank contraction
Note that the true rank was 4
It 0001 nuX = 4.778e-02 meanX = 0.000e+00 tol = 1.000e-04 nuw = 3.870e-02 SNR = 20.00 Error = -21.5452 numIt = 0050
Updating rank estimate from 81 to 4 on iteration 1
It 0002 nuX = 4.457e-02 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.481e-02 SNR = 21.28 Error = -57.5846 numIt = 0062
It 0003 nuX = 2.154e-01 meanX = 0.000e+00 tol = 1.048e-05 nuw = 4.088e-05 SNR = 49.80 Error = -62.5965 numIt = 0030
It 0004 nuX = 2.156e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.689e-05 SNR = 50.25 Error = -62.5964 numIt = 0031
It 0005 nuX = 2.156e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.887e-05 SNR = 50.25 Error = -62.5967 numIt = 0031
Run EM-BiG-AMP with rank learning using penalized log-likelihood maximization
opt.nit = 250;
EMopt.maxEMiter = 200;
EMopt.maxEMiterInner = 5;
EMopt.learnRank = 1;
disp('Starting EM-BiG-AMP with rank learning using penalized log-likelihood maximization')
disp(['Note that the true rank was ' num2str(N)])
tstart = tic;
[estFin,~,~,estHist] = ...
EMBiGAMP_MC(Y,problem,opt,EMopt);
tGAMP = toc(tstart);
loc = length(results) + 1;
results{loc}.name = 'EM-BiG-AMP (pen. log-like)';
results{loc}.err = error_function(estFin.Ahat*estFin.xhat);
results{loc}.time = tGAMP;
results{loc}.errHist = estHist.errZ;
results{loc}.timeHist = estHist.timing;
results{loc}.rank = size(estFin.xhat,1);
Starting EM-BiG-AMP with rank learning using penalized log-likelihood maximization
Note that the true rank was 4
It 0001 nuX = 3.870e+00 meanX = 0.000e+00 tol = 1.000e-04 nuw = 3.870e-02 SNR = 20.00 Error = -1.4718 numIt = 0250
It 0002 nuX = 1.299e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.743e+00 SNR = -3.73 Error = -1.4684 numIt = 0115
It 0003 nuX = 3.393e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.748e+00 SNR = -4.29 Error = -1.4702 numIt = 0047
It 0004 nuX = 4.685e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.746e+00 SNR = -4.13 Error = -1.4704 numIt = 0040
It 0005 nuX = 5.238e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.746e+00 SNR = -4.09 Error = -1.4705 numIt = 0031
Increasing rank to 2 AICc was -7.777e+04
It 0006 nuX = 5.399e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 2.766e+00 SNR = -4.07 Error = -3.4393 numIt = 0250
It 0007 nuX = 7.535e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 1.700e+00 SNR = 0.78 Error = -3.4423 numIt = 0047
It 0008 nuX = 7.741e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 1.697e+00 SNR = 0.95 Error = -3.4423 numIt = 0030
It 0009 nuX = 7.839e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 1.741e+00 SNR = 0.95 Error = -3.4424 numIt = 0030
Increasing rank to 3 AICc was -4.377e+04
It 0010 nuX = 8.092e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 1.742e+00 SNR = 0.95 Error = -6.6647 numIt = 0146
It 0011 nuX = 8.332e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 7.847e-01 SNR = 5.79 Error = -6.6681 numIt = 0046
It 0012 nuX = 8.427e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 7.832e-01 SNR = 5.92 Error = -6.6681 numIt = 0030
It 0013 nuX = 8.450e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 8.143e-01 SNR = 5.92 Error = -6.6681 numIt = 0031
Increasing rank to 4 AICc was 1.210e+04
It 0014 nuX = 8.475e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 8.155e-01 SNR = 5.91 Error = -36.3865 numIt = 0058
It 0015 nuX = 6.939e-01 meanX = 0.000e+00 tol = 1.000e-04 nuw = 8.331e-04 SNR = 36.60 Error = -62.5929 numIt = 0030
It 0016 nuX = 6.985e-01 meanX = 0.000e+00 tol = 9.438e-06 nuw = 3.689e-05 SNR = 50.25 Error = -62.5909 numIt = 0030
It 0017 nuX = 6.986e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.951e-05 SNR = 50.25 Error = -62.5964 numIt = 0031
Increasing rank to 5 AICc was 7.572e+05
It 0018 nuX = 6.986e-01 meanX = 0.000e+00 tol = 9.437e-06 nuw = 3.900e-05 SNR = 50.25 Error = -62.2079 numIt = 0030
It 0019 nuX = 5.588e-01 meanX = 0.000e+00 tol = 9.296e-06 nuw = 3.898e-05 SNR = 50.32 Error = -62.1116 numIt = 0031
Terminating, AICc was 7.563e+05, estimated rank was 4
Show Results
plotUtilityNew(results,[-100 0],200,201)
results{:}
ans =
name: 'BiG-AMP'
err: -62.5967
time: 1.7452
errHist: [52x1 double]
timeHist: [52x1 double]
ans =
name: 'EM-BiG-AMP'
err: -62.5967
time: 3.6378
errHist: [122x1 double]
timeHist: [122x1 double]
ans =
name: 'EM-BiG-AMP (Rank Contraction)'
err: -62.5967
time: 6.2815
errHist: [204x1 double]
timeHist: [204x1 double]
rank: 4
ans =
name: 'EM-BiG-AMP (pen. log-like)'
err: -62.5964
time: 40.5503
errHist: [1303x1 double]
timeHist: [1303x1 double]
rank: 4