Giter VIP home page Giter VIP logo

Comments (6)

vruusmann avatar vruusmann commented on September 28, 2024

Looks like you have passed null argument to the NearestNeighborModelEvaluator(PMML) constructor. Have you double-checked it already?

JPMML-Evaluator works fine on Android. However, it may be a bit tricky to obtain the org.dmg.pmml.PMML class model object, because you cannot parse PMML documents using the JAXB framework. The only option is to de-serialize it from a Java serialization document.

Have you seen the JPMML-Android project?

from jpmml-evaluator.

leslietso avatar leslietso commented on September 28, 2024

Sorry for the late reply but I've been testing out JPMML-Android. I've been looking over the code of JPMML-Android and I can not seem to find the part where you serialize the pmml file. How did you create the model.pmml.ser file without using JAXBUtil.unmarshalPMML() to generate the org.dmg.pmml.PMML?

from jpmml-evaluator.

vruusmann avatar vruusmann commented on September 28, 2024

The model.pmml.ser file is generated using org.jpmml:pmml-maven-plugin Maven plugin, which is part of the JPMML-Model project. It happens during the packaging of the Android application APK.

Here's an example:
https://github.com/jpmml/jpmml-android/blob/master/pmml-android-example/pom.xml#L52

from jpmml-evaluator.

chenguangshen avatar chenguangshen commented on September 28, 2024

@vruusmann Thanks for the pointer. Any idea on whether it is possible to invoke this plugin in Android Studio/gradle instead of Maven? I understand that you can put a repo url in the top-level gradle file and import a maven library in the module-level gradle file, but I am not sure if the actual transformation defined by execution can be performed using gradle.

Alternatively, do you have a pointer to a piece of code for transforming a model in PMML to SER?

from jpmml-evaluator.

vruusmann avatar vruusmann commented on September 28, 2024

@chenguangshen The SER file is just a Java Serialization file:

org.dmg.pmml.PMML pmml = ...;
try(OutputStream os = new FileOutputStream("model.ser")){
  ObjectOutputStream oos = new ObjectOutputStream(os);
  oos.writeObject(pmml);
  oos.close();
}

For more details, see the SerMojo class that is part of the pmml-maven-module of the JPMML-Model project:
https://github.com/jpmml/jpmml-model/blob/master/pmml-maven-plugin/src/main/java/org/jpmml/model/plugin/SerMojo.java#L192

from jpmml-evaluator.

chenguangshen avatar chenguangshen commented on September 28, 2024

@vruusmann Thanks, this is very helpful!

from jpmml-evaluator.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.