jpmml / jpmml-lightgbm

Java library and command-line application for converting LightGBM models to PMML

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support `-inf` and `inf` as continuous feature bounds

Liyaozhou opened this issue · comments

java.lang.NumberFormatException: For input string: "-inf"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at java.lang.Double.valueOf(Double.java:502)
at org.jpmml.lightgbm.LightGBMUtil.parseInterval(LightGBMUtil.java:214)
at org.jpmml.lightgbm.GBDT.encodeSchema(GBDT.java:277)
at org.jpmml.lightgbm.GBDT.encodePMML(GBDT.java:383)
at org.jpmml.lightgbm.Main.run(Main.java:167)
at org.jpmml.lightgbm.Main.main(Main.java:136)

Exception in thread "main" java.lang.NumberFormatException: For input string: "-inf"
at sun.misc.FloatingDecimal.readJavaFormatString(FloatingDecimal.java:2043)
at sun.misc.FloatingDecimal.parseDouble(FloatingDecimal.java:110)
at java.lang.Double.parseDouble(Double.java:538)
at java.lang.Double.valueOf(Double.java:502)
at org.jpmml.lightgbm.LightGBMUtil.parseInterval(LightGBMUtil.java:214)
at org.jpmml.lightgbm.GBDT.encodeSchema(GBDT.java:277)
at org.jpmml.lightgbm.GBDT.encodePMML(GBDT.java:383)
at org.jpmml.lightgbm.Main.run(Main.java:167)
at org.jpmml.lightgbm.Main.main(Main.java:136)

hi:
Most of the converted lightgbm models contain inf information
for example
[-inf:603.33333333333337] [-inf:194.71428571428572] [0.0023538984627008803:151.26666666666668] [0:inf] [-inf:inf]
If the model contains this information, the above problems will occur
How to solve this problem?

Most of the converted lightgbm models contain inf information

What's your LightGBM version?

My integration tests use LightGBM 3.2(.1), and there is not a single occurrence of -inf or inf.

See:
https://github.com/jpmml/jpmml-lightgbm/blob/master/src/test/resources/main.py

And also see:
https://github.com/jpmml/jpmml-lightgbm/blob/master/src/test/resources/lgbm/ClassificationAudit.txt
https://github.com/jpmml/jpmml-lightgbm/blob/master/src/test/resources/lgbm/RegressionAuto.txt

How can I generate a LightGBM model file that contains inf values?

Please share a reproducible example!