简体   繁体   中英

Huge loss of accuracy after deserializing Machine Learning model made with sklearn2pmml in Java

I have made a machine learning model in Python using scikit-learn. I used sklearn2pmml to serialize it so I can use it in my Java webapplication. I use the pmml4s library in Java to deserialize the model.

I used the model to predict the same values in Python and Java. The Python results are on the left, the Java results on the right. The incorrectly predicted values are circled in blue.

在此处输入图像描述

As you can see the model only makes a single mistake in Python, but makes 4 in Java.

All I do in python is train my model like usual and call this code to serialize it:

sklearn2pmml(pipeline, "DecisionTree.pmml", with_repr = True)

In Java I deserialize the algorithm using:

 Model model = Model.fromFile("src\\main\\resources\\DecisionTree.pmml");

Can anyone explain the loss of accuracy based on this?

If you doubt about the results of the library, you could open an issue in the github: https://github.com/autodeployai/pmml4s/issues . The project maintainers will help you to look into your issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM