How to use the PMML model in Java?

泄露秘密 提交于 2019-12-25 09:22:31

问题


i have build a python file based on randomforestclassifier and made a PMML model, now we need to use this PMML in Java to classify the data into 2 catagories..but this is new to me and i don't know how to handle the java part..


回答1:


Google: pmml java

Second Link is https://github.com/jpmml/jpmml-evaluator

There you have a library with examples. So try it and come back if you have problems.




回答2:


Another choice is PMML4S that is implemented in Scala, but you are free to use it by Scala or Java API. It's very easy to use, for example:

import org.pmml4s.model.Model;

Model model = Model.fromFile("/the/pmml/file/path");
Object result = model.predict(data)

The data could be in Map, Array, A String in JSON, Series, the result type is same as the input. For details how to use PMML4S in Java, you could see the example: https://github.com/autodeployai/pmml4s/blob/master/src/test/java/org/pmml4s/model/JModelTest.java



来源:https://stackoverflow.com/questions/43252501/how-to-use-the-pmml-model-in-java

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!