You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OMP has a parameter n_nonzero_coefs. Since OMP isa greedy algorithm, it is very natural to compute all the solutions, from n_nonzero_coefs=1 to ``n_nonzero_coefs=max_nonzero_coefs`.
Since OMP is greedy, you need the solution of the model with n_nonzero_coefs=k-1 to compute the solution of the model with n_nonzero_coefs=k. If you want to tune n_nonzero_coefs for accuracy, GridSearchCV will be a total waste of time, since it will recompute the same thing again and again.
An omp_path function could return a 2d-array W of shape (max_nonzero_coefs, n_features) where W[0] would contain a coefficient vector with only 1 non-zero coefficient, W[1] would contain 2 non-zero coefficients, and so on.
By default, max_nonzero_coefs could be set to n_features. Instead of returning an array, a generator could also be used.
OrthogonalMatchingPursuitCV would be an object to do cross-validation efficiently based on omp_path.
Think of omp_path and OrthogonalMatchingPursuitCV as the counterparts of lasso_path and LassoCV but with respect to n_nonzero_coefs instead of alpha.
Activity
GaelVaroquaux commentedon Jul 4, 2012
I am not sure that I understand your remark.
mblondel commentedon Jul 4, 2012
Since OMP is greedy, you need the solution of the model with
n_nonzero_coefs=k-1to compute the solution of the model withn_nonzero_coefs=k. If you want to tunen_nonzero_coefsfor accuracy,GridSearchCVwill be a total waste of time, since it will recompute the same thing again and again.An
omp_pathfunction could return a 2d-arrayWof shape(max_nonzero_coefs, n_features)whereW[0]would contain a coefficient vector with only 1 non-zero coefficient,W[1]would contain 2 non-zero coefficients, and so on.By default,
max_nonzero_coefscould be set ton_features. Instead of returning an array, a generator could also be used.OrthogonalMatchingPursuitCVwould be an object to do cross-validation efficiently based onomp_path.Think of
omp_pathandOrthogonalMatchingPursuitCVas the counterparts oflasso_pathandLassoCVbut with respect ton_nonzero_coefsinstead ofalpha.Makes more sense?
vene commentedon Jul 4, 2012
I get it. Would this count as a speedup? (it's an improvement over doing a grid search, after all)
mblondel commentedon Jul 5, 2012
If you have extra-time, I'd say you can tackle this in your GSOC.
mblondel commentedon Oct 9, 2013
Fixed by @vene and @agramfort, see #2224.