Skip to content

how to obtain predicted labels for test data using "kerne lpls"

1 message · Liaw, Andy

#
You need to do some extra work if you want to do classification with a
regression method.  One simple way to do classification with PLS is to code
the classes as 0s and 1s (assuming there are only two classes) or -1s and
1s, fit the model, then threshold the prediction; e.g., those with predicted
values < 0.5 (in the 0/1 coding) get labeled as 0s.  There's a predict()
method for mvr objects, and that's what you need to use to get prediction on
test set.

There's one more complication:  The CV done internal to mvr is optimizing
the MSE (because it rightly thinks it has a regression problem), but that
will almost certainly not be the thing to do for classification.  You have
two choices:  Do your own CV, or modify code in pls.pcr to do the "right" CV
when given classification data.

You might want to look at the `gpls' package, which started out as part of
BioConductor, then was made available on CRAN, but now seem to have move
back to BioConductor.  It treats classification problems in a more `natural'
way.

HTH,
Andy