资源简介
基于线性Bregman迭代的矩阵补全MATLAB代码实现,其中包含固定步长和变步长的线性Bregman。
代码片段和文件信息
% Comparison of different linearized Bregman approaches on recovering a sparse solution x from Ax = b
% The nonzero entries of x have iid Gaussian random values
% The entries of A are +/- 1 randomly
clear
%% Generate problem data
rand(‘seed‘ 0); randn(‘seed‘ 0);
m = 250; n = 500; % matrix dimension m-by-n
k = 25; % sparsity
A = sign(randn(mn)); % random matrix
x_ref = zeros(n1); % true vector
x_ref(randsample(nk)) = randn(k1); % Gaussian random values
b = A*x_ref; % finish generating equations Ax = b
%% set parameters
alpha = 5*norm(x_refinf); % don‘t need to be exact roughly 1 - 10 times norm(x_refinf) is fine
opts.tol = 1e-6; % stop once norm(Ax-b) opts.maxit = 2000; % run maximally 1000 iterations
opts.x_ref = x_ref;
%% LBreg: fixed stepsize ---
opts.stepsize = 2/alpha/normest(A*A.‘1e-2); % roughly 2/alpha/norm(A)^2
t0 = tic;
[xout] = lbreg_fixedstep(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x - x_ref)/norm(x_ref));
opts = rmfield(opts ‘stepsize‘);
%% LBreg: Barzilai-Borwein and non-montone line search ---
opts.stepsize = 2/alpha/normest(A*A.‘1e-2); % roughly 2/alpha/norm(A)^2
t0 = tic;
[x1out1] = lbreg_bbls(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out1.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x1 - x_ref)/norm(x_ref));
opts = rmfield(opts ‘stepsize‘);
%% LBreg: accelerated no restart ---
t0 = tic;
[x2out2] = lbreg_accelerated(Abalphaopts);
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out2.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x2 - x_ref)/norm(x_ref));
%% LBreg: skip: monotonic gradient scheme ---
opts.reset = 6;
t0 = tic;
[x3out3] = lbreg_accel_w_reset(Abalphaopts); % no restart
time = toc(t0);
fprintf(‘iter = %d time = %4.2e ‘ out3.iter time);
fprintf(‘solution relative error = %4.2e\n‘ norm(x3 - x_ref)/norm(x_ref));
opts = rmfield(opts ‘reset‘);
%% Reporting
figure;
plot(1:out.iter out.hist_obj ‘k-‘ ...
1:out1.iter out1.hist_obj ‘b--‘ ...
1:out2.iter out2.hist_obj ‘g--‘ ...
1:out3.iter out3.hist_obj ‘r--‘ ...
‘LineWidth‘ 2);
legend(‘fixed stepsize‘ ‘BB+line search‘ ‘Nesterov accel‘ ‘Nesterov+skip‘‘Location‘‘SouthEast‘);
title(‘Dual objective‘)
xlabel(‘iteration‘); ylabel(‘dual objective‘);
figure;
semilogy(1:out.iter out.hist_err/norm(x_ref) ‘k-‘ ...
1:out1.iter out1.hist_err/norm(x_ref) ‘b--‘ ...
1:out2.iter out2.hist_err/norm(x_ref) ‘g--‘ ...
1:out3.iter out3.hist_err/norm(x_ref) ‘r--‘ ...
‘LineWidth‘ 2);
legend(‘fixed stepsize‘ ‘BB+line search‘ ‘Nesterov accel‘ ‘Nesterov+skip‘‘Location‘‘NorthEast‘);
title(‘Primal solution relative error‘)
xlabel(‘iteration‘); ylabel(‘||x - x_{ref}||_2/||x_{ref}||_2‘);
%%
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 3090 2018-03-30 21:36 MC_ibreg\comparison_bernoulli_A_test1.m
文件 3096 2018-03-30 21:35 MC_ibreg\comparison_bernoulli_A_test2.m
文件 2986 2018-03-30 21:28 MC_ibreg\comparison_binary_sol_test1.m
文件 2992 2018-03-30 21:27 MC_ibreg\comparison_binary_sol_test2.m
文件 3578 2018-03-30 21:08 MC_ibreg\comparison_matrix_completion.m
文件 3582 2018-04-24 15:02 MC_ibreg\comparison_matrix_completion_3.m
文件 3148 2018-03-30 21:35 MC_ibreg\comparison_pdct_A_test1.m
文件 3154 2018-03-30 21:34 MC_ibreg\comparison_pdct_A_test2.m
文件 1345 2018-04-24 15:04 MC_ibreg\example_binary_sol.m
文件 1401 2018-04-24 15:04 MC_ibreg\example_randn_sol.m
文件 4658 2018-03-30 21:30 MC_ibreg\lbreg_accelerated.m
文件 7110 2018-03-30 21:31 MC_ibreg\lbreg_accel_w_reset.m
文件 5487 2018-03-30 21:02 MC_ibreg\lbreg_bbls.m
文件 3957 2018-03-30 21:00 MC_ibreg\lbreg_fixedstep.m
文件 7463 2018-03-30 21:35 MC_ibreg\lbreg_mtx_accel_w_reset.m
文件 5870 2018-03-30 21:35 MC_ibreg\lbreg_mtx_bbls.m
文件 4293 2018-03-30 21:36 MC_ibreg\lbreg_mtx_fixedstep.m
目录 0 2018-04-24 15:04 MC_ibreg
----------- --------- ---------- ----- ----
67210 18
相关资源
- 灰度均值MATLAB源程序
- matlab如何调用marchingcubes算法
- 惯导-GPS组合导航程序
- paperRaw域CFA模式下的去噪MATLAB code
-
船舶航向PID控制的Simuli
nk仿真 - 基于matlab的车牌分割
- 基于matlab的电话号码识别程序
- DLT算法的MATLAB实现
- 滑模变结构控制MATLAB仿真.zip
- 详细的螺旋桨matlab模型
- ADRC自抗扰控制仿真模型.rar
- 用于图像分割的自适应扩散流活动轮
- 心电信号汉宁窗滤波、中值滤波、数
- 制冷机仿真
- 自适应中值滤波MATLAB
- matlab obj_write
- matlab RGB 色彩空间模型
-
基于Matlab-Simuli
nk的永磁同步电机( - NEDC工况预测
-
MATLAB/simuli
nk模型的仿真 - 基于MATLAB的SAD模板匹配算法
- 匹配滤波器的简单仿真
- 论文研究-MATLAB环境下基于矢量量化的
- 论文研究-基于Matlab和组态王6.02的多步
- 信号与系统MATLAB综合实验-《信号与系
- Matlab有关DCT域音频水印嵌入程序-317
- 最小二乘法辨识一阶系统-lsq.m
- 三相异步电机调压调速仿真-dianji.md
- Matlab的BP神经网络用于分类与回归-B
- matlab气象风玫瑰图-wind_rose.m
评论
共有 条评论