scikit-learn/scikit-learn — Issue #540: omp.py: gamma undefined after early break
Author: josharian
Created: 2012-01-06 18:50:34+00:00
State: open

In `linear_model/omp.py`, function `_gram_omp`, if optimization ends early due to `warn`/`break` right after the `while` statement, then `gamma` never gets set before the return. This then raises an `UnboundLocalError`.

The warning displayed is helpful, but it'd be nice to also set some default value of `gamma` initially, rather than just bailing. I'd fix and submit a pull request, but I have no idea what an appropriate default value for `gamma` is. :)

Sorry that I don't have a handy test case for this; I encountered it in the middle of a very long test run (> 1 day) over a lot of data.