pmml (version 1.5.1)

pmml.ksvm: Generate PMML for ksvm objects

Description

Generate the PMML representation for a ksvm object from package kernlab.

Usage

"pmml"(model, model.name="SVM_model", app.name="Rattle/PMML", description="Support Vector Machine PMML Model", copyright=NULL, transforms=NULL, unknownValue=NULL, dataset=NULL, ...)

Arguments

model
a ksvm object.
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 code.
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.
dataset
required since the ksvm object does not record information about the used categorical variable; the original dataset used to train the SVM model in ksvm.
...
further arguments passed to or from other methods.

Details

Both classification (multi-class and binary) as well as regression cases are supported.

References

R project CRAN package: kernlab: Kernel-based Machine Learning Lab https://CRAN.R-project.org/package=kernlab

Examples

Run this code
# Train a support vector machine to perform classification.
library(kernlab)
model  <- ksvm(Species ~ ., data=iris)
p <- pmml(model, dataset=iris)

# To make predictions using this model, the new data must be given; 
# without it and by simply using the "predict" function without an 
# input dataset, the predicted value will not be the true predicted 
# value. It will be a raw predicted value which must be 
# post-processed to get the final correct predicted value.

# Make predictions using same iris input data. Even though it is the 
# same dataset, it must be provided as an input parameter for the 
# "predict" function. 

predict(model,iris[,1:4])

rm(model)
rm(p)

Run the code above in your browser using DataCamp Workspace