I have downloaded the Gaussian Processes for Machine Learning (GPML) package (gpml-matlab-v3.1-2010-09-27.zip) from the website, and I can run the regression example (demoRegression) in Octave. It works just fine.

Now I have my own data for regression where the x (input) matrix is a 54x10 matrix (54 samples, 10 input vars), and the y (target) vector is 54x1.

The problem is that I do not understand hov to calculate the meanfunc and the covfunc, the code provided for the regression example does not work for multiple input datasets.

I do not understand enough Octave to decode the specific code used to calculate this.

Are there anybody who has tried this, and maybe can show an example?


1 Answer 1


Here is a more minimal example of a 2-d regression problem (I haven't got octave, only matlab, but hopefully the difference won't matter). meanfunc and covfunc should be happy with any number of inputs, provided that the covariance function doesn't have a hyper-parameter per inpit feature (as e.g. covSEiso does). Hope this helps

[X1,X2] = meshgrid(-pi:pi/16:+pi, -pi:pi/16:+pi);

Y = sin(X1).*sin(X2) + 0.1*randn(size(X1));

imagesc(Y); drawnow;

x = [X1(:) X2(:)];
y = Y(:);

covfunc = @covSEiso; 
  likfunc = @likGauss; sn = 0.1; hyp.lik = log(sn);

hyp2.cov = [0 ; 0];    
hyp2.lik = log(0.1);
hyp2 = minimize(hyp2, @gp, -100, @infExact, [], covfunc, likfunc, x, y);
nlml2 = gp(hyp2, @infExact, [], covfunc, likfunc, x, y)

[m s2] = gp(hyp2, @infExact, [], covfunc, likfunc, x, y, x);

m = reshape(m, size(Y));

figure(2); imagesc(m);
  • $\begingroup$ no problem, I have found GPML a great peice of kit, I thoroughly reccomend it to anyone wanting to investigate GPs. $\endgroup$ Commented Mar 29, 2011 at 15:37
  • $\begingroup$ What is the purpose of sn = 0.1; hyp.lik = log(sn) ? $\endgroup$ Commented Aug 6, 2015 at 10:02
  • $\begingroup$ IIRC it is setting up an initial value for the (signal-to-) noise hyper-parameter of the GP. $\endgroup$ Commented Aug 7, 2015 at 7:00
  • $\begingroup$ @DikranMarsupial can you please explain why did you use the minimize function ? Is it to get the optimal hyper-parameters for the GP ? Also how is the choice of the mean and co-variance function done ? $\endgroup$
    – roni
    Commented Mar 28, 2016 at 10:34
  • $\begingroup$ @DikranMarsupial Also in the second figure the contours seems to be a lot clearer - can you please give its meaning ... $\endgroup$
    – roni
    Commented Mar 28, 2016 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.