machine learning - How can I export a gbm model in R? -
machine learning - How can I export a gbm model in R? -
is there standard (or available) way export gbm model in r? pmml work, when i seek utilize pmml library, perhaps incorrectly, error:
for example, code looks similar this:
library("gbm") library("pmml") model <- gbm( formula, info = my.data, distribution = "adaboost", n.trees = 450, n.minobsinnode = 10, interaction.depth = 4, shrinkage=0.05, verbose=true) export <- pmml(model) # , export xml
and error is:
error in usemethod("pmml") : no applicable method 'pmml' applied object of class "gbm"
i've tried passing in dataset. in case, live format can parse programmatically (i'll scoring on jvm) pmml great if there way create work.
you can job using r2pmml
package. currently, supports regression (ie. distribution = "gaussian"
) , binary classification (ie. distribution = "adaboost"
or distribution = "bernoulli"
) model types.
below sample code auto mpg
dataset:
library("gbm") library("r2pmml") auto = read.csv(file = "autona.csv", header = true) auto.formula = gbm(mpg ~ ., info = auto, interaction.depth = 3, shrinkage = 0.1, n.trees = 100, response.name = "mpg") print(auto.formula) r2pmml(auto.formula, "/tmp/gbm.pmml")
r machine-learning pmml gbm
Comments
Post a Comment