Closed hyunjik11 closed 8 years ago
Could you test if fminlbfgs gets stuck? gp_var=gp_optim(gp_var,x,y,'opt',opt,'optimf',@fminlbfgs);
Thanks for the quick reply. I get a similar problem with fminlbfgs. This time for m=320, it gets stuck at the following section of 'fminlbfgs.m' (lines 745-751):
while isnan(f_alpha) || isinf(f_alpha) || any(isnan(grad)) || any(isinf(grad))
% NaN or Inf encountered, switch to safe mode
here_be_dragons=true;
alphaMax=alpha;
alpha = alphaPrev+0.25*(alpha-alphaPrev);
[data,f_alpha, grad]=gradient_function(data.xInitial(:)+alpha*data.dir(:),funfcn, data, optim);
end
For both cg and bfgs, it seems as though the optimiser is more likely to get stuck with more inducing points.
Better priors on hyperparameters would probably help. You could check whether some of the hyperparameters have ridiculous values when it gets stuck and then think about weakly informative priors to keep the optimization in a more feasible region.
Ah yes indeed the length scale for gpcf3 was becoming a bit big (not ridiculous though, something like exp(1.14)=3.1; the inputs have been whitened to have unit variance), which was causing the NaN. Using a Gaussian prior with variance 0.5, instead of the default student-t distribution with nu=4, does the job. This stronger prior does however give me a looser variational lower bound when the optimiser doesn't get stuck with the default prior, but I guess a compromise is needed. I think it would be good to have a flag for when the optimiser spends too long on a while loop. Thanks for the help!
I'm fitting a VAR GP on some Mauna Loa CO2 time series data, using a rather complicated kernel. Here is a snippet of the code I'm using:
For some values of X_u, the optimiser gets stuck at the following section of 'fminscg.m' (lines184-189):
Here fun is @(ww)gp_eg(ww,gp,x,y,'z',z), so tmp and gplus are the energy and its gradients with respect to the hyperparameters and the inducing points. Both are constantly computed to be NaN, which gets the while loop stuck. Have you ever experienced this problem before? Do you have any suggestions?