autodeployai / pypmml

Python PMML scoring library
Apache License 2.0
75 stars 22 forks source link

Model.fromFile is failing for 3 DMG example PMML files #7

Closed animator closed 4 years ago

animator commented 4 years ago

PMML load is failing for the following PMML files: 1) http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/ensemble_audit_mlp.xml 2) http://dmg.org/pmml/pmml_examples/rattle_pmml_examples/AuditSVM.xml 3) http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/ensemble_iris_mlp.xml

Regards

scorebot commented 4 years ago

@animator Thanks for your reminder. For issues 1 and 3, both are caused by a defect of PMML4S. About issue 2, the model is tricky, it's a binary classification model with only one SupportVectorMachine element, based on the PMML standard 4.0, the attribute alternateTargetCategory is required, while it's absent for such model. Actually, this attribute can be inferred by the other attribute targetCategory, I will enhance this part to let such model work.

I will tell you once all the changes are done.

animator commented 4 years ago

Thanks for looking into the issues!

scorebot commented 4 years ago

I have fixed those issues. Please, reinstall the latest version from Github by the following command:

pip install --upgrade git+https://github.com/autodeployai/pypmml.git

Please, let me know if you still have a problem.

scorebot commented 4 years ago

@animator Can those three models be loaded by the latest version of pypmml successfully?

animator commented 4 years ago

@scorebot Thanks for fixing the issue! pypmml was able to load all the models successfully. Cheers 🎉

mk2020-star commented 4 years ago

Hi, I am still facing the problem PMML load file. 1.) I downloaded pymml library pypmml-0.9.6.tar.gz and py4j-0.10.9-py2.py3-none-any.whl. I used 'pip install' command. 2.) downloaded http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/single_iris_dectree.xml

##########Python Code ########################## from pypmml import Model if name == 'main': model = Model.load('single_iris_dectree.xml')

####### Error Messages ############ File "c:\xx\scikit3.py", line 24, in model = Model.load('single_iris_dectree.xml') File "D:\xx\model.py", line 231, in load model = cls.fromString(model_content) File "D:\xx\model.py", line 196, in fromString pc = PMMLContext.getOrCreate() File "D:\xx\base.py", line 77, in getOrCreate PMMLContext() File "D:\xx\base.py", line 51, in init PMMLContext._ensure_initialized(self, gateway=gateway) File "D:\xx\base.py", line 60, in _ensure_initialized PMMLContext._gateway = gateway or cls.launch_gateway() File "D:\xx\base.py", line 86, in launch_gateway _port = launch_gateway(classpath=launch_classpath, die_on_exit=True) File "D:\xx\Python\lib\site-packages\py4j\java_gateway.py", line 332, in launch_gateway _port = int(proc.stdout.readline()) ValueError: invalid literal for int() with base 10: b'' ############ End of Error################################################

animator commented 4 years ago

@mk2020-star I was not able to recreate the issue, it was working perfectly at my end. Can you run java -version on your terminal and share the results (mine provided below): $ java -version openjdk version "1.8.0_202-release" OpenJDK Runtime Environment (build 1.8.0_202-release-1483-b03) OpenJDK 64-Bit Server VM (build 25.202-b03, mixed mode)

mk2020-star commented 4 years ago

Thanks for the quick response. openjdk version "11.0.3" 2019-04-16 OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.3+7) OpenJDK 64-Bit Server VM (build 11.0.3+7, mixed mode)