2.1.12
Orthogonal Matching Pursuit (OMP)
Summary
- Orthogonal Matching Pursuit (OMP) selects the feature most correlated with the current residual at each step to build a sparse linear model.
- The algorithm solves a least-squares problem restricted to the selected features, keeping the coefficients interpretable.
- Instead of tuning a regularization strength, you directly control sparsity by specifying the number of features to keep.
- Standardizing features and checking for multicollinearity help the method remain stable when recovering sparse signals.
Intuition #
This method should be interpreted through its assumptions, data conditions, and how parameter choices affect generalization.
Detailed Explanation #
Mathematical formulation #
Initialize the residual as \(\mathbf{r}^{(0)} = \mathbf{y}\). For each iteration \(t\):
- Compute the inner product between every feature \(\mathbf{x}_j\) and the residual \(\mathbf{r}^{(t-1)}\), and pick the feature \(j\) with the largest absolute value.
- Add \(j\) to the active set \(\mathcal{A}_t\).
- Solve the least-squares problem restricted to \(\mathcal{A}t\) to obtain \(\hat{\boldsymbol\beta}{\mathcal{A}_t}\).
- Update the residual \(\mathbf{r}^{(t)} = \mathbf{y} - \mathbf{X}_{\mathcal{A}t} \hat{\boldsymbol\beta}{\mathcal{A}_t}\).
Stop once you reach the desired sparsity or the residual is sufficiently small.
Experiments with Python #
The snippet below compares OMP and lasso on data with a sparse ground-truth coefficient vector.
| |
Reading the results #
- Setting
n_nonzero_coefsto the true sparsity helps OMP recover the relevant features reliably. - Compared with lasso, OMP produces exactly zero coefficients for unselected features.
- When features are highly correlated, the selection order can fluctuate, so preprocessing and feature engineering remain important.
References #
- Pati, Y. C., Rezaiifar, R., & Krishnaprasad, P. S. (1993). Orthogonal Matching Pursuit: Recursive Function Approximation with Applications to Wavelet Decomposition. In Conference Record of the Twenty-Seventh Asilomar Conference on Signals, Systems and Computers.
- Tropp, J. A. (2004). Greed is Good: Algorithmic Results for Sparse Approximation. IEEE Transactions on Information Theory, 50(10), 2231–2242.