[R] training svm

Oldrich Kruza sixtease at gmail.com
Sun Mar 18 23:01:06 CET 2007


Hello.

I managed to solve the problem, here's what I learned:

The columns in data passed to svm need to contain only numeral values.
I simply assigned a number to each category of each feature. However,
there must not be a column where all the numbers are equal (there
mustn't be a feature with always the same value), so don't try to use
bit-representation suitable for neural networks.

Many thanks to Hadley Wickham and David Meyer for help.

~ Sixtease

On 2/27/07, David Meyer <david.meyer at wu-wien.ac.at> wrote:
> Hello (whoever you are),
>
> your data looks problematic. What does
>
> head(ne_span_data)
>
> reveal?
>
> BTW, svm() will not handle NA values.
>
> Best
> David
>
> ---------------------
>
> Hello. I'm new to R and I'm trying to solve a classification problem. I have
> a training dataset of about 40,000 rows and 50 columns. When I try to train
> support vector machine, it gives me this error after a few seconds:
>
>   Error in predict.svm(ret, xhold) : Model is empty!
>
> This is the code I use:
>
>   ne_span_data <- as.matrix(read.table('ne_span.data.R.txt', header=TRUE,
> row.names='id'))
>   library('e1071')
>   svm_ne_span_model <- svm(NE_type ~ . , ne_span_data)
>
> it gives me:
> Error in predict.svm(ret, xhold) : Model is empty!
>
> A line from the ne_span.data.R.txt file:
>   svt OTHER N N I S 2 NA NA NA NA NA A NA NA 2 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
> 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 train-s1m2
>
>
>



More information about the R-help mailing list