Skip to content
Prev 205278 / 398506 Next

Questions bout SVM

2010/1/2 Nancy Adam <nancyadam84 at hotmail.com>:
So, as I mentioned before, mymodel$MSE is a vector that's as long as
the number of folds your are using for cross validation. If you're
setting cross=10, $MSE will have 10 values in it. Each value is the
*mean squared error* for each fold (as described in the ?svm
documentation under the `cross` parameter).

If you do 1: sqrt(mean(mymodel$MSE)), then you're taking the square
root of the averaged mean squared error.

If you do 2: mean(sqrt(mymodel$MSE)), you are taking the average of
the square root of the MSE from each fold.
It sounds like you want to do 2.
Functions can define default values for their arguments. So if you
don't define their values when you call the function, they will take
their defaults. For example, if you don't explicitly set things like
the `cost` (for c-classification), or `epsilon` for regression, etc.
it will take the default values.

You can see the default value for these params in the documentation for ?svm
It's not because it's the last argument, but because it's the second
argument. `data` is defined as the second argument of the `svm`
function (when used with a formula), and you are passing it as the 2nd
argument when you call the function.
mytestdata[,1] means you are taking the first column of the mytestdata
matrix and treating it as a vector and ignoring the rest of the matrix
...
honestly I'd suggest investing some time in brushing up on R basics.
Reading the R intro is as good a place to start as any:

http://cran.r-project.org/doc/manuals/R-intro.html

There are several sections on indexing vectors, matrices, etc. Section
10 of that document also talks a bit about named, positional, and
default arguments ...

HTH,
-steve