0
$\begingroup$

I am using the GPML code found here. The key function in the aforementioned library is the gp function described below:

Two modes are possible: training or prediction: if no test cases are supplied, then the negative log marginal likelihood and its partial derivatives w.r.t. the hyper-parameters is computed; this mode is used to fit the hyper-parameters. If test cases are given, then the test set predictive probabilities are returned.

A typical call to the gp function utilising the prediction mode would be as follows:

[ymu, ys2, fmu, fs2, lp] = 
                   gp(hyp, @infEP, meanfunc, covfunc, likfunc, x, y, t, ys);

My first question is regarding the test set targets, ys. I found it quite weird that, in the file demoClassification.m, the author didn't use the real labels for his target dataset, but instead used a ones(n, 1). Even weirder, if I follow through with this convention, I obtain reasonable predictions for my test points. If, however, I choose to input the real test labels instead, the predictions output by the model are amiss. I should add that as opposed to the meshgrid method used by the author to generate the test data, I chose to use a method similar to that he followed to generate his training data:

% Generate the test dataset the same way as the training
% dataset, only changing the seed for the random number
% generator as well as the size of the test dataset
t1 = bsxfun(@plus, chol(S1)'*gpml_randn(0.5, 2, 20), m1);
t2 = bsxfun(@plus, chol(S2)'*gpml_randn(0.6, 2, 20), m2);

% Concatenate the generated test points into a test dataset
t = [t1 t2]';
ys = [-ones(1,20) ones(1,20)]';

Secondly, it is my understanding that the predictions that I should consider are the ones residing in the vecotr ymu i.e. the predictive output means. If so, what is the use of fmu i.e. the predictive latent mean, which as far as I understand, better captures the underlying function since it accounts for the presence of noise.

$\endgroup$
0
$\begingroup$

In the testing phase you generally do not know the labels. The gp tells you the probability of the samples belonging to classes encoded in ys. By setting all the elements of ys to 1, gp tells you with what probability your test samples belong to class 1. Notice that for the classification problem the predictive distribution is a Bernoulli instead of a Gaussian. Interpret ymu as the probabilities of the test points belonging to class 1.

For the classification problem, fmu cannot be interpreted as probability as it may not be in [0 1] range. Even for the regression problem you'd better work with fmu. Usually we are interested in modeling the observations (y which have noise) not the underlying (noiseless f) function.

$\endgroup$

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.