jpmml / jpmml-lightgbm

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

error with lgb's continue training model file #26

Open buaanie opened 4 years ago

buaanie commented 4 years ago

here is my training code:

gbm = lgb.train(params,
                lgb_valid,
                num_boost_round=5,
                evals_result=result,
                init_model = old_model,
                verbose_eval=5,
                learning_rates=lambda iter: 0.05 * (0.99 ** iter),
                valid_sets=lgb_valid,
                feature_name=list(old_feats)#,categorical_feature = cates
               )
gbm.save_model('lgb_continue.txt')

When i try to convert the "lgb_continue.txt" to pmml, something goes wrong:

Exception in thread "main" java.lang.NullPointerException
        at org.jpmml.lightgbm.Tree.encodeNode(Tree.java:223)
        ...
        at org.jpmml.lightgbm.Tree.encodeNode(Tree.java:236)
        at org.jpmml.lightgbm.Tree.encodeTreeModel(Tree.java:96)
        at org.jpmml.lightgbm.ObjectiveFunction.createMiningModel(ObjectiveFunction.java:66)
        at org.jpmml.lightgbm.BinomialLogisticRegression.encodeMiningModel(BinomialLogisticRegression.java:47)
        at org.jpmml.lightgbm.GBDT.encodeMiningModel(GBDT.java:298)
        at org.jpmml.lightgbm.GBDT.encodePMML(GBDT.java:287)
        at org.jpmml.lightgbm.Main.run(Main.java:131)
        at org.jpmml.lightgbm.Main.main(Main.java:117)

If I don't use continue training , everything will be fine.

purplenigma commented 2 years ago

@vruusmann I have the same problem with version 1.4.3,here is my txt file: PROD_LGBM_1659430603.txt