-
Notifications
You must be signed in to change notification settings - Fork 22
Description
Thanks for developing this, it's a cool package! I came across a small bug where if the user-provided FUN returns list(Score=NA) during fitting, I get the following error:
Error in if (r == 0) stop("Results from FUN have 0 variance, cannot build GP.") :
missing value where TRUE/FALSE needed
This isn't very helpful, but it tells me that there's a missing value somewhere. Looking through your source code, I found that the error is happening in the function zeroOneScale in the file SmallFuncs.R, which is being used to scale the Scores over each evaluated point. This is reasonable enough, but you lose any of the progress that you've made until this point so it can be hard for a user to debug. Thankfully there's an obvious simple fix. I found that if you add na.rm=TRUE in the calls to min and max within this function, you get a more reasonable error:
Returning results so far. Error encountered while training GP: <non-finite value supplied by optim>
This seems preferable because it (a) tells the user directly that the score function is giving NA/NaN values, and (b) it gives the user access to the returned value, allowing you to determine which parameter values are causing trouble for FUN.