资源简介
杜克大学的Bayesian Compressive Sensing代码完整版。
代码片段和文件信息
function [weightsusedsigma2errbarsbasis] = BCS_fast_rvm(PHItsigma2etaadaptiveoptimalscale)
%------------------------------------------------------------------
% The BCS algorithm for the following paper:
% “Bayesian Compressive Sesning“ (Preprint 2007). The algorithm
% adopts from the fast RVM algorithm [Tipping & Faul 2003].
% Coded by: Shihao Ji ECE Duke University
% last change: Jan. 2 2007
% You are suggested to use mt_CS.m for improved robustness
%------------------------------------------------------------------
% Input for BCS:
% PHI: projection matrix
% t: CS measurements
% sigma2: initial noise variance
% If measurement noise exists and/or w is not truely sparse
% then sigma2 = std(t)^2/1e2 (suggested)
% If no measurement noise and w is truely sparse
% then sigma2 = std(t)^2/1e6 (suggested)
% This term is in fact not updated in the implementation to allow
% the fast algorithm. For this reason you are recommended to use
% mt_CS.m in which the noise variance is marginalized.
% eta: threshold(阈值) for stopping the algorithm (suggested value: 1e-8)
% Input for Adaptive CS:
% adaptive: generate basis for adpative CS? (default: 0)
% optimal: use the rigorous implementation of adaptive CS? (default: 1)
% scale: diagonal loading parameter (default: 0.1)
% Output:
% weights: sparse weights
% used: the positions of sparse weights
% sigma2: re-estimated noise variance
% errbars: one standard deviation around the sparse weights
% basis: if adaptive==1 then basis = the next projection vector
%
if nargin < 5 %nargin是用来判断输入变量个数的函数
adaptive = 0;
end
if nargin < 6
optimal = 1;
end
if nargin < 7
scale = 0.1;
end
% find initial alpha
[NM] = size(PHI);
PHIt = PHI‘*t;
PHI2 = sum(PHI.^2)‘;
ratio = (PHIt.^2)./PHI2;
[maxrindex] = max(ratio);%[YU]=max(A):返回行向量Y和U,Y向量记录A的每列的最大值,U向量记录每列最大值的行号。
alpha = PHI2(index)/(maxr-sigma2);
% compute initial mu Sig S Q
phi = PHI(:index);
Hessian = alpha + phi‘*phi/sigma2;
Sig = 1/Hessian;
mu = Sig*PHIt(index)/sigma2;%初始miu的值
left = PHI‘*phi/sigma2;
S = PHI2/sigma2-Sig*left.^2;
Q = PHIt/sigma2-Sig*PHIt(index)/sigma2*left;
%
for count = 1:10000
s = S; q = Q;
s(index) = alpha.*S(index)./(alpha-S(index));
q(index) = alpha.*Q(index)./(alpha-S(index));
theta = q.^2-s;
% choice the next alpha that maximizes marginal likelihood
ml = -inf*ones(1M);
ig0 = find(theta>0);
% index for re-estimate
[irefoowhich] = intersect(ig0index);
if ~isempty(ire)
Alpha = s(ire).^2./theta(ire);
delta = (alpha(which)-Alpha)./(Alpha.*alpha(which));
ml(ire) = Q(ire).^2.*delta./(S(ire).*delta+1)-log(1+S(ire).*delta);
end
% index for adding
iad = setdiff(ig0ire);
if ~isempty(iad)
ml(iad) = (Q(iad).^2-S(iad))./S(iad)+log(S(iad)./(Q(iad).^2));
end
is0 =
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
目录 0 2015-04-28 22:13 BCS_demo\
文件 60254 2007-07-11 10:44 BCS_demo\approx_results.mat
目录 0 2015-04-28 21:28 BCS_demo\BCS_demo\
文件 5605 2015-05-08 22:26 BCS_demo\BCS_fast_rvm.asv
文件 5605 2015-05-08 22:30 BCS_demo\BCS_fast_rvm.m
文件 2431 2015-04-28 22:28 BCS_demo\Fig2.asv
文件 2431 2015-04-28 22:33 BCS_demo\Fig2.m
文件 1259 2007-07-11 10:31 BCS_demo\Fig4_ab.m
文件 3571 2015-04-28 22:28 BCS_demo\l1qc_logbarrier.asv
文件 3571 2015-04-28 22:33 BCS_demo\l1qc_logbarrier.m
文件 4413 2014-04-22 23:09 BCS_demo\l1qc_newton.m
文件 1696 2007-07-11 10:31 BCS_demo\multi_approx_measures.m
文件 1763 2007-07-11 10:31 BCS_demo\multi_optimized_measures.m
文件 1514 2007-07-11 10:31 BCS_demo\multi_random_measures.m
文件 60300 2007-07-11 10:48 BCS_demo\optimized_results.mat
文件 60084 2007-07-11 10:49 BCS_demo\random_results.mat
- 上一篇:ArcGIS10.2批量导出地图
- 下一篇:微信小程序贪吃蛇
相关资源
- Introduction to mmwave Sensing: FMCW Radars
- 压缩感知稀疏贝叶斯算法
- message passing algorithmMessage Passing Algor
- 遥感手册Remote sensing handbook权威高清无
- 4_11_基于压缩感知理论的DOA估计.zip
- RemoteSensing期刊word模板
- Bayesian Data Analysis third edition pdf
- Modeling and Reasoning with Bayesian Networks(
- Compressed Sensing: Theory and Applications(压
- Deep Learning in Remote Sensing A Review.pdf
- bayesian分类器
- Bayesian and HSMM
评论
共有 条评论