[R] Uninformative error msgs w/ svm.default - Error in svm.default ... y must be a vector or a factor -

From: Ken Termiso <jerk_alert_at_hotmail.com>
Date: Tue, 5 Feb 2008 16:23:24 +0000

Hello,  

I'm using recursive SVM script (rSVM - http://www.stanford.edu/group/wonglab/RSVMpage/R-SVM.html ) on some microarray data. The data to be input are log2, as numeric matrix w/ attributes --  

str(svm_num_mat)
 num [1:10, 1:12340] 13.1 13.1 13.1 13.1 13.0 ...

and the class labels --
> str(m.cl.f)

 Factor w/ 2 levels "-1","1": 2 2 2 2 2 1 1 1 1 1
>
> m.cl.f

 [1] 1 1 1 1 1 -1 -1 -1 -1 -1
Levels: -1 1  

> mode(m.cl.f)

[1] "numeric"    

the rSVM function is called as such (it is a wrapper for svm in e1071, which then calls low-level svm.default ) -
> rsvm_output <- RSVM(x=svm_num_mat, y=m.cl.f, ladder=laddy, CVtype="LOO" )
Error in svm.default(xTrain[, SelInd], yTrain, scale = F, type = "C-classification", :   y must be a vector or a factor.    

....the 'laddy' variable just specifies a recursive parameter for the overlying rSVM procedure - here, it calls the 1st round w/ all 12340 elements, then with the highest scoring 9255 elements, etc..  

> laddy

 [1] 12340  9255  6941  5206  3904  2928  2196  1647  1235   926   694   520
[13]   390   292   219   164   123    92    69    52    39    29    22    16
[25]    12     9     7     5
 
 

...however, the error depends on the matrix size --
> rsvm_output <- RSVM(x=svm_num_mat[,5000:6000], y=m.cl.f, ladder=laddy[laddy gc()

         used (Mb) gc trigger (Mb) max used (Mb)
Ncells 185948 10.0     467875 25.0   467875 25.0
Vcells 758060 5.8 2983420 22.8 2798915 21.4
>
     

..help?  

Thanks,
-Ken


08



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Tue 05 Feb 2008 - 16:33:03 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Tue 05 Feb 2008 - 17:30:10 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive