[R] Kernlab: multidimensional targets in rvm(), ksvm(), gausspr()

Emiliano Guevara emiguevara at gmail.com
Tue Oct 6 12:03:06 CEST 2009


Hi there,

I'm trying to do a regression experiment on a multidimensional
dataset where both x and y in the model are multidimensional
vectors.
I'm using R version 2.9.2, updated packages, on a Linux box.

I've tried gausspr(), ksvm() and rvm(), and the models are
computed fine, but I'm always getting the same error message
when I try to use predict():

"Error in .local(object, ...) : test vector does not match model !"

I realize that maybe kernlab does not support the kind of
operation I'm trying to do, but I still haven't found any
explicit statement saying that multidimensional targets are not
supported...

Do you have any suggestions?
Is there a way to avoid the error in kernlab?
Any alternative approaches (other that drastically reducing
dimensionality...)?

Thanks a lot for your support!

E.G.

Here's a toy example that produces the error message:

# build x and y matrices
 > x <- sample(seq(-20,20,0.1), 100)
 > y <- sin(x)/x + rnorm(100,sd=0.05)
 > x <- matrix(x, nrow=25, ncol=4)
 > y <- matrix(y, nrow=25, ncol=4)

# build the model: seems successful
 > foo <- rvm(x, y) # same with ksvm(), gausspr(), ecc.
Using automatic sigma estimation (sigest) for RBF or laplace kernel
 > foo
Relevance Vector Machine object of class "rvm"
Problem type: regression
Gaussian Radial Basis kernel function.
  Hyperparameter : sigma =  0.00179432103430767
Number of Relevance Vectors : 7
Variance :  0.05937295
Training error : 0.049660537

# but predict fails...
 > predict(foo, x)
Error in .local(object, ...) : test vector does not match model !




**********************************************************************
Emiliano R. Guevara
Institutt for lingvistiske og nordiske studier -- Universitetet i Oslo
PO Box 1102, Blindern, 0317 Oslo, Norway




More information about the R-help mailing list