[R] [e1071] Features that are factors when exporting a model with write.svm

Matthew Wood doowttam at gmail.com
Fri Feb 21 20:50:29 CET 2014


I have a trained SVM that I want to export with write.svm and
eventually use in libSVM. Some of my features are factors. Standard
libSVM only works with features that are doubles, so I need to figure
out how my features should be represented and used.

How does e1071 treat factors in an SVM? For feature "foo" with values
"a" and "b" I'm assuming it's something like foo_a (0 or 1) and foo_b
(0 or 1). Is that right?

Do factors get treated differently in an SVM? If I convert the factors
to intergers for libSVM, I'll lose the information that a feature
doesn't take on a range of values. Is that going to cause problems? I
don't know if the model takes that into account.

When using write.svm a scale file is also output. My scale file is
missing the same number of rows as I have features that are factors.
That's another indication to me that the factors are causing issues.

Thanks.



More information about the R-help mailing list