[R] Need help for SVM code for microarray classification

Steve Lianoglou mailinglist.honeypot at gmail.com
Tue Jun 29 17:05:19 CEST 2010


Hi,

On Tue, Jun 29, 2010 at 7:16 AM, Aadhithya <sistaadhi at gmail.com> wrote:
>
> Following is the error I am getting:
> Error in svm.default(train, cl) :
>  Need numeric dependent variable for regression.

Here's a problem that you may not even know you had yet.

By the looks of your code, it seems as if you want to do
classification, but the SVM is trying to do regression.

You have to make sure that all of the columns in your data.frames are
of the right type. If you're doing classification, change your label
column to a factor. In your case, where you are explicitly passing a y
vector, instead of this:

R> model<- svm(train,cl);

do this

R> cl <- factor(cl)
R> model <- svm(train, cl)

Also, explicitly set the `type` argument in your call to `svm` so you
are doing the right thing (ie. 'C-classifiction', 'nu-classificatino',
etc).

Also, be sure that there aren't any NA values in your data.

> My dataset looks like this in both training and testing:

If both of your datasets look the same, why are you transposing your
`test` matrix when passing it to `predict` (I'm looking at the code in
your original post)?

-- 
Steve Lianoglou
Graduate Student: Computational Systems Biology
 | Memorial Sloan-Kettering Cancer Center
 | Weill Medical College of Cornell University
Contact Info: http://cbio.mskcc.org/~lianos/contact



More information about the R-help mailing list