BayesianOptimization icon indicating copy to clipboard operation
BayesianOptimization copied to clipboard

Problem with optimization: fmin_l_bfgs_b terminated abnormally...

Open Ricardus312 opened this issue 9 years ago • 4 comments

I'm running the BO to search for hyperparameters of XGBoost model. On the first iteration of the BO, after initialization, I get this message:

/home/ubuntu/anaconda3/lib/python3.6/site-packages/sklearn/gaussian_process/gpr.py:457: UserWarning: fmin_l_bfgs_b terminated abnormally with the state: {'grad': array([ -1.36050603e-05]), 'task': b'ABNORMAL_TERMINATION_IN_LNSRCH', 'funcalls': 51, 'nit': 4, 'warnflag': 2} " state: %s" % convergence_dict)

More information about this issue: https://github.com/scikit-learn/scikit-learn/issues/7563 https://stackoverflow.com/questions/34663539/scipy-optimize-fmin-l-bfgs-b-returns-abnormal-termination-in-lnsrch

I was using the default gp_params. If I understood correctly those two threads, the problem is that lbfgs received a negative gradient while trying to maximize the function, which might be caused because "the gradient does not match the function" or a wrong set of parameters for the Gaussian Process. The thing is that I have no idea of how to solve this, so any help is appreciated.

Ricardus312 avatar Nov 28 '17 13:11 Ricardus312

As you pointed out yourself, this is a problem with training the guassian process, not with BO per se. As suggested, the likely cause is the function being optimized (the one the GP is trying to approximate) is ill behaved, leading to difficulties. You can try sharing some code, but the answer seems to be tuning GP's parameters until you get it working. Probably adding flexibility with the alpha parameter will help.

fmfn avatar Nov 28 '17 16:11 fmfn

Raising the value of alpha to 1e-4 solved the problem. Thank you very much for the help.

Ricardus312 avatar Nov 28 '17 23:11 Ricardus312

Hello I'm running BayesianOptimization/examples/sklearn_example.py with the same results is it expected output or something wrong in a master branch? Does it affect the results or algorithm just found a boundary that way?

Sorry for dumb question but I'm just started looking for solutions on hyperparameters tuning with Bayesian Optimisation.

   15 | 00m14s |    0.86035 |         0.5506 |              2.0735 |       249.9930 |
/sklearn/gaussian_process/gpr.py:457: UserWarning: fmin_l_bfgs_b terminated abnormally with the  state: {'grad': array([2.32102379e-05]), 'task': b'ABNORMAL_TERMINATION_IN_LNSRCH', 'funcalls': 49, 'nit': 6, 'warnflag': 2}
  " state: %s" % convergence_dict)
/sklearn/gaussian_process/gpr.py:457: UserWarning: fmin_l_bfgs_b terminated abnormally with the  state: {'grad': array([-1.83028867e-05]), 'task': b'ABNORMAL_TERMINATION_IN_LNSRCH', 'funcalls': 53, 'nit': 7, 'warnflag': 2}
  " state: %s" % convergence_dict)

iliatimofeev avatar Oct 10 '18 13:10 iliatimofeev

@iliatimofeev This example is a bit outdated, it was created before the new scikit-learn implementation of gaussian processes. See @Ricardus312 comment above for a solution.

Examples will be reworked/fixed in an upcoming version release.

fmfn avatar Oct 10 '18 22:10 fmfn