yanyachen / rBayesianOptimization

Bayesian Optimization of Hyperparameters
85 stars 21 forks source link

Infinite values of the Deviance Function, unable to find optimum parameters #36

Open petbadger opened 6 years ago

petbadger commented 6 years ago

Just an FYI in case anyone gets a GP_deviance error. Thought I should share this, in the obscure chance it will help someone else. Took me a good 2 hours of horsing around before I found the issue.

I was playing with this example: http://rpubs.com/tdneumann/351073 which produces the error:

Error in GP_deviance(param_init_200d[i, ], X, Y, nug_thres, corr = corr) : Infinite values of the Deviance Function, unable to find optimum parameters

rBayesianOptimization imports GPfit, which has the GP_deviance function.

My silly and futile first attempt was to replicate the Rpubs example as best I could: Use Rstudio, subset the dataset to Dec 22, 2017 when the post was created, run rBayesianOptimization version 1.1.0 and GPfit version 1.0-0. Though neither of these packages appear to have been updated since the Rpubs post.

I ran my own time series data through it, and I got the same error.

Then I stumbled on what seemed to cause the issue. The Rpubs article sets init_points = 0 in the call to BayesianOptimization. Setting this to an integer greater than 0 makes the code work.

Note: Out of the fire and into another, running it with init_points=1 resulted in a warning: "In .local(object, ...) : non-zero return code in optimizing". Not sure what that's about, but the results appear good.

petbadger commented 6 years ago

When I was using my own dataset, I actually will get the same error. It appears to have to do with the parameter ranges. If one of these are wacky, it produces a Value of NaN which I think contributes to the GP deviance error.

csetzkorn commented 4 years ago

My init_points is greater 0 and my bounds work for most series (I loop over them). Is there another way to overcome this please? I tried using tryCatch in my loss/aqu. function. Thanks.