5
$\begingroup$

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?

$\endgroup$
8
$\begingroup$

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);
exp(hyp2.lik)
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);
$\endgroup$
6
  • $\begingroup$ no problem, I have found GPML a great peice of kit, I thoroughly reccomend it to anyone wanting to investigate GPs. $\endgroup$ Mar 29 '11 at 15:37
  • $\begingroup$ What is the purpose of sn = 0.1; hyp.lik = log(sn) ? $\endgroup$ Aug 6 '15 at 10:02
  • $\begingroup$ IIRC it is setting up an initial value for the (signal-to-) noise hyper-parameter of the GP. $\endgroup$ Aug 7 '15 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
    Mar 28 '16 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
    Mar 28 '16 at 10:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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