pmml.svm {pmml} | R Documentation |
Generate the PMML representation of a svm object from the e1071 package.
## S3 method for class 'svm' pmml(model, model.name="LIBSVM_Model", app.name="R-PMML", description="Support Vector Machine Model", copyright=NULL, transforms=NULL, unknownValue=NULL, ...)
model |
a |
model.name |
a name to be given to the model in the PMML code. |
app.name |
the name of the application that generated the PMML code. |
description |
a descriptive text for the Header element of the PMML. |
copyright |
the copyright notice for the model. |
transforms |
data transformations represented in PMML via package pmmlTransformations. |
unknownValue |
value to be used as the 'missingValueReplacement' attribute for all MiningFields. |
... |
further arguments passed to or from other methods. |
The model is represented in the PMML SupportVectorMachineModel format.
Note that the sign of the coefficient of each support vector flips between the R object and the exported PMML file. This is due to the minor difference in the training/scoring formula between the LIBSVM algorithm and the DMG specification. Hence the output value of each support vector machine has a sign flip between the DMG definition and the svm prediction function.
In a classification model, even though the output of the support vector machine has a sign flip, it does not affect the final predicted category. This is because in the DMG definition, the winning category is defined as the left side of threshold 0 while the LIBSVM defines the winning category as the right side of threshold 0.
For a regression model, the exported PMML code has two OutputField elements. The first OutputField "predictedValue" shows the support vector machine output per DMG definition. The second one "svm_predict_function" gives the value corresponding to the R predict function for the svm model. This output should be the one to use when making model predictions.
Zementis Inc. info@zementis.com
R project CRAN package:
e1071: Misc Functions of the Department of Statistics (e1071), TU Wien
http://cran.r-project.org/web/packages/e1071/index.html
Chang, Chih-Chung and Lin, Chih-Jen, LIBSVM: a library for Support Vector Machines
http://www.csie.ntu.edu.tw/~cjlin/libsvm
library(e1071) fit <- svm(Species ~ ., data=iris, kernel="polynomial") pmml(fit) rm(fit)