jpmml / jpmml-transpiler

Java Transpiler (Translator + Compiler) API for PMML
GNU Affero General Public License v3.0
28 stars 2 forks source link

Breaking big initializer methods into manageable-size segments #16

Open TPF2017 opened 2 years ago

TPF2017 commented 2 years ago

When I run java -Xms4g -Xmx4g -jar jpmml-transpiler-executable-1.1-SNAPSHOT.jar --pmml-input LambdaRank.pmml --jar-output LambdaRank.pmml.jar

I Got

java.io.IOException at org.jpmml.codemodel.CompilerUtil.compile(CompilerUtil.java:89) at org.jpmml.codemodel.CompilerUtil.compile(CompilerUtil.java:45) at org.jpmml.transpiler.TranspilerUtil.compile(TranspilerUtil.java:75) at org.jpmml.transpiler.Main.run(Main.java:116) at org.jpmml.transpiler.Main.main(Main.java:99)

vruusmann commented 2 years ago

Please provide more information about the compilation error.

You should have a half-baked JAR file somewhere, which contains a problematic Java source code file. You can parse it yourself, or you can give it to me.

TPF2017 commented 2 years ago

jar.zip Do you mean this file?

vruusmann commented 2 years ago

Do you mean this file?

Yes!

You can extract the enclosed PMML$750029115.java Java source code file, and compile it using the command-line javac.exe tool in order to see the real compilation problem:

$ javac -cp pmml-evaluator-example-executable-1.6-SNAPSHOT.jar PMML\$750029115.java 

The error message is:

PMML$750029115.java:20257: error: code too large
        private static void initScores$892555958(DataInputStream dataInput)
                            ^
PMML$750029115.java:20266: error: code too large
        private static void initMethods$892555958() {
                            ^
2 errors

In short, JPMML-Transpiler is generating static initializer methods which exceed some JLS/JVM limits. The root cause is that your GBDT model contains too many child decision tree models.

You should try to limit n_estimators to 1000 for starters.

vruusmann commented 2 years ago

You can extract the enclosed PMML$750029115.java Java source code file, and compile it using the command-line javac.exe tool

FYI, you can satisfy all import requirements by adding the JPMML-Evaluator uber-JAR file to compiler classpath: https://github.com/jpmml/jpmml-evaluator/releases

TPF2017 commented 2 years ago

You can extract the enclosed PMML$750029115.java Java source code file, and compile it using the command-line javac.exe tool

FYI, you can satisfy all import requirements by adding the JPMML-Evaluator uber-JAR file to compiler classpath: https://github.com/jpmml/jpmml-evaluator/releases

Thanks a lot !!