资源简介
杜克大学的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批量导出地图
- 下一篇:微信小程序贪吃蛇
相关资源
- Data Analysis A Bayesian Tutorial
- Bayesian Networks With Examples in R280858
- 2-d and 3-d Image Registration: for Medical Re
- Bayesian Networks in R贝叶斯网络的R语言实
- Applied Bayesian Statistics---With R and OpenB
- Polarisation:ApplicationsinRemoteSensing
- Intelligent Sensing Instrumentation and Measur
- Learning Bayesian Networks - Neapolitan R. E..
- Image Analysis Classification and Change Detec
- Image Analysis Classification and Change Detec
- An introduction to compressed sensing
- A First Course in Bayesian Statistical Methods
- GeNie 贝叶斯网络工具
- Bayesian Estimation of DSGE Models
- bayesian modeling using winbugs125504
- Bayesian Computation with R 带详细目录.pd
- Bayesian Programming
- Spectrum sensing.ppt
- Bayesian Networks and Decision Graphs第二版
- 压缩感知基础资料两篇论文,一个p
- Bayesian Reasoning and Machine Learning--配书源
- bayesian networks with examples in r
- Bayesian Networks in R
- 贝叶斯网络 Bayesian Networks经典合集
- 《贝叶斯深度学习:DL与Bayesian原理
- Bayesian Data Analysis Third Edition
- RemoteSensing Digital Image Analysis
- Bayesian Modeling Using WinBUGS
- Bayesian Reasoning and Machine Learning
- Bayesian Methods for Hackers Probabilistic Pro
评论
共有 条评论