日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s

發布時間:2025/4/16 编程问答 60 豆豆
生活随笔 收集整理的這篇文章主要介紹了 8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

OrthogonalMatchingPursuit and orthogonal_mp 實現了一個用來逼近在非零系數的個數上加約束的線性模型的擬合的OMP算法(比如L 0?pseudo-norm)

和 Least Angle Regression最小角回歸 一樣,作為一個前向特征選擇方法,OMP可以用一個固定非零的數來逼近最優的解向量:

或者說正交匹配算法可以針對一個特殊的誤差而不是一個特殊的非零系數的個數,這一過程可以表達為:


OMP是基于貪婪算法,包括在每一步原子(歸一化的向量)與當前殘差高度相關。它類似于簡單 匹配追蹤(MP)方法,但更好的,在每一次迭代中,通過使用的在前一個選擇的字典元素的空間的正交投影重新計算殘差。

import matplotlib.pyplot as plt import numpy as np from sklearn.linear_model import OrthogonalMatchingPursuit from sklearn.linear_model import OrthogonalMatchingPursuitCV from sklearn.datasets import make_sparse_coded_signaln_components, n_features = 512, 100 n_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()


總結

以上是生活随笔為你收集整理的8.正交匹配跟踪 Orthogonal Matching Pursuit (OMP)s的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。