[R] Uninformative error msgs w/ svm.default - Error in svm.default ... y must be a vector or a factor -
Ken Termiso
jerk_alert at hotmail.com
Tue Feb 5 17:23:24 CET 2008
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 ...
- attr(*, "dimnames")=List of 2
..$ : chr [1:10] "rma_log2_con_sample_1" "rma_log2_con_sample_2" "rma_log2_con_sample_3" "rma_log2_con_sample_4" ...
..$ : chr [1:12340] "AFFX-HSAC07/X00351_3_at" "AFFX-HSAC07/X00351_5_at" "AFFX-HSAC07/X00351_M_at" "AFFX-HUMGAPDH/M33197_3_at" ...
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
More information about the R-help
mailing list