Orthogonal Matching Pursuit(OMP)正交匹配追踪算法学习笔记
作者:互联网
最近学习K-SVD算法的过程中,稀疏编码部分使用了OMP追踪算法,特作此总结。求解问题:其中D是过完备的字典,已经给定,Y是原始信号,X待求。OMP算法的本质思想是:以贪婪迭代的方法选择D的列,使得在每次迭代的过程中所选择的列与当前冗余向量最大程度的相关,从原始信号向量中减去相关部分并反复迭代,只到迭代次数达到稀疏度K,停止迭代。核心算法步骤如下:相关Matlab代码如下:function [A]=OMP(D,X,L); %=============================================% Sparse coding of a group of signals based on a given % dictionary and specified number of atoms to use. % ||X-DA||% input arguments: % D - the dictionary (its columns MUST be normalized).% X - the signals to represent% L - the max. number of coefficients for each signal.% output arguments: % A - sparse coefficient matrix.%=============================================[n,P]=size(X);[n,K]=size(D);for k=1:1:P, a=[]; x=X(:,k); %the kth signal sample residual=x; %initial the residual vector indx=zeros(L,1); %initial the index vector
%the jth iter for j=1:1:L, %compute the inner product proj=D'*residual; %find the max value and its index [maxVal,pos]=max(abs(proj));
%store the index pos=pos(1); indx(j)=pos; %solve the Least squares problem. a=pinv(D(:,indx(1:j)))*x;
%compute the residual in the new dictionary residual=x-D(:,indx(1:j))*a;
%the precision is fill our demand.% if sum(residual.^2) < 1e-6% break;% end end; temp=zeros(K,1); temp(indx(1:j))=a; A(:,k)=sparse(temp);end;return;
http://blog.sciencenet.cn/blog-810210-653094.html
下一篇:如何在64位Matlab中调用C/C++处理大容量数据(largeArrayDims)
%the jth iter for j=1:1:L, %compute the inner product proj=D'*residual; %find the max value and its index [maxVal,pos]=max(abs(proj));
%store the index pos=pos(1); indx(j)=pos; %solve the Least squares problem. a=pinv(D(:,indx(1:j)))*x;
%compute the residual in the new dictionary residual=x-D(:,indx(1:j))*a;
%the precision is fill our demand.% if sum(residual.^2) < 1e-6% break;% end end; temp=zeros(K,1); temp(indx(1:j))=a; A(:,k)=sparse(temp);end;return;
http://blog.sciencenet.cn/blog-810210-653094.html
下一篇:如何在64位Matlab中调用C/C++处理大容量数据(largeArrayDims)
标签:.%,迭代,Orthogonal,residual,indx,OMP,pos,Pursuit 来源: https://blog.csdn.net/zhipao6108/article/details/91491138