r2pmml {r2pmml} | R Documentation |
Converts an R model object to PMML.
Description
Converts an R model object to PMML.
Usage
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
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")
[Package r2pmml version 0.28.0 Index]