[R] Questions bout SVM

Steve Lianoglou mailinglist.honeypot at gmail.com
Sat Jan 2 23:32:44 CET 2010


Hi,

On Fri, Jan 1, 2010 at 1:03 PM, Nancy Adam <nancyadam84 at hotmail.com> wrote:
>
> Hi everyone,
> Can someone please help me in these questions?:
>
> 1)if I use crossvalidation with svm, do I have to use this equation to calculate RMSE?:
>      mymodel <- svm(myformula,data=mydata,cross=10)
>      sqrt(mean(mymodel$MSE))

No, I don't think so. W/o looking at the C code, I'm guessing that MSE
is a vector of length 10 that represents the mean squared error from
each fold ... but what are you trying to do? Trying to get the average
of the RMSE over all folds? Wouldn't that then be:
mean(sqrt(mymodel$MSE))?

> But if I don’t use crossvalidation, I have to use the following to calculate RMSE:
>      mymodel <- svm(myformula,data=mydata)
>      mytest <- predict(mymodel, mytestdata)
>      error <- mytest - mytestdata[,1]
>      sqrt(mean(error**2))

OK

> 2)if I don’t set the parameters of SVM, like in the above, how the program knows them? Or it is a must to determine them when I invoke svm?

What parameters are you talking about? Your two `svm` function calls
look the same with the exception of not including a value for `cross`
in your 2nd.

What parameters of the SVM do you think are different?

> 3)can you please tell me why we use this equation:
> mymodel <- svm(myformula,data=mydata)instead of mymodel <- svm(myformula, mydata)

Since the "data" argument is the 2nd argument in the function
definition of svm.formula, those two invocations are actually the
same.

> and why use this:
> error <- mytest - mytestdata[,1] instead of error <- mytest – mytestdata

It depends on what type of variable 'mytestdata' is, and its shape,
eg. those two calls might be doing the same thing if mytestdata is
just a 1d matrix.

-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