sklearn.linear_model.orthogonal_mp?
sklearn.linear_model.orthogonal_mp(X, y, *, n_nonzero_coefs=None, tol=None, precompute=False, copy_X=True, return_path=False, return_n_iter=False)
[源碼]
正交匹配追蹤(OMP)
解決n_targets正交匹配追蹤問題。問題的實例具有以下形式:
當使用n_nonzero_coefs
通過非零系數的數量進行參數化時:argmin || y-Xgamma || ^ 2服從|| gamma ||0 <=n_{nonzero coefs}
當使用參數tol
進行參數化時:argmin || gamma || _0 服從|| y-Xgamma || ^ 2 <= tol
在用戶指南中閱讀更多內容。
參數 | 說明 |
---|---|
X | array, shape (n_samples, n_features) 輸入數據。假定列具有單位范數。 |
y | array, shape (n_samples,) or (n_samples, n_targets) 輸入目標 |
n_nonzero_coefs | int 解決方案中非零項的期望數目。如果為None(默認情況下),這個值設置為n_features的10%。 |
tol | float 殘差的最大范數。如果不是None,則覆蓋n_nonzero_coefs。 |
precompute | {True, False, ‘auto’}, 是否執行預計算。當n_targets或n_samples非常大時提高性能。 |
copy_X | bool, optional 設計矩陣X是否必須被算法復制。僅當X已經是Fortran-ordered時,false值才有用,否則無論如何都會進行復制。 |
return_path | bool, optional. Default: False 是否沿著正向路徑返回非零系數的每個值。對于交叉驗證很有用。 |
return_n_iter | bool, optional default False 是否返回迭代次數。 |
返回值 | 說明 |
---|---|
coef | array, shape (n_features,) or (n_features, n_targets) OMP解決方案的系數。如果為 return_path=True ,則包含整個系數路徑。在這種情況下,其形狀為(n_features,n_features)或(n_features,n_targets,n_features),并且在最后一個軸上進行迭代會按活動特征的遞增順序生成系數。 |
n_iters | array-like or int 每個目標上的活動特征數量。僅當 return_n_iter 設置為True時返回 。 |
另見:
decomposition.sparse_encode
注
Orthogonal matching pursuit was introduced in S. Mallat, Z. Zhang, Matching pursuits with time-frequency dictionaries, IEEE Transactions on Signal Processing, Vol. 41, No. 12. (December 1993), pp. 3397-3415. (http://blanche.polytechnique.fr/~mallat/papiers/MallatPursuit93.pdf)
This implementation is based on Rubinstein, R., Zibulevsky, M. and Elad, M., Efficient Implementation of the K-SVD Algorithm using Batch Orthogonal Matching Pursuit Technical Report - CS Technion, April 2008. https://www.cs.technion.ac.il/~ronrubin/Publications/KSVD-OMP-v2.pdf