pmml
is a generic function implementing S3 methods used to produce
the PMML (Predictive Model Markup Language) representation of an R
model. The resulting PMML file can then be imported into other systems that accept
PMML.
The same function can also be used to output variable transformations
in PMML format. In particular, it can be used as a transformations generator. Various
transformation operations can be implemented in R and those transformations
can then be output in PMML format by calling the function with a NULL value
for the model input and a pmmlTransformations
object as the transforms
input. Please see the R pmmlTransformations package for more information
on how to create the pmmlTransformations
object.
In addition, the pmml
function can also be called using a pre-existing PMML model
as the first input and a pmmlTransformations
object as the transforms input.
The result is a new PMML model with the transformation inserted as
a "LocalTransformations" element in the original model. If the original model
already had a "LocalTransformations" element, the new information will be
appended to that element. If the model variables are derived directly from
a chain of transformations defined in the transforms input, the
field names in the model are replaced with the original field names with the
correct data types to make a consistent model. The covered cases include
model fields derived from an original field, model fields derived from a chain
of transformations starting from an original field and mutiple fields derived from
the same original field.
This package converts models to PMML version 4.3.
Please note that package XML_3.95-0.1 or later is required to perform the full and correct functionality of the pmml package.
If data used for an R model contains features of type character
, these must be
converted to factors before the model is trained and converted with pmml
.
A list of all the supported packages is available in the vignette:
vignette("packages_and_functions", package="pmml")
.
pmml(model=NULL, model.name="Rattle_Model",
app.name="Rattle/PMML", description=NULL,
copyright=NULL, transforms=NULL, …)
an object to be converted to PMML.
a name to be given to the model in the PMML code.
the name of the application that generated the PMML code.
a descriptive text for the Header element of the PMML code.
the copyright notice for the model.
data transformations represented in PMML via pmmlTransformations.
further arguments passed to or from other methods.
An object of class XMLNode
as that defined by the XML
package. This represents the top level, or root node, of the XML
document and is of type PMML. It can be written to file with
saveXML
.
The Predictive Model Markup Language (PMML) is an XML-based language which provides a way for applications to define machine learning, statistical and data mining models and to share models between PMML compliant applications. More information about the PMML industry standard 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 Zementis Predictive Analytics products, which integrate with web services, relational database systems and deploy natively on Hadoop in conjunction with Hive, Spark or Storm, as well as allow predictive analytics to be executed for IBM z Systems mainframe applications and real-time, streaming analytics platforms.
Rattle home page: https://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.
A. Guazzelli, M. Zeller, W. Lin, G. Williams (2009), PMML: An Open Standard for Sharing Models. The R journal, Volume 1/1, 60-65
A. Guazzelli, T. Jena, W. Lin, M. Zeller (2013). Extending the Naive Bayes Model Element in PMML: Adding Support for Continuous Input Variables. In Proceedings of the 19th ACM SIGKDD Conference on Knowledge Discovery and Data Mining
T. Jena, A. Guazzelli, W. Lin, M. Zeller (2013). The R pmmlTransformations Package. In Proceedings of the 19th ACM SIGKDD Conference on Knowledge Discovery and Data Mining
pmml.ada
,
pmml.rules
,
pmml.coxph
,
pmml.cv.glmnet
,
pmml.glm
,
pmml.hclust
,
pmml.kmeans
,
pmml.ksvm
,
pmml.lm
,
pmml.multinom
,
pmml.naiveBayes
,
pmml.neighbr
,
pmml.nnet
,
pmml.randomForest
,
pmml.rfsrc
,
pmml.rpart
,
pmml.svm
,
pmml.xgb.Booster
# NOT RUN {
# Build a simple lm model
iris.lm <- lm(Sepal.Length ~ ., data=iris)
# Convert to pmml
pmml(iris.lm)
# Create a pmmlTransformations object
library(pmmlTransformations)
xo <- WrapData(iris)
# Transform the 'Sepal.Length' variable
xo <- MinMaxXform(xo,xformInfo="column1->d_sl")
# Output the tranformation in PMML format
pmml(NULL, transforms=xo)
# }
Run the code above in your browser using DataLab