JPMML-R

Java library and command-line application for converting R models to PMML.

Table of Contents

Features

Prerequisites

Installation

Enter the project root directory and build using Apache Maven:

mvn clean install

The build produces an executable uber-JAR file target/jpmml-r-executable-1.4-SNAPSHOT.jar.

Usage

A typical workflow can be summarized as follows:

  1. Use R to train a model.
  2. Serialize the model in RDS data format to a file in a local filesystem.
  3. Use the JPMML-R command-line converter application to turn the RDS file to a PMML file.

The R side of operations

The following R script trains a Random Forest (RF) model and saves it in RDS data format to a file rf.rds:

library("randomForest")

rf = randomForest(Species ~ ., data = iris)

saveRDS(rf, "rf.rds")

The JPMML-R side of operations

Converting the RDS file rf.rds to a PMML file rf.pmml:

java -jar target/jpmml-r-executable-1.4-SNAPSHOT.jar --rds-input rf.rds --pmml-output rf.pmml

Getting help:

java -jar target/jpmml-r-executable-1.4-SNAPSHOT.jar --help

The conversion of large files (1 GB and beyond) can be sped up by increasing the JVM heap size using -Xms and -Xmx options:

java -Xms4G -Xmx8G -jar target/jpmml-r-executable-1.4-SNAPSHOT.jar --rds-input rf.rds --pmml-output rf.pmml

Documentation

Up-to-date:

Slightly outdated:

License

JPMML-R is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.

If you would like to use JPMML-R in a proprietary software project, then it is possible to enter into a licensing agreement which makes JPMML-R available under the terms and conditions of the BSD 3-Clause License instead.

Additional information

JPMML-R is developed and maintained by Openscoring Ltd, Estonia.

Interested in using Java PMML API software in your company? Please contact [email protected]