pmml (version 1.5.4)

pmml.svm: Generate PMML for svm objects

Description

Generate the PMML representation of a svm object from the e1071 package.

Usage

# S3 method for svm
pmml(model, model.name="LIBSVM_Model",
      app.name="R-PMML",
      description="Support Vector Machine Model",
      copyright=NULL, transforms=NULL, 
      unknownValue=NULL, ...)

Arguments

model

a svm object from package e1071.

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 pmmlTransformations.

unknownValue

value to be used as the 'missingValueReplacement' attribute for all MiningFields.

further arguments passed to or from other methods.

Details

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.

References

Examples

Run this code
# NOT RUN {
library(e1071)
fit <- svm(Species ~ ., data=iris, kernel="polynomial")
pmml(fit)

rm(fit)

# }

Run the code above in your browser using DataLab