8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s
来源:互联网 发布:mac怎么更新os 编辑:程序博客网 时间:2024/05/22 16:36
OrthogonalMatchingPursuit and orthogonal_mp 实现了一个用来逼近在非零系数的个数上加约束的线性模型的拟合的OMP算法(比如L0 pseudo-norm)
和 Least Angle Regression最小角回归 一样,作为一个前向特征选择方法,OMP可以用一个固定非零的数来逼近最优的解向量:
或者说正交匹配算法可以针对一个特殊的误差而不是一个特殊的非零系数的个数,这一过程可以表达为:
OMP是基于贪婪算法,包括在每一步原子(归一化的向量)与当前残差高度相关。它类似于简单 匹配追踪(MP)方法,但更好的,在每一次迭代中,通过使用的在前一个选择的字典元素的空间的正交投影重新计算残差。
import matplotlib.pyplot as pltimport numpy as npfrom sklearn.linear_model import OrthogonalMatchingPursuitfrom sklearn.linear_model import OrthogonalMatchingPursuitCVfrom sklearn.datasets import make_sparse_coded_signaln_components, n_features = 512, 100n_nonzero_coefs = 17# generate the data#################### y = Xw# |x|_0 = n_nonzero_coefsy, X, w = make_sparse_coded_signal(n_samples=1, n_components=n_components, n_features=n_features, n_nonzero_coefs=n_nonzero_coefs, random_state=0)idx, = w.nonzero()# distort the clean signal##########################y_noisy = y + 0.05 * np.random.randn(len(y))# plot the sparse signal########################plt.figure(figsize=(7, 7))plt.subplot(4, 1, 1)plt.xlim(0, 512)plt.title("Sparse signal")plt.stem(idx, w[idx])# plot the noise-free reconstruction####################################omp = OrthogonalMatchingPursuit(n_nonzero_coefs=n_nonzero_coefs)omp.fit(X, y)coef = omp.coef_idx_r, = coef.nonzero()plt.subplot(4, 1, 2)plt.xlim(0, 512)plt.title("Recovered signal from noise-free measurements")plt.stem(idx_r, coef[idx_r])# plot the noisy reconstruction###############################omp.fit(X, y_noisy)coef = omp.coef_idx_r, = coef.nonzero()plt.subplot(4, 1, 3)plt.xlim(0, 512)plt.title("Recovered signal from noisy measurements")plt.stem(idx_r, coef[idx_r])# plot the noisy reconstruction with number of non-zeros set by CV##################################################################omp_cv = OrthogonalMatchingPursuitCV()omp_cv.fit(X, y_noisy)coef = omp_cv.coef_idx_r, = coef.nonzero()plt.subplot(4, 1, 4)plt.xlim(0, 512)plt.title("Recovered signal from noisy measurements with CV")plt.stem(idx_r, coef[idx_r])plt.subplots_adjust(0.06, 0.04, 0.94, 0.90, 0.20, 0.38)plt.suptitle('Sparse signal recovery with Orthogonal Matching Pursuit', fontsize=16)plt.show()
0 0
- 8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s
- Orthogonal Matching Pursuit(OMP)正交匹配追踪算法
- Orthogonal Matching Pursuit(OMP)正交匹配追踪算法学习笔记
- l1范数最小化求解系数方程_正交匹配追踪法(orthogonal matching pursuit)
- Orthogonal matching pursuit
- 浅谈Matching Pursuit和Orthogonal Matching Pursuit
- 正交匹配追踪OMP
- OMP 正交匹配追踪
- 正交匹配追踪(OMP)算法
- 匹配追踪(Matching pursuit,MP)
- 正交匹配追踪 OMP 算法原理分析
- 正交匹配追踪(OMP)其它改进算法
- 正交匹配追踪(OMP)其它改进算法
- 正交匹配追踪(OMP)与C++代码
- 正交匹配追踪(OMP)其它改进算法
- 正交匹配追踪(OMP)其它改进算法
- 正交的 (orthogonal)
- 稀疏编码中的正交匹配追踪(OMP)与代码
- 分享几个集成了VirtIO驱动 For Windows
- Hbase -ryh
- 关于Fragment与ViewPager交互遇到的问题
- redis的学习
- 贪心----书架
- 8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s
- 一个逗号引发的错误!
- 文艺二叉树
- nyoj 947 Max Xor(字典树)
- Shiro 框架授权
- oracle子查询
- Ext JS MVC Architecture
- Android开发中.9图片的制作
- Android系统进程Zygote启动过程的源代码分析