jpmml / jpmml-r

Java library and command-line application for converting R models to PMML
GNU Affero General Public License v3.0
33 stars 8 forks source link

"The value for field Species is not defined" when i use xgboost comes to this problem,anyone can help? #13

Closed topxxuki closed 5 years ago

topxxuki commented 5 years ago

R code

library(xgboost) model2 <- xgboost( data = as.matrix(iris[, 1:4]), label = as.numeric(iris[, 5]) - 1, max_depth = 2, eta = 1, nthread = 2, nrounds = 2, objective = "multi:softprob", num_class = 3 ) as.matrix(iris[, 1:4])

Save the tree information in an external file:

xgb.dump(model2, "model2.dumped.trees")

Convert to PMML:

model.pmml<-pmml(model2, input_feature_names = colnames(as.matrix(iris[, 1:4])), missing_value_replacement= output_label_name = "Species", output_categories = c(1, 2, 3), xgb_dump_file = "model2.dumped.trees" ) save_pmml(model.pmml, name="iris.xgb.pmml")

it seems "Species"has been defined in the pmml image

vruusmann commented 5 years ago

The function pmml.xgboost belongs to the legacy pmml package, not here.