2012/6/28 Charles-Pierre Astolfi <[email protected]>:
> Hi scikiters,
>
> I am trying to compute lasso/lars for several values of the
> regularization parameter.
>
> A clean way to do this, is like this:
>>>> alphas = [some long list of positive values]
>>>> models = linear_model.lars_path(X, y, alphas=alphas)

Nope you cannot path the list of alphas to `lars_path` as it will
automatically find the relevant inflection points analytically, see
for instance this example :

http://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_lars.html

> Unfortunately, it seems to be very slow, compared to lars_path +
> manual interpolation on each alpha.

Ok so in the previous comment you probably meant lasso_path instead of
lars_path. As in:

http://scikit-learn.org/stable/auto_examples/linear_model/plot_lasso_coordinate_descent_path.html

> My understanding is that it is
> because the returned model is an ElasticNet and, as such, cannot use
> lars regularization path to efficiently compute the solutions for
> several alphas.

Yes it is an iterated Coordinate Descent optimization of the LASSO
objective function rather than a LASSO/LARS optimizer but it does warm
restarts so it should still be competitive with LARS. However I think
that the convergence checks in the current implementation are
expensive right now so fine grids my still be expensive. There are two
ongoing GSoC projects that might fix this perf issue at some point.

> Am I missing something?

You might now be aware that the Lasso CD optimization is very
expensive when alpha is getting very small. Try to truncate your
alphas list down to the smallest values that are still easy to
optimize for.

> If I need speed, should I interpolate myself?

It's probably a good idea and could be a nice new feature to
contribute to scikit-learn.

> Is it worth a pull request?

Sure :)

-- 
Olivier
http://twitter.com/ogrisel - http://github.com/ogrisel

------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
Scikit-learn-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/scikit-learn-general

Reply via email to