gpstuff-dev / gpstuff

GPstuff - Gaussian process models for Bayesian analysis
http://research.cs.aalto.fi/pml/software/gpstuff/
GNU General Public License v3.0
169 stars 61 forks source link

lgpdens error #17

Closed richardbayes closed 7 years ago

richardbayes commented 7 years ago

When I run lgpdens on the attached data, I get the error below. I am able to overcome this issue by choosing the speedup option ('speedup','on'), but resulting density is not smooth enough (this may be due to the fact the observed data is largely integer based with repeated observations). Is there another way around this error, or is there a better way to somehow get the smoothing parameters to produce a more realistic density estimate?

lgp_error_graph

Here's the error:

Error using GPLA_E The value of 'w' is invalid. It must satisfy the function: @(x)isempty(x)||(ischar(x)&&strcmp(w,'init'))||isvector(x)&&isreal(x)&&all(isfinite(x))||all(isnan(x)).

Error in gpla_e (line 79) ip.parse(w, gp, varargin{:});

Error in gpla_g (line 231) [e, edata, eprior, p] = gpla_e(gp_pak(gp), gp, x, y, 'z', z);

Error in gp_g (line 38) [g] = fh_g(w, gp, x, y, varargin{:});

Error in gp_eg (line 40) g=gp_g(w, gp, x, y, varargin{:});

Error in gp_optim>@(ww)gp_eg(ww,gp,x,y,'z',z) (line 66) fh_eg=@(ww) gp_eg(ww, gp, x, y, 'z', z);

Error in fminlbfgs>gradient_function (line 890) [fval, grad]=feval(funfcn,reshape(x,data.xsizes));

Error in fminlbfgs>bracketingPhase (line 744) [data,f_alpha, grad]=gradient_function(data.xInitial(:)+alpha*data.dir(:),funfcn, data, optim);

Error in fminlbfgs>linesearch (line 583) data = bracketingPhase(funfcn, data,optim);

Error in fminlbfgs (line 279) data=linesearch(funfcn, data,optim);

Error in gp_optim (line 121) w = optimf(fh_eg, w, opt);

Error in lgpdens>gpsmooth (line 983) gp=gp_optim(gp,xx,yy,'opt',opt, 'optimf', @fminlbfgs);

Error in lgpdens (line 163) gp=gpsmooth(xxn,yy,gpcf,latent_method,int_method,display,speedup,gridn,cond_dens,basis,imp_sampling); lgp_error_graph

HERE ARE THE DATA: 18 15 18 16 17 15 15 14 15 14 22 18 16 17 19 18 18 19 18 17 15 18 21 14 15 13 18 16 18 18 23 18 19 15 20 11 20 19 15 16 16 18 19 18 15 15 16 15 18 21 20 13 20 18 19 23 22 22 22 24 22.5 20 18 18.5 17.5 20 19 19 16.5 13 13 17.5 17.5 20.5 19 18.5 22

avehtari commented 7 years ago

Hi, Thanks for reproducible example. lgpdens wasn't tested much with integer data, and with the default grid it is doing the almost the correct thing and finding the integer values. To set the grid only on the integer values, you can use lgpdens(q,[5:30]','range',[5 30]) However, since there are so few grid points, this fails due to a bug, which I just fixed in 393de81 (waiting for a pull request review).

Aki