jpmml / r2pmml

R library for converting R models to PMML
GNU Affero General Public License v3.0
73 stars 18 forks source link

Support in new xgboost version #11

Closed gilad19 closed 7 years ago

gilad19 commented 7 years ago

Hi, I tried using r2pmml with a more updated version of XGBoost than the one found in CRAN (ver 6.0-0, which contains some important bug fixes) and got an error (see below). I used the command that worked when I used the CRAN version of XGBoost. Does r2pmml supposed to support this updated version? If not, is there a plan to support it in the near future? Thanks!

Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run INFO: Parsing RDS.. Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run INFO: Parsed RDS in 4 ms. Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run INFO: Initializing default Converter Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run INFO: Initialized org.jpmml.rexp.XGBoostConverter Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run INFO: Converting.. Dec 08, 2016 7:53:14 PM org.jpmml.rexp.Main run SEVERE: Failed to convert java.lang.IllegalArgumentException: java.io.IOException at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:90) at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:40) at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:91) at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:75) at org.jpmml.rexp.Main.run(Main.java:149) at org.jpmml.rexp.Main.main(Main.java:97) Caused by: java.io.IOException at org.jpmml.xgboost.XGBoostDataInput.readReserved(XGBoostDataInput.java:68) at org.jpmml.xgboost.Learner.load(Learner.java:55) at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:34) at org.jpmml.rexp.XGBoostConverter.loadLearner(XGBoostConverter.java:159) at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:88) ... 5 more

Exception in thread "main" java.lang.IllegalArgumentException: java.io.IOException at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:90) at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:40) at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:91) at org.jpmml.rexp.ModelConverter.encodePMML(ModelConverter.java:75) at org.jpmml.rexp.Main.run(Main.java:149) at org.jpmml.rexp.Main.main(Main.java:97) Caused by: java.io.IOException at org.jpmml.xgboost.XGBoostDataInput.readReserved(XGBoostDataInput.java:68) at org.jpmml.xgboost.Learner.load(Learner.java:55) at org.jpmml.xgboost.XGBoostUtil.loadLearner(XGBoostUtil.java:34) at org.jpmml.rexp.XGBoostConverter.loadLearner(XGBoostConverter.java:159) at org.jpmml.rexp.XGBoostConverter.encodeModel(XGBoostConverter.java:88) ... 5 more Error in .convert(tempfile, file, ...) : 1

vruusmann commented 7 years ago

JPMML-R/r2pmml use the JPMML-XGBoost library for actual conversion work; JPMML-XGBoost does support XGBoost 0.6 for quite some time already: https://github.com/jpmml/jpmml-xgboost/commit/ec4bdc669d625dabb34fd63ae24f516d1092428c

I tried using r2pmml

What is your r2pmml version?

a more updated version of XGBoost (ver 6.0-0, which contains some important bug fixes)

The latest release of XGBoost is 0.6: https://github.com/dmlc/xgboost/releases

Where did you get this 6.0-0 from, and how does it differ from 0.6?

Does r2pmml supposed to support this updated version? If not, is there a plan to support it in the near future?

r2pmml supports XGBoost 0.4 and 0.6 releases. Haven't tested with earlier releases.

Could you attach your R XGBoost model to this issue so that I could take a look at it myself?

xgb = xgboost(...)
saveRDS(xgb, "xgb.rds")
gilad19 commented 7 years ago

I am sorry, I meant xgboost 0.6. I updated the r2pmml package and it seems that it fixed the error. Thanks!