r2pmml: Converts an R model object to PMML.

Description Usage Arguments Examples

Description

Converts an R model object to PMML.

Usage

1
2
r2pmml(x, file, converter = NULL, converter_classpath = NULL,
  verbose = FALSE, ...)

Arguments

x

An R model object.

file

A filesystem path to the result file.

converter

The name of a custom JPMML-R converter class.

converter_classpath

A list of filesystem paths to library JAR files that provide and support the custom JPMML-R converter class.

verbose

A flag controlling the verbosity of the conversion process.

...

Arguments to be passed on to the "r2pmml::decorate" function.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
library("mlbench")
library("randomForest")
library("r2pmml")

data(iris)
iris.rf = randomForest(Species ~ ., data = iris, ntree = 7)
# Convert "randomForest" object to R-style (deep binary splits) MiningModel
pmmlFile = file.path(tempdir(), "Iris-RandomForest.pmml")
r2pmml(iris.rf, pmmlFile)
# Convert "randomForest" object to PMML-style (shallow multi-way splits) MiningModel
compactPmmlFile = file.path(tempdir(), "Iris-RandomForest-compact.pmml")
r2pmml(iris.rf, compactPmmlFile, compact = TRUE)

data(BostonHousing)
housing.glm = glm(medv ~ ., data = BostonHousing, family = "gaussian")
# Convert "glm" object into GeneralRegressionModel
genRegPmmlFile = file.path(tempdir(), "Housing-GLM.pmml")
r2pmml(housing.glm, genRegPmmlFile)
# Convert "glm" object into RegressionModel
regPmmlFile = file.path(tempdir(), "Housing-LM.pmml")
r2pmml(housing.glm, regPmmlFile, converter = "org.jpmml.rexp.LMConverter")

r2pmml documentation built on July 1, 2019, 5:03 p.m.