jpmml/jpmml-lightgbm

categorical features size when some are not in trees

yairdata opened this issue · 3 comments

i am getting the following exception on conversion of the LGBM model which i supplied the categorical_feature parameter to :

Exception in thread "main" java.lang.IllegalArgumentException
        at org.jpmml.lightgbm.GBDT.encodeSchema(GBDT.java:296)
        at org.jpmml.lightgbm.GBDT.encodePMML(GBDT.java:381)
        at org.jpmml.lightgbm.Main.run(Main.java:132)
        at org.jpmml.lightgbm.Main.main(Main.java:118)

i think from looking at the code that the reason is that pandasCategoryIndex is incremented only if it appears in one of the trees , so in my case some of them are not , so the size of the pandas_categorical (that have all of the supplied categorical features ) doesnt match the calculated size (according to the tree appearance).

ok, found the issue - it has to be with counting None featureInfo's with pandasCategoryIndex , i am not sure why it happens. when i removed all the None's columns from the model everything worked.

Need a reproducible example to start looking into this issue.

Closing as not reproducible.