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

Integration tests fail on Mac OS #30

Closed AlekseiPol closed 4 years ago

AlekseiPol commented 4 years ago

Hi!

I've got the next error during installation. Fixed by editing ClassificationAuditInvalid for those 3 predictions. I guess difference in 16 decimal is not critical, but the program does not build without this test.

[INFO] Tests run: 14, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 4.62 s - in org.jpmml.lightgbm.RegressionTest
[INFO] Running org.jpmml.lightgbm.ClassificationTest
Conflict{id=478, arguments={Age=50, Employment=Private, Education=HSgrad, Marital=-999, Occupation=Repair, Income=59745.14, Gender=Male, Deductions=FALSE, Hours=40, Adjusted=1}, difference=not equal: value differences={probability(1)=(0.12367296373967719, 0.12367296373967716)}}
Conflict{id=831, arguments={Age=26, Employment=Consultant, Education=College, Marital=-999, Occupation=Repair, Income=120415.46, Gender=Male, Deductions=FALSE, Hours=30, Adjusted=0}, difference=not equal: value differences={probability(1)=(0.0280894042937836, 0.028089404293783607)}}
Conflict{id=864, arguments={Age=34, Employment=Private, Education=HSgrad, Marital=Divorced, Occupation=Clerical, Income=-999, Gender=Male, Deductions=FALSE, Hours=40, Adjusted=0}, difference=not equal: value differences={probability(1)=(0.027595431517656793, 0.0275954315176568)}}
[ERROR] Tests run: 11, Failures: 1, Errors: 0, Skipped: 0, Time elapsed: 2.461 s <<< FAILURE! - in org.jpmml.lightgbm.ClassificationTest

MAC OS - 10.15.2 Python 3.7.3 llightgbm 2.3.1 maven 3.6.3 java version "13.0.1" 2019-10-15 Java(TM) SE Runtime Environment (build 13.0.1+9) Java HotSpot(TM) 64-Bit Server VM (build 13.0.1+9, mixed mode, sharing)

One more small thing: lgbm.fit(boston.data, boston.target, feature_name = boston.feature_names) The type of boston.feature_names is 'numpy.ndarray' and the one should convert it to list before passing to fit function. (at least for my python and modules versions)

vruusmann commented 4 years ago

It's probably a Mac OS-specific issue - I can recall that Java's floating-point computations yield slightly different results on Mac than on Linux or Windows.

Probably won't fix.

You have two workarounds. First, there is no need to build JPMML-LightGBM locally, because there's a library JAR file available in the Maven Central repository, and an executable uber-JAR file in the "releases" page: https://github.com/jpmml/jpmml-lightgbm/releases

Second, you can always disable integration tests during the build:

$ mvn -Dmaven.test.skip=true clean install
AlekseiPol commented 4 years ago

Thank you!