# \donttest{
library("xgboost")
library("r2pmml")
data(iris)
iris_X = iris[, -ncol(iris)]
iris_y = iris[, ncol(iris)]
iris.fmap = as.fmap(iris_X)
iris.xgboost = xgboost(
x = iris_X, y = iris_y,
objective = "multi:softprob",
nrounds = 11
)
# Please uncomment the next two lines
#iris.xgboost = decorate(iris.xgboost, iris.fmap,
# response_name = "Species", response_levels = c("setosa", "versicolor", "virginica"))
pmmlFile = file.path(tempdir(), "Iris-XGBoost.pmml")
# Please uncomment the next line
#r2pmml(iris.xgboost, pmmlFile, compact = FALSE)
compactPmmlFile = file.path(tempdir(), "Iris-XGBoost-compact.pmml")
# Please uncomment the next line
#r2pmml(iris.xgboost, compactPmmlFile, compact = TRUE)
# }
Run the code above in your browser using DataLab