[R] SVM Prediction and Plot

Steve Lianoglou mailinglist.honeypot at gmail.com
Wed Feb 2 19:10:16 CET 2011


Hi,

On Wed, Feb 2, 2011 at 10:35 AM, Brian <cttobin at hotmail.com> wrote:
>
> Thanks for the reply.
>
> When I run this:
>
>> head(SvmPred)
> 3570 2361 5406 2041 3440 4123
>   N    N    Y    Y    Y    Y
> Levels: N Y

Hmmm ... I think we'll need more info.

It looks like it should be working. By your output, your
`probabilites=TRUE` parameter in your call to `predict` isn't actually
doing anything. You need to train the svm and set `probability=TRUE`
if you're really after class probabilties.

Also, maybe there are some NA's in your data? Also, to be extra
careful, the second argument to predict should be a matrix, I guess it
already is, but ... what happens if you call predict like so:

R> SvmPred = predict(Svm, as.matrix(BankTest[,-1]), na.omit=na.fail)

-steve

-- 
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