Learn R Programming

pmml (version 1.3)

pmml.ksvm: Generate PMML for a ksvm object

Description

Generate the Predictive Model Markup Language (PMML) representation for a ksvm object (SVM). With this code, a PMML representation can be obtained for SVMs implementing classification (multi-class and binary) as well as regression.

Usage

## S3 method for class 'ksvm':
pmml(model, model.name="SVM_model", app.name="Rattle/PMML",
     description="Support Vector Machine PMML Model", copyright=NULL,
     transforms=NULL, dataset=NULL, weights=NULL, \dots)

Arguments

model
a ksvm object.
dataset
the original dataset used to train the SVM model in ksvm - required since the ksvm object does not appear to record information about the used categorical variables.
model.name
a name to give to the model in the PMML.
app.name
the name of the application that generated the PMML.
description
a descriptive text for the header of the PMML.
copyright
the copyright notice for the model.
transforms
a coded list of transforms performed.
weights
the weights used for building the model.
...
further arguments passed to or from other methods.

Details

PMML is an XML based language which provides a way for applications to define statistical and data mining models and to share models between PMML compliant applications. More information about PMML and the Data Mining Group can be found at http://www.dmg.org.

The generated PMML can be imported into any PMML consuming application, such as the Zementis ADAPA and UPPI scoring engines which allow for predictive models built in R to be deployed and executed on site, in the cloud (Amazon, IBM, and FICO), in-database (IBM Netezza, Pivotal, Sybase IQ, Teradata and Teradata Aster) or Hadoop (Datameer and Hive).

References

Rattle home page: http://rattle.togaware.com

PMML home page: http://www.dmg.org

A. Guazzelli, W. Lin, T. Jena (2012), PMML in Action: Unleashing the Power of Open Standards for Data Mining and Predictive Analytics. CreativeSpace (Second Edition) - Available on Amazon.com - http://www.amazon.com/dp/1470003244.

A. Guazzelli, M. Zeller, W. Lin, G. Williams (2009), PMML: An Open Standard for Sharing Models. The R journal, Volume 1/1, 60-65

See Also

pmml. ksvm.

Examples

Run this code
# Train a support vector machine to perform classification.

require(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])

# Save to file.

saveXML(p, "iris_svm.xml")

Run the code above in your browser using DataLab