[R] How to use a saved SVM model from e1071

Thomas Coffin thomas.coffin at artelys.com
Wed Mar 14 16:00:58 CET 2012


I have an SVM model previously calibrated using libsvm R implementation from
the e1071 package. 
I would like to use this SVM to predict values, from a Java program.
I first tried to use jlibsvm and the "standard" java implementation of
libsvm, without success.
Thus, I am now considering writing data in files from my Java code, calling
an R program to predict values, then gather the predicted values in Java.

The problem is that I do not know how to re-use the model saved using the
write.svm() function, since there is no read.svm() function.
I read the following message in the mailing archive, stating that I may use
the save and load methods built in R :

Still, I am not sure how to pre-process the data and to post-process the
Since write.svm() writes .scale and .ysale files as well as an svm file, I
figure that the scaling data is included in the svm object.

Does that mean that I do not have to worry about scaling my data and
unscaling the results provided by the predict function on a model reloaded
using save/load ?
I am asking this because I previously succeeded in loading the svm model
from libsvm in Java, but the results using unscaled data were obviously

Thanks in advance,

More information about the R-help mailing list