pmml (version 1.3)

pmml.randomForest: Generate PMML for a Random Forest (randomForest) object


Generate the Predictive Model Markup Language (PMML) representation of a randomForest forest object. In particular, this function gives the user the ability to save the geometry of a forest as a PMML XML document.


## S3 method for class 'randomForest':
     description="Random Forest Tree Model",
     copyright = NULL,
     transforms = NULL, ...)


the forest object contained in an object of class randomForest, as that contained in the object returned by the function randomForest.
a name to give to the model in the PMML.
the name of the application that generated the PMML.
a descriptive text for the header of the PMML.
the copyright notice for the model.
transforms to represent within the PMML.
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.


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

Use of PMML and pmml.randomForest requires the XML package. Be aware that XML is a very verbose data format. Reasonably sized trees and data sets can lead to extremely large text files.

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


Breiman, L. (2001), Random Forests, Machine Learning 45(1),5-32

PMML home page:

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 -

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



Run this code
# Build a simple randomForest model

(iris.rf <- randomForest(Species ~ ., data=iris, ntree=2))

# Convert to pmml


Run the code above in your browser using DataLab