scikit-learn/scikit-learn — pull request #2798 by lgarrison (2014-01-29 05:15:20+00:00)
Title: Fixed gaussian process parameter optimization not respecting optimization limits.

There's a bug in gaussian_process.py that causes the parameter optimization via random starts to not respect optimization limits when there is more than one parameter to optimize (i.e. len(theta) > 1). The problem is that the optimization constraints are enforced by lambda functions that are constructed inside a loop and that depend on the loop counter; when the lambda is later evaluated, only the last value of the loop counter is remembered, not the value at the time the lambda was created. The solution to this is to save the value of the loop counter as a named parameter.

I also added a simple unit test that checks that the theta bounds are being respected. It fails without this fix.