资源简介
从杜克大学网站上下载的贝叶斯压缩感知代码,该代码完全可以运行,是学习贝叶斯压缩感知的基础性代码。
代码片段和文件信息
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
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);
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;
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 = setdiff([1:M]ig0);
% index for deleting
[idefoowhich] = intersect(is0inde
属性 大小 日期 时间 名称
----------- --------- ---------- ----- ----
文件 60254 2014-02-25 20:38 bcs_ver0.1\BCS_demo\approx_results.mat
文件 5463 2014-02-25 20:38 bcs_ver0.1\BCS_demo\BCS_fast_rvm.m
文件 2096 2014-02-25 20:38 bcs_ver0.1\BCS_demo\Fig2.m
文件 1259 2014-02-25 20:38 bcs_ver0.1\BCS_demo\Fig4_ab.m
文件 1696 2014-02-25 20:38 bcs_ver0.1\BCS_demo\multi_approx_measures.m
文件 1763 2014-02-25 20:38 bcs_ver0.1\BCS_demo\multi_optimized_measures.m
文件 1514 2014-02-25 20:38 bcs_ver0.1\BCS_demo\multi_random_measures.m
文件 60300 2014-02-25 20:38 bcs_ver0.1\BCS_demo\optimized_results.mat
文件 60084 2014-02-25 20:38 bcs_ver0.1\BCS_demo\random_results.mat
文件 2662 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\Fig2.m
文件 1899 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\Fig3.m
文件 6377 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\mt_CS.m
文件 299828 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_results_25.mat
文件 299942 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_results_50.mat
文件 300077 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_results_75.mat
文件 2569 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_runs_25.m
文件 2602 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_runs_50.m
文件 2602 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo\multi_runs_75.m
文件 2664 2014-02-25 20:38 bcs_ver0.1\README.txt
目录 0 2014-02-25 20:38 bcs_ver0.1\BCS_demo
目录 0 2014-02-25 20:38 bcs_ver0.1\MT_CS_demo
目录 0 2014-02-25 20:38 bcs_ver0.1
----------- --------- ---------- ----- ----
1115651 22
- 上一篇:Indian高光谱遥感数据集
- 下一篇:matlab传染病模型
相关资源
- 模式识别4个实验(matlab)
- 可视化贝叶斯网络建模软件GeNIe2.2用户
- genie 2.0贝叶斯网络软件
- BNT_SLP v1.5
- 贝叶斯网络工具箱Matlab工具包
- FullBNT-1.0.4
- 贝叶斯网络建模工具GeNie2.0安装程序
- 压缩感知经典文章附程序
- 贝叶斯图像处理matlab程序
- 贝叶斯分类器的matlab实现及案例
- 贝叶斯压缩感知matlab函数包
- MATLAB贝叶斯网络工具箱174646
- 基于压缩感知的分布式视频编码框架
- seksgui v1.0.3
- 压缩感知磁共振成像
- 压缩感知CS最全matlab程序,二维三维图
- 机器学习课程设计《基于朴素贝叶斯
- Matlab基于贝叶斯,朴素贝叶斯,最小
- MATLAB贝叶斯网络工具箱FullBNT-1.0.7
- 贝叶斯抠图算法matlab实现
- matlab贝叶斯网络工具箱
- 贝叶斯抠图.zip
- kuaisu稀疏贝叶斯
- 稀疏贝叶斯模型相关向量机
- 贝叶斯分类作业题 matlab
- 基于最小风险贝叶斯决策对细胞异常
- 基于MIG25的正交匹配追踪算法ISAR成像
- MATLAB实现二维信号压缩感知的实现
- 压缩感知算法的matlab仿真源码
- 手写数字识别.贝叶斯分类算法
评论
共有 条评论