Sparse Deconvolution
Sparse Deconvolution
http://eeweb.poly.edu/iselesni/lecture_notes/
Contents
Start
Create spike signal
Create observed signal
Create convolution matrix H
Least square solution
Verify banded system solver
Sparse deconvolution - L1 norm penalty
Verify optimality conditions
Sparse deconvolution - nn garrote penalty
Verify (local) optimality conditions
Comparison
Start
close all
clear
randn('state',0); % set state so that example can be reproduced
figure(1)
clf
subplot(2,1,1)
stem(s, 'marker', 'none')
box off
title('Sparse signal');
ylim1 = [-1.5 2.5];
ylim(ylim1)
printme('original')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 1/11
4/18/2019 Example: Sparse deconvolution
The simulated observed signal is obtained by convolving the signal with a 4-point impulse
response and adding noise.
figure(2)
clf
subplot(2,1,1)
plot(y)
box off
xlim([0 M])
title('Observed signal');
printme('observed')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 2/11
4/18/2019 Example: Sparse deconvolution
Create the convolution matrix H using Matlab sparse matrix functions 'sparse' and 'spdiags'.
By making H a sparse matrix: - less memory is used, - multiplying vectors by H is faster, -
fast algorithms for solving banded systems will be used.
H = sparse(M,N);
e = ones(N,1);
for i = 0:L-1
H = H + spdiags(h(i+1)*e, -i, M, N); % H : convolution matrix (sparse)
end
issparse(H) % confirm that H is a sparse matrix
ans =
Maximum error = 0
Display structure of convolution matrix. Note that the matrix is banded (sparse).
figure(1)
clf
spy(H(1:24,1:21))
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 3/11
4/18/2019 Example: Sparse deconvolution
figure(2)
clf
subplot(2,1,1)
stem(x_L2, 'marker', 'none')
box off
title('Deconvolution (least square solution)');
axnote(sprintf('RMSE = %.4f', rmse_L2))
printme('L2')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 4/11
4/18/2019 Example: Sparse deconvolution
Verify that MATLAB calls LAPACKS's fast algorithm for solving banded systems
% Diagnostic output:
%
% sp\: bandwidth = 3+1+3.
% sp\: is A diagonal? no.
% sp\: is band density (1.00) > bandden (0.50) to try banded solver? yes.
% sp\: is LAPACK's banded solver successful? yes.
lam = T;
Nit = 50;
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 5/11
4/18/2019 Example: Sparse deconvolution
figure(1)
clf
plot(1:Nit, cost1, '.-')
title('Cost function history');
xlabel('Iteration')
xlim([0 Nit])
box off
printme('CostFunction_L1')
The L1 solution is quite similar to the original signal (much more so than the least square
solution).
figure(2)
clf
subplot(2,1,1)
stem(x1, 'marker', 'none')
box off
ylim(ylim1);
title('Deconvolution (L1 norm penalty)');
axnote(sprintf('RMSE = %.4f', rmse1))
printme('L1')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 6/11
4/18/2019 Example: Sparse deconvolution
v1 = H'*(y-H*x1);
figure(1)
clf
plot(x1, v1, '.')
line(t, dphi_L1(t), 'linestyle', ':')
box off
ylim([-1 1]*lam*1.5)
xlabel('x')
ylabel('H^T(y - Hx)')
title('Optimality scatter plot - L1 penalty');
printme('scatter_L1')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 7/11
4/18/2019 Example: Sparse deconvolution
figure(1)
clf
plot(1:Nit, cost2, '.-')
title('Cost function history');
xlabel('Iteration')
xlim([0 Nit])
box off
printme('CostFunction_garrote')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 8/11
4/18/2019 Example: Sparse deconvolution
figure(2)
clf
subplot(2,1,1)
stem(x2, 'marker', 'none')
box off
ylim(ylim1);
title('Deconvolution (nn-garrote)');
axnote(sprintf('RMSE = %.4f', rmse2))
printme('garrote')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 9/11
4/18/2019 Example: Sparse deconvolution
v2 = H'*(y-H*x2);
figure(1)
clf
plot(x2, v2, '.')
line(t, dphi(t), 'linestyle', ':')
box off
ylim([-1 1]*T*1.5)
xlim(t([1 end]))
xlabel('x')
ylabel('H^T(y - Hx)')
title('(local) optimality scatter plot - nn garrote penalty');
printme('scatter_garrote')
Comparison
The nn garrote penalty is more accurate than the L1 norm penalty. The result obtained using
the L1 norm penalty is attenuated compared with the true signal.
n = 1:N;
figure(1)
clf
subplot(3,1,[1 2])
plot(n(k), s(k), 'o')
hold on
plot(n(k2), x2(k2),'+', n(k1), x1(k1),'x')
line([0 N], [0 0])
hold off
xlim([0 N])
legend('true', 'nn garrote', 'L1', 'location', 'se')
box off
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 10/11
4/18/2019 Example: Sparse deconvolution
xlabel('n')
ylabel('x(n)')
printme('compare')
http://eeweb.poly.edu/iselesni/lecture_notes/sparse_penalties/html/Example.html 11/11