Giter VIP home page Giter VIP logo

jpmml-model's Introduction

Java API for producing and scoring models in Predictive Model Markup Language (PMML).

IMPORTANT

This is a legacy codebase.

Starting from March 2014, this project has been superseded by [JPMML-Model] (https://github.com/jpmml/jpmml-model) and [JPMML-Evaluator] (https://github.com/jpmml/jpmml-evaluator) projects.

Features

Class model

  • Full support for PMML 3.0, 3.1, 3.2, 4.0 and 4.1 schemas:
    • Class hierarchy.
    • Schema version annotations.
  • Fluent API:
    • Value constructors.
  • SAX Locator information
  • [Visitor pattern] (http://en.wikipedia.org/wiki/Visitor_pattern):
    • Validation agents.
    • Optimization and transformation agents.

Evaluation engine

Installation

JPMML library JAR files (together with accompanying Java source and Javadocs JAR files) are released via [Maven Central Repository] (http://repo1.maven.org/maven2/org/jpmml/). Please join the [JPMML mailing list] (https://groups.google.com/forum/#!forum/jpmml) for release announcements.

The current version is 1.0.22 (17 February, 2014).

Class model

<!-- Class model classes -->
<dependency>
	<groupId>org.jpmml</groupId>
	<artifactId>pmml-model</artifactId>
	<version>${jpmml.version}</version>
</dependency>
<!-- Class model annotations -->
<dependency>
	<groupId>org.jpmml</groupId>
	<artifactId>pmml-schema</artifactId>
	<version>${jpmml.version}</version>
</dependency>

Evaluation engine

<dependency>
	<groupId>org.jpmml</groupId>
	<artifactId>pmml-evaluator</artifactId>
	<version>${jpmml.version}</version>
</dependency>

Usage

Class model

The class model consists of two types of classes. There is a small number of manually crafted classes that are used for structuring the class hierarchy. They are permanently stored in the Java sources directory /pmml-model/src/main/java. Additionally, there is a much greater number of automatically generated classes that represent actual PMML elements. They can be found in the generated Java sources directory /pmml-model/target/generated-sources/xjc after a successful build operation.

All class model classes descend from class org.dmg.pmml.PMMLObject. Additional class hierarchy levels, if any, represent common behaviour and/or features. For example, all model classes descend from class org.dmg.pmml.Model.

There is not much documentation accompanying class model classes. The application developer should consult with the [PMML specification] (http://www.dmg.org/v4-1/GeneralStructure.html) about individual PMML elements and attributes.

Example applications

Evaluation engine

A model evaluator class can be instantiated directly when the contents of the PMML document is known:

PMML pmml = ...;

ModelEvaluator<TreeModel> modelEvaluator = new TreeModelEvaluator(pmml);

Otherwise, a PMML manager class should be instantiated first, which will inspect the contents of the PMML document and instantiate the right model evaluator class later:

PMML pmml = ...;

PMMLManager pmmlManager = new PMMLManager(pmml);
 
ModelEvaluator<?> modelEvaluator = (ModelEvaluator<?>)pmmlManager.getModelManager(null, ModelEvaluatorFactory.getInstance());

Model evaluator classes follow functional programming principles. Model evaluator instances are cheap enough to be created and discarded as needed (ie. not worth the pooling effort).

It is advisable for application code to work against the org.jpmml.evaluator.Evaluator interface:

Evaluator evaluator = (Evaluator)modelEvaluator;

An evaluator instance can be queried for the definition of active (ie. independent), predicted (ie. primary dependent) and output (ie. secondary dependent) fields:

List<FieldName> activeFields = evaluator.getActiveFields();
List<FieldName> predictedFields = evaluator.getPredictedFields();
List<FieldName> outputFields = evaluator.getOutputFields();

The PMML scoring operation must be invoked with valid arguments. Otherwise, the behaviour of the model evaluator class is unspecified.

The preparation of field values:

Map<FieldName, FieldValue> arguments = new LinkedHashMap<FieldName, FieldValue>();

List<FieldName> activeFields = evaluator.getActiveFields();
for(FieldName activeField : activeFields){
	// The raw (ie. user-supplied) value could be any Java primitive value
	Object rawValue = ...;

	// The raw value is passed through: 1) outlier treatment, 2) missing value treatment, 3) invalid value treatment and 4) type conversion
	FieldValue activeValue = evaluator.prepare(activeField, rawValue);

	arguments.put(activeField, activeValue);
}

The scoring:

Map<FieldName, ?> results = evaluator.evaluate(arguments);

Typically, a model has exactly one predicted field, which is called the target field:

FieldName targetName = evaluator.getTargetField();
Object targetValue = results.get(targetName);

The target value is either a Java primitive value (as a wrapper object) or an instance of org.jpmml.evaluator.Computable:

if(targetValue instanceof Computable){
	Computable computable = (Computable)targetValue;

	Object primitiveValue = computable.getResult();
}

The target value may implement interfaces that descend from interface org.jpmml.evaluator.ResultFeature:

// Test for "entityId" result feature
if(targetValue instanceof HasEntityId){
	HasEntityId hasEntityId = (HasEntityId)targetValue;
	HasEntityRegistry<?> hasEntityRegistry = (HasEntityRegistry<?>)evaluator;
	BiMap<String, ? extends Entity> entities = hasEntityRegistry.getEntityRegistry();
	Entity winner = entities.get(hasEntityId.getEntityId());

	// Test for "probability" result feature
	if(targetValue instanceof HasProbability){
		HasProbability hasProbability = (HasProbability)targetValue;
		Double winnerProbability = hasProbability.getProbability(winner.getId());
	}
}
Example applications

Additional information

Please contact [[email protected]] (mailto:[email protected])

jpmml-model's People

Contributors

vruusmann avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

jpmml-model's Issues

An empty MiningSchema is a deviation from the PMML standard

First, I am a big fan of the JPMML project, and I'm excited to observe its growth during the last years.

Recently, I tried jpmml-sklearn to convert an XGB model to its PMML format. Following, I add the Python script. I noticed that some of the tree models have an empty MiningSchema. An empty MiningSchema is a deviation from the PMML standard.
Here is the format of MiningSchema specified by the standard (https://dmg.org/pmml/v4-4-1/MiningSchema.html):

<xs:element name="MiningSchema">
  <xs:complexType>
    <xs:sequence>
      <xs:element ref="Extension" minOccurs="0" maxOccurs="unbounded"/>
      <xs:element maxOccurs="unbounded" ref="MiningField"/>
    </xs:sequence>
  </xs:complexType>
</xs:element>

Based on XML Schema guideline, the default value of minOccurs is 1 (https://www.w3.org/TR/xmlschema-0/#:~:text=The%20default%20value%20for%20both,not%20occur%20more%20than%20once.). Therefor, a MiningSchema must have at least one MiningField. We may file an issue on the Github page of JPMML.

It is correct that the tree models with empty MiningSchema have only a root node (no use of any input field), but they could still have defined MiningFields. In other words, a model can have defined inputs that are not used inside the model for prediction. To best of my understanding, a model as a black box in the PMML standard cannot be without any inputs; regardless of the fact how those inputs are utilized.

The Python script

from sklearn import datasets
import pandas as pd
import xgboost as xgb

iris = datasets.load_iris()
print(iris.target_names)
print(iris.feature_names)
print(iris.data[0:5])
print(iris.target)

data=pd.DataFrame({
    'sepal length':iris.data[:,0],
    'sepal width':iris.data[:,1],
    'petal length':iris.data[:,2],
    'petal width':iris.data[:,3],
    'species':iris.target
})
data.head()
from sklearn.model_selection import train_test_split

X=data[['sepal length', 'sepal width', 'petal length', 'petal width']]  # Features
y=data['species']  # Labels
X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.3) # 70% training and 30% test
clf=xgb.XGBClassifier()
clf.fit(X_train,y_train)
y_pred=clf.predict(X_test)
from sklearn import metrics
print("Accuracy:",metrics.accuracy_score(y_test, y_pred))

from sklearn2pmml import sklearn2pmml, make_pmml_pipeline
pmml_obj = make_pmml_pipeline(clf)  
sklearn2pmml(pmml_obj,"xgb_iris.xml")
print("Model exported as PMML successfully.Filename: xgb_iris.xml " )

Broken build.

Trying to build this project raises errors related to ErrorListener import
A required class was missing while executing org.jvnet.jaxb2.maven2:maven-jaxb22-plugin:0.13.1:generate: com/sun/xml/bind/api/ErrorListener

Full logs of failed build with -X flag included.

logs.txt

org.xml.sax.helpers.LocatorImpl not serializable when transforming a PMML file to an SER file

Based on the example of jpmml-android I am trying to evaluate a few PMML models generated by sklearn2pmml. Since I am using Android Studio + gradle, I cannot really use the maven plugin to transform PMML files to SER files. So I created a bare-bone Java program based on https://github.com/jpmml/jpmml-model/blob/master/pmml-maven-plugin/src/main/java/org/jpmml/model/plugin/SerMojo.java and https://github.com/jpmml/jpmml-android/blob/master/pmml-android-example/pom.xml:

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.InputStream;
import java.io.OutputStream;
import javax.xml.transform.Source;

import org.dmg.pmml.PMML;
import org.jpmml.model.ImportFilter;
import org.jpmml.model.JAXBUtil;
import org.jpmml.model.SerializationUtil;
import org.jpmml.model.visitors.StringInterner;
import org.xml.sax.InputSource;

public class PMMLTransformer {
    private final static String BASE_PATH = "./";

    public static void main(String[] args) throws Exception {
        File pmmlFile = new File(BASE_PATH + "/model.pmml");
        File serFile = new File(BASE_PATH + "/model.pmml.ser");

        // Parse a pmml object from a file
        PMML pmml;
        try (InputStream is = new FileInputStream(pmmlFile)) {
            Source source = ImportFilter.apply(new InputSource(is));
            pmml = JAXBUtil.unmarshalPMML(source);
        }

        // Apply a visitor
        StringInterner visitor = new StringInterner();
        visitor.applyTo(pmml);

        // Write an ser file from the pmml object
        try (OutputStream os = new FileOutputStream(serFile)) {
            SerializationUtil.serializePMML(pmml, os);
        }
    }
}

Which generates an Exception on serialization:

Exception in thread "main" java.io.NotSerializableException: org.xml.sax.helpers.LocatorImpl
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1184)
	at java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1548)
	at java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1509)
	at java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1432)
	at java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1178)
	at java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:348)
	at org.jpmml.model.SerializationUtil.serialize(SerializationUtil.java:57)
	at org.jpmml.model.SerializationUtil.serializePMML(SerializationUtil.java:43)
	at edu.ucla.nesl.toolkit.pmmltransformer.PMMLTransformer.main(PMMLTransformer.java:46)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:483)
	at com.intellij.rt.execution.application.AppMain.main(AppMain.java:147)

Process finished with exit code 1

Both jpmml-model and jpmml-evaluator are on 1.3.3

Any suggestions? Thanks!

Large `MapValues` elements are loaded very slowly in newer library versions

Hi, Villu.
We are trying to upgrade our Java service, that uses JPMML library, to Java 11 but encountered an issue with evaluation time after the upgrade.

The application docker image: openjdk:11-jre
The jpmml library version: 1.5.14 (also we've tried with 1.5.16; we haven't tried 1.6.0 because for upgrading to this version we need to refactor the code due to changes in this version)

The evaluation code:

long startHandle = System.currentTimeMillis();  
byte[] pmmlFileContent = pmmlFile.getContent();
String uncompressedValue = new String(pmmlFileContent, StandardCharsets.UTF_8);  
StringInputStream source = new StringInputStream(uncompressedValue);  
Evaluator evaluator = new LoadingModelEvaluatorBuilder().load(source).build();  
optimizePmml(((ModelEvaluator<?>) evaluator).getPMML());  
  
try {  
    evaluator.verify();  
} catch (Exception e) {  
    errorLogger.reportError(INIT, LOAD, CRITICAL, String.format("PMML file %s is incorrect", pmmlFile.getName()));  
 throw e;  
}  
EvaluatorMetadata evaluatorMetadata = extractMetadataFields(evaluator, pmmlFile);  
PMMLEvaluatorContainer pmmlEvaluatorContainer = new PMMLEvaluatorContainer(evaluator, evaluatorMetadata);

The possible solution suggested by you as we've found:
https://openscoring.io/blog/2019/02/28/jpmml_model_api_configuring_jaxb_dependency/
https://groups.google.com/g/jpmml/c/bLvhf3MIQp0/m/j9DHDRo4AQAJ

If the โ€ฆ Java/JVM does not provide built in JAXB runtime,
then perhaps it's possible to include an independent 3rd party JAXB
runtime into the project? The JPMML-Model project contains two modules
org.jpmml:pmml-model-metro and org.jpmml:pmml-model-moxy, which should
include a full runtime dependency of Glassfish Metro and EclipseLink
MOXy JAXB runtimes, respectively. I'd personally experiment with
depending on the org.jpmml:pmml-model-moxy module (instead of the
standard org.jpmml:pmml-model module), as EclipseLink as a third party
vendor might more flexible/less intrusive in their approach.

Also, it should be remembered that newer Java/JVM SE versions also do
not include JAXB runtime. However, using the suggested modules has got
things working for me on all Java SE 9, 10, 11 and 12 so far.

Unfortunately using the new dependency -metro and the latest version rewuires change in the code that currently we cannot allow us to perform.

The another solution was to leave the current pmml-evaluator version and add explicitly JAXB dependencies:

<dependency>
    <groupId>org.jpmml</groupId>
    <artifactId>pmml-evaluator</artifactId>
    <version>1.5.14</version>
</dependency>
<dependency>
    <groupId>org.jpmml</groupId>
    <artifactId>pmml-evaluator-extension</artifactId>
    <version>1.5.14</version>
</dependency>
<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>2.3.2</version>
</dependency>
<dependency>
    <groupId>javax.activation</groupId>
    <artifactId>javax.activation-api</artifactId>
    <version>1.2.0</version>
</dependency>
<dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
    <version>2.3.2</version>
</dependency>

This solution has lead to an increased evaluation time of PMML files (with Java 8 we have up to 5 ms average evaluation for each file):

2021-12-28 13:57:13,685 [pool-2-thread-5] INFO  [PriorityManagerImpl] Finished to handle the pmml [3100] file [25649] ms
2021-12-28 13:57:13,721 [pool-2-thread-8] INFO  [PriorityManagerImpl] Finished to handle the pmml [3300] file [25588] ms
2021-12-28 13:57:14,297 [pool-2-thread-11] INFO  [PriorityManagerImpl] Finished to handle the pmml [3400] file [15163] ms
2021-12-28 13:57:14,596 [pool-2-thread-7] INFO  [PriorityManagerImpl] Finished to handle the pmml [3200] file [25095] ms
2021-12-28 14:02:02,839 [pool-2-thread-4] INFO  [PriorityManagerImpl] Finished to handle the pmml [3102] file [312919] ms
2021-12-28 14:02:03,502 [pool-2-thread-12] INFO  [PriorityManagerImpl] Finished to handle the pmml [3302] file [315177] ms
2021-12-28 14:02:04,817 [pool-2-thread-6] INFO  [PriorityManagerImpl] Finished to handle the pmml [3402] file [313270] ms
2021-12-28 14:02:09,896 [pool-2-thread-8] INFO  [PriorityManagerImpl] Finished to handle the pmml [3202] file [295978] ms

Upgrading the dependency as described on GitHub page (https://github.com/jpmml/jpmml-evaluator) leads to the same evaluation time:

2021-12-28 14:43:59,059 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 1794766 size to pmml file 3300
2021-12-28 14:43:59,100 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 1198828 size to pmml file 3100
2021-12-28 14:43:59,102 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 1737901 size to pmml file 3102
2021-12-28 14:43:59,332 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 2085889 size to pmml file 3302
2021-12-28 14:43:59,656 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 10188345 size to pmml file 3400
2021-12-28 14:43:59,734 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 6968065 size to pmml file 21191331
2021-12-28 14:43:59,845 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 6280020 size to pmml file 61331
2021-12-28 14:43:59,932 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 11274487 size to pmml file 20691331
2021-12-28 14:44:00,031 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 10969208 size to pmml file 21391331
2021-12-28 14:44:00,080 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 5387857 size to pmml file 21291331
2021-12-28 14:44:00,147 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 15703073 size to pmml file 3200
2021-12-28 14:44:00,297 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 16025233 size to pmml file 3402
2021-12-28 14:44:00,499 [async-channel-group-0-handler-executor] INFO  [PmmlGridFsDao] Loaded 21234942 size to pmml file 3202
2021-12-28 14:44:20,477 [pool-2-thread-2] INFO  [PriorityManagerImpl] Finished to handle the pmml [3100] file [21374] ms
2021-12-28 14:44:20,514 [pool-2-thread-4] INFO  [PriorityManagerImpl] Finished to handle the pmml [3300] file [21431] ms
2021-12-28 14:44:21,143 [pool-2-thread-10] INFO  [PriorityManagerImpl] Finished to handle the pmml [3400] file [21486] ms
2021-12-28 14:44:21,440 [pool-2-thread-1] INFO  [PriorityManagerImpl] Finished to handle the pmml [3200] file [21292] ms
2021-12-28 14:49:23,238 [pool-2-thread-11] INFO  [PriorityManagerImpl] Finished to handle the pmml [3302] file [323904] ms
2021-12-28 14:49:24,054 [pool-2-thread-3] INFO  [PriorityManagerImpl] Finished to handle the pmml [3102] file [324951] ms
2021-12-28 14:49:26,909 [pool-2-thread-7] INFO  [PriorityManagerImpl] Finished to handle the pmml [3402] file [326611] ms
2021-12-28 14:49:30,200 [pool-2-thread-2] INFO  [PriorityManagerImpl] Finished to handle the pmml [3202] file [309723] ms

Upgrading to the version 1.5.16 gives the same result as described previously:

<dependency>
    <groupId>org.jpmml</groupId>
    <artifactId>pmml-evaluator-metro</artifactId>
    <version>1.5.16</version>
</dependency>

We'll appreciate if you could advise a solution for this issue.
Regards,
Pavel

A Visitor for creating a Target element that handles the conversion of regression results from `double` value space to `integer` value space

Several PMML producers (eg. KNIME, Pervasive DataRush) are known to produce PMML documents where a double result is directly assigned to integer target field:

<DataDictionary>
  <DataField name="myResult" dataType="integer"/>
</DataDictionary>
<RegressionModel functionName="regression">
  <MiningSchema>
    <MiningField name="myResult" usageType="target"/>
  </MiningSchema>
</RegressionModel>

The JPMML-Evaluator library rightfully throws a TypeCheckException when asked to evaluate such PMML documents:

Caused by: org.jpmml.evaluator.TypeCheckException: Expected INTEGER, but got DOUBLE (7.710705172582081)
        at org.jpmml.evaluator.TypeUtil.toInteger(TypeUtil.java:533)
        at org.jpmml.evaluator.TypeUtil.cast(TypeUtil.java:422)
        at org.jpmml.evaluator.TargetUtil.evaluateRegressionInternal(TargetUtil.java:86)
        at org.jpmml.evaluator.TargetUtil.evaluateRegression(TargetUtil.java:52)
        at org.jpmml.evaluator.RegressionModelEvaluator.evaluateRegression(RegressionModelEvaluator.java:100)

These PMML documents need to be corrected by introducing a Target element, which would make the conversion from double (or float) value space to integer value space explicit:

<RegressionModel>
  <Targets>
    <Target field="myResult" castInteger="round"/>
  </Targets>
</RegressionModel>

This correction can be easily implemented using the Visitor approach. For maximal convenience, the JPMML-Model library should provide a default implementation, which could be applied by writing no more than two lines of application code:

Visitor corrector = new CastIntegerCorrector(Target.CastInteger.ROUND);
corrector.applyTo(pmml);

Field `PMML#extensions` should be in the last position, not in the first position

PMML 4.3 XSD specifies that if a PMML element has Extension child elements, then they should be in the last position. However, this structural constraint in not reflected in the JAXB generated Java source code:

@XmlType(name = "", propOrder = {
    "extensions", // THIS: should be the last element of the array
    "header",
    "miningBuildTask",
    "dataDictionary",
    "transformationDictionary",
    "models"
})
@XmlRootElement(name = "PMML", namespace = "http://www.dmg.org/PMML-4_3")
public class PMML extends org.dmg.pmml.PMMLObject {}

Such misplaced Extension elements cause a XML schema validation error.

NoClassDefFoundError when using ImportFilter method.

I am getting this error while running this piece of code. I am not sure as how to resolve it. Please help me.

try{

       InputStream is = new FileInputStream(file); 



       Source transformedSource = ImportFilter.apply(new InputSource(is));

       pmml=JAXBUtil.unmarshalPMML(transformedSource);

   } catch( Exception e) {
      System.out.println( e.toString() );
      throw e;
   }

}

java.lang.NoClassDefFoundError: org/jpmml/schema/Version
at com.norkorm.blake.pmml.LinearRegressionPMMLTest.loadModel(LinearRegressionPMMLTest.java:330)
at com.norkorm.blake.pmml.LinearRegressionPMMLTest.testLinearPMML(LinearRegressionPMMLTest.java:259)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:606)
at junit.framework.TestCase.runTest(TestCase.java:176)
at junit.framework.TestCase.runBare(TestCase.java:141)
at junit.framework.TestResult$1.protect(TestResult.java:122)
at junit.framework.TestResult.runProtected(TestResult.java:142)
at junit.framework.TestResult.run(TestResult.java:125)
at junit.framework.TestCase.run(TestCase.java:129)
at junit.framework.TestSuite.runTest(TestSuite.java:255)
at junit.framework.TestSuite.run(TestSuite.java:250)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:84)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:86)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:459)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:675)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:382)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:192)
Caused by: java.lang.ClassNotFoundException: org.jpmml.schema.Version
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 21 more

SAX whitespace filter is deleting significant whitespace

The org.jpmml.model.filters.WhitespaceFilter class drops all whitespace from the input stream. This is correct/permitted behaviour when dealing with PMML content, which treats whitespace as non-significant.

However, it is possible that PMML content may contain embeddings of other XML dialects, which treat whitespace as significant.

The case in point are the rows of the InlineTable element. Consider the following TextIndexNormalization element (english "stop words"):

<TextIndexNormalization recursive="true">
	<InlineTable>
		<row>
			<string>(^|\s+)\p{Punct}*(a|about|above|across|after|afterwards|again|against|all|almost|alone|along|already|also|although|always|am|among|amongst|amoungst|amount|an|and|another|any|anyhow|anyone|anything|anyway|anywhere|are|around|as|at|back|be|became|because|become|becomes|becoming|been|before|beforehand|behind|being|below|beside|besides|between|beyond|bill|both|bottom|but|by|call|can|cannot|cant|co|con|could|couldnt|cry|de|describe|detail|do|done|down|due|during|each|eg|eight|either|eleven|else|elsewhere|empty|enough|etc|even|ever|every|everyone|everything|everywhere|except|few|fifteen|fifty|fill|find|fire|first|five|for|former|formerly|forty|found|four|from|front|full|further|get|give|go|had|has|hasnt|have|he|hence|her|here|hereafter|hereby|herein|hereupon|hers|herself|him|himself|his|how|however|hundred|i|ie|if|in|inc|indeed|interest|into|is|it|its|itself|keep|last|latter|latterly|least|less|ltd|made|many|may|me|meanwhile|might|mill|mine|more|moreover|most|mostly|move|much|must|my|myself|name|namely|neither|never|nevertheless|next|nine|no|nobody|none|noone|nor|not|nothing|now|nowhere|of|off|often|on|once|one|only|onto|or|other|others|otherwise|our|ours|ourselves|out|over|own|part|per|perhaps|please|put|rather|re|same|see|seem|seemed|seeming|seems|serious|several|she|should|show|side|since|sincere|six|sixty|so|some|somehow|someone|something|sometime|sometimes|somewhere|still|such|system|take|ten|than|that|the|their|them|themselves|then|thence|there|thereafter|thereby|therefore|therein|thereupon|these|they|thick|thin|third|this|those|though|three|through|throughout|thru|thus|to|together|too|top|toward|towards|twelve|twenty|two|un|under|until|up|upon|us|very|via|was|we|well|were|what|whatever|when|whence|whenever|where|whereafter|whereas|whereby|wherein|whereupon|wherever|whether|which|while|whither|who|whoever|whole|whom|whose|why|will|with|within|without|would|yet|you|your|yours|yourself|yourselves)\p{Punct}*(\s+|$)</string>
			<stem> </stem>
			<regex>true</regex>
		</row>
	</InlineTable>
</TextIndexNormalization>

The sole body row contains three elements string, stem and regex which do not belong to a XML schema/namespace, and which treat whitespace as significant.

The current SAX whitespace filter is truncating <stem> <stem> (single space) to <stem></stem> (aka <stem/>), which is an error.

IllegalAccessError while parsing PMML File

Hello,

I'm trying to build a RapidMiner extension to read PMML models.
However I'm getting the following exception when unmarshaling a pmml file:

java.lang.IllegalAccessError: Class com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection can not access a member of class org.dmg.pmml.PMML with modifiers "private"
	at com.sun.xml.internal.bind.v2.runtime.reflect.Accessor$FieldReflection.set(Accessor.java:262)
	at com.sun.xml.internal.bind.v2.runtime.reflect.TransducedAccessor$CompositeTransducedAccessorImpl.parse(TransducedAccessor.java:230)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.StructureLoader.startElement(StructureLoader.java:195)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext._startElement(UnmarshallingContext.java:559)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallingContext.startElement(UnmarshallingContext.java:538)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.SAXConnector.startElement(SAXConnector.java:153)
	at org.xml.sax.helpers.XMLFilterImpl.startElement(XMLFilterImpl.java:551)
	at org.jpmml.model.PMMLFilter.startElement(PMMLFilter.java:69)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.startElement(AbstractSAXParser.java:509)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.scanStartElement(XMLNSDocumentScannerImpl.java:374)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl$NSContentDriver.scanRootElementHook(XMLNSDocumentScannerImpl.java:613)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3132)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:852)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:602)
	at com.sun.org.apache.xerces.internal.impl.XMLNSDocumentScannerImpl.next(XMLNSDocumentScannerImpl.java:112)
	at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:505)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:841)
	at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:770)
	at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:141)
	at com.sun.org.apache.xerces.internal.parsers.AbstractSAXParser.parse(AbstractSAXParser.java:1213)
	at org.xml.sax.helpers.XMLFilterImpl.parse(XMLFilterImpl.java:357)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal0(UnmarshallerImpl.java:243)
	at com.sun.xml.internal.bind.v2.runtime.unmarshaller.UnmarshallerImpl.unmarshal(UnmarshallerImpl.java:214)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:140)
	at javax.xml.bind.helpers.AbstractUnmarshallerImpl.unmarshal(AbstractUnmarshallerImpl.java:123)
	at org.jpmml.model.JAXBUtil.unmarshal(JAXBUtil.java:78)
	at org.jpmml.model.JAXBUtil.unmarshalPMML(JAXBUtil.java:64)
	at org.jpmml.model.PMMLUtil.unmarshal(PMMLUtil.java:34)
	at de.woistbier.rapidminer.pmml.operator.PMMLEvaluator.read(PMMLEvaluator.java:118)
	at de.woistbier.rapidminer.pmml.operator.PMMLEvaluator.read(PMMLEvaluator.java:34)
	at com.rapidminer.operator.io.AbstractReader.doWork(AbstractReader.java:126)
	at com.rapidminer.operator.Operator.execute(Operator.java:1005)
	at com.rapidminer.operator.execution.SimpleUnitExecutor.execute(SimpleUnitExecutor.java:77)
	at com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:812)
	at com.rapidminer.operator.ExecutionUnit$3.run(ExecutionUnit.java:807)
	at java.security.AccessController.doPrivileged(Native Method)
	at com.rapidminer.operator.ExecutionUnit.execute(ExecutionUnit.java:807)
	at com.rapidminer.operator.OperatorChain.doWork(OperatorChain.java:428)
	at com.rapidminer.operator.Operator.execute(Operator.java:1005)
	at com.rapidminer.Process.run(Process.java:1205)
	at com.rapidminer.Process.run(Process.java:1101)
	at com.rapidminer.Process.run(Process.java:1054)
	at com.rapidminer.Process.run(Process.java:1049)
	at com.rapidminer.Process.run(Process.java:1039)
	at com.rapidminer.gui.ProcessThread.run(ProcessThread.java:65)

This might be general problem when having restrictive security managers. So maybe making some fields in class org.dmg.pmml.PMML public could help.
Any other ideas?

EmbeddedModel Not support

Whether EmbeddedModel supported or Not ?

What i got when debug my program below:

@Override
public VisitorAction visit(Regression regression){
	-> throw new UnsupportedOperationException();
}

API to check validity of a pmml

Hi - I am exploring jpmml and was looking for some function to validate if the supplied pmml is valid or not. Can you please help me in this.

While testing, it was observed that even though the pmml gets loaded and evaluator instance is created, still during evaluation we get error due to pmml being invalid (for example DataField@dataType is not defined). We are trying to avoid such runtime failure, so was looking for api to check the validity.

Extension mechanism for jpmml-model

When I try to unmarshal a xml to a jpmml model it wont contain the data specified in the extensions tag. As far as I can tell there is no way to access this or extend the JAXB models without rewriting an important portion of it.

  <Extension>
    <Extension1>
<MyExample>
<MiningData>abcd</MiningData>
</MyExample>
    </Extension1>
    <Extension2>
<MyExample>
<MiningData>abcd</MiningData>
</MyExample>
    </Extension2>
 </Extension>

The result of this extension would be:

[Extension1: null]
[Extension2: null]

How could the PMML extension mechanism be used to read the content of extensions without rewriting the parsing mechanism, but rather by extending jpmml?

Supporting Model details

Would like to know supporting model details, I am not finding the list of supporting and supporting models. If any of model not supporting then let us know other way solution to full fill the complete model supporting method

Concurrent use of FieldName appears to deadlock on cache map.

We use Apache Spark to run our processing concurrently. Part of this processing uses JPMML FieldName in the process. The concurrent access of the WeakHashMap cache can produce deadlocks as demonstrated by the stack traces in this gist: https://gist.github.com/InvisibleTech/4e9997d4954ed60382ea

We have a test that reproduces the issue in an extreme way . We will be posting this as a gist and will link it here. In the short term we are trying to work around this issue.

Here is a self-contained test that shows the issue using Java and pmml_model: https://github.com/tdbaldwin/BreakWeakHashMap

NOTE: due to some of the random aspects of this test (like System.gc) we have found that running this test on CENTOS and OSX you may need to run this test more than once to produce the deadlock:

mvn test

is sufficient.

Prior to posting this defect we read these resources:
https://access.redhat.com/solutions/55161 <-- others encountered issues in other stacks
#1 <-- we read this and we do not have this issue of use
http://www.adam-bien.com/roller/abien/entry/endless_loops_in_unsychronized_weakhashmap <-- this type of claim is easy to find by searching.
http://mailinator.blogspot.com/2009/06/beautiful-race-condition.html <- interesting discussion

Supporting PMML model types

Hi,

What are the pmml model types supports this jpmml model API? I am new to this pmml parsing using jpmml api, can have any reference for execution of pmml models. Please help on this.

Downgrading PMML-4_4 to PMML-4_3

Hi,

I have made a lightGBM model and converted it to a PMML using the jpmml-lightgbm library.
The output file contains .

The issue with this is that I was trying to import this model file into a software that only accepts "http://www.dmg.org/PMML-4_3" versions or lower. I managed to use the org.jpmml.model.example.CopyExample tool but I can only get this to create a file with the latest PMML version.
I was wondering if there is a way to downgrade PMML version.

Kind regards,
Ivan Robles

Cannot update pmml-android from 1.3.6 to 1.4.15 due to jackson dependency

I try to update pmml-android from 1.3.6 to 1.4.15. But it cannot run mvn clean install successfully. It shows the following errors:

[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for JPMML-Android 1.0-SNAPSHOT:
[INFO] 
[INFO] JPMML-Android ...................................... SUCCESS [  0.158 s]
[INFO] pmml-android ....................................... SUCCESS [  3.407 s]
[INFO] pmml-android-example ............................... FAILURE [01:19 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:24 min
[INFO] Finished at: 2020-02-19T18:09:49+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.jpmml:pmml-maven-plugin:1.4.15:ser (default) on project pmml-android-example: Execution default of goal org.jpmml:pmml-maven-plugin:1.4.15:ser failed: Plugin org.jpmml:pmml-maven-plugin:1.4.15 or one of its dependencies could not be resolved: Failed to collect dependencies at org.jpmml:pmml-maven-plugin:jar:1.4.15 -> org.jpmml:pmml-model-jackson:jar:1.4.15 -> com.fasterxml.jackson.core:jackson-databind:jar:2.9.0,pr4-SNAPSHOT: Failed to read artifact descriptor for com.fasterxml.jackson.core:jackson-databind:jar:2.9.0,pr4-SNAPSHOT: Could not find artifact com.fasterxml.jackson:jackson-bom:pom:2.9.0.pr4-SNAPSHOT in sonatype-nexus-snapshots (https://oss.sonatype.org/content/repositories/snapshots) -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException
[ERROR] 
[ERROR] After correcting the problems, you can resume the build with the command
[ERROR]   mvn <goals> -rf :pmml-android-example

How can I solve this issue?

Cannot load JSON neither YAML in Android

Hi.

I've been trying (a lot) to use jpmml to load PMML-based models to Android apps - the goal, of course, is to have on-device inference - but I've been facing too many problems with too many approaches.

The one I'm reporting here is for both JSON and YAML models.
Let's take, as example, the decision tree pmml model over the iris dataset that you made available on the archived jpmml-android repository (but you can use any other). I've been using version 1.5.15 of both jpmml-model and jpmml-evaluator.

  1. The first step was to translate the pmml model to json/yaml (successfully) as follows:
    java -cp pmml-model-example/target/pmml-model-example-executable-1.6-SNAPSHOT.jar org.jpmml.model.example.TranslationExample --input result/model.pmml --output result/model.json
    or
    java -cp pmml-model-example/target/pmml-model-example-executable-1.6-SNAPSHOT.jar org.jpmml.model.example.TranslationExample --input result/model.pmml --output result/model.yaml

  2. Then, placed both files on the assets folder of the Android app (successfully);

  3. For model.json file: after loading it from the assets manager, I've used the JacksonUtil.readPMML(inputStream) method from the pmml-model/pmml-model-jackson lib. I had no luck and got a huge stack trace;

  4. For model.yaml file: I had a little more work but faced a similar problem. I had to import the com.fasterxml.jackson.dataformat.yaml package to set the YAMLFactory, which I set on the objectMapper. Again, a huge stack trace, pretty similar to the one of the json file.

Both log files are attached to this issue but what you will see is a lot ot "Unable to resolve java.lang.Class<org.dmg.pmml.XXXX> annotation class YYYY" and a "java.lang.NoClassDefFoundError: Failed resolution of: Ljavax/xml/bind/annotation/adapters/XmlAdapter" which leads to "Failed resolution of: Lorg/dmg/pmml/adapters/NumberAdapter".
Android_json_log.txt
Android_yaml_log.txt

Any idea why this is happening and how can we, indeed, use json/yaml pmml-based files in Android since, as per the README, it is one of the supported platforms?
A clear tutorial would be nice though.

Cheers,
Bruno

SimplePredicate doesn't prepare parsed value

Hi,

Profiled garbage and CPU consumption of jpmml-evaluator in our project and found that SimplePredicate contains only string value and doesn't prepare parsed value. Additionally, it only implemented HasValue and doesn't implement HasParsedValue.

As a result, when we compare FieldValue from evaluator's input with SimplePredicate in FieldValue#compareTo(HasValue hasValue) we always go to compareToString(hasValue.getValue()) branch with producing garbage and loosing CPU on parsing SimplePredicate's value on each check.

No reasons actually for such design, because at least in the case of trees we have full information about SimplePredicate's value type in tree description. For example:
<DerivedField name="x12" optype="continuous" dataType="float">
In worst case - SimplePredicate could prepare parsed results just for all types on setValue(String value) to return them from HasParsedValue's method.

Looks like this improvement could potentially reduce garbage and save a significant amount of CPU time.

A required class was missing while executing com.simpligility.maven.plugins:android-maven-plugin:4.6.0: javax/xml/bind/annotation/XmlSchema

Hi! I'm working on my bachelor's degree. I need to create an Android application to recognize human activity using smartphone's sensors. I am not sure if I understood how can I do this, but I used the decision tree algorithm in RStudio, then I converted it to pmml file and I want to import it in android application but I need to convert it to .ser file.

I wrote the pom.xml file but when I run maven from command line, I have this error.

[ERROR] Failed to execute goal com.simpligility.maven.plugins:android-maven-plugin:4.6.0:generate-sources (default-generate-sources) on project app-example: Execution default-generate-sources of goal com.simpligility.maven.plugins:android-maven-plugin:4.6.0:generate-sources failed: A required class was missing while executing com.simpligility.maven.plugins:android-maven-plugin:4.6.0:generate-sources: javax/xml/bind/annotation/XmlSchema
[ERROR] -----------------------------------------------------
[ERROR] realm =    extension>com.simpligility.maven.plugins:android-maven-plugin:4.6.0
[ERROR] strategy = org.codehaus.plexus.classworlds.strategy.SelfFirstStrategy
[ERROR] urls[0] = file:/C:/Users/viori/.m2/repository/com/simpligility/maven/plugins/android-maven-plugin/4.6.0/android-maven-plugin-4.6.0.jar
[ERROR] urls[1] = file:/C:/Users/viori/.m2/repository/com/android/tools/annotations/25.3.0/annotations-25.3.0.jar
[ERROR] urls[2] = file:/C:/Users/viori/.m2/repository/com/android/tools/common/25.3.0/common-25.3.0.jar
[ERROR] urls[3] = file:/C:/Users/viori/.m2/repository/com/google/guava/guava/18.0/guava-18.0.jar
[ERROR] urls[4] = file:/C:/Users/viori/.m2/repository/com/android/tools/dvlib/25.3.0/dvlib-25.3.0.jar
[ERROR] urls[5] = file:/C:/Users/viori/.m2/repository/com/android/tools/sdk-common/25.3.0/sdk-common-25.3.0.jar
[ERROR] urls[6] = file:/C:/Users/viori/.m2/repository/com/android/tools/build/builder-test-api/2.3.0/builder-test-api-2.3.0.jar
[ERROR] urls[7] = file:/C:/Users/viori/.m2/repository/org/bouncycastle/bcpkix-jdk15on/1.48/bcpkix-jdk15on-1.48.jar
[ERROR] urls[8] = file:/C:/Users/viori/.m2/repository/org/bouncycastle/bcprov-jdk15on/1.48/bcprov-jdk15on-1.48.jar
[ERROR] urls[9] = file:/C:/Users/viori/.m2/repository/com/android/tools/sdklib/25.3.0/sdklib-25.3.0.jar
[ERROR] urls[10] = file:/C:/Users/viori/.m2/repository/com/google/code/gson/gson/2.2.4/gson-2.2.4.jar
[ERROR] urls[11] = file:/C:/Users/viori/.m2/repository/org/apache/commons/commons-compress/1.8.1/commons-compress-1.8.1.jar
[ERROR] urls[12] = file:/C:/Users/viori/.m2/repository/org/apache/httpcomponents/httpclient/4.1.1/httpclient-4.1.1.jar
[ERROR] urls[13] = file:/C:/Users/viori/.m2/repository/org/apache/httpcomponents/httpcore/4.1/httpcore-4.1.jar
[ERROR] urls[14] = file:/C:/Users/viori/.m2/repository/commons-logging/commons-logging/1.1.1/commons-logging-1.1.1.jar
[ERROR] urls[15] = file:/C:/Users/viori/.m2/repository/commons-codec/commons-codec/1.4/commons-codec-1.4.jar
[ERROR] urls[16] = file:/C:/Users/viori/.m2/repository/org/apache/httpcomponents/httpmime/4.1/httpmime-4.1.jar
[ERROR] urls[17] = file:/C:/Users/viori/.m2/repository/com/android/tools/build/builder/2.3.0/builder-2.3.0.jar
[ERROR] urls[18] = file:/C:/Users/viori/.m2/repository/com/android/tools/jack/jack-api/0.13.0/jack-api-0.13.0.jar
[ERROR] urls[19] = file:/C:/Users/viori/.m2/repository/com/android/tools/jill/jill-api/0.10.0/jill-api-0.10.0.jar
[ERROR] urls[20] = file:/C:/Users/viori/.m2/repository/com/android/tools/analytics-library/protos/25.3.0/protos-25.3.0.jar
[ERROR] urls[21] = file:/C:/Users/viori/.m2/repository/com/google/protobuf/protobuf-java/3.0.0/protobuf-java-3.0.0.jar
[ERROR] urls[22] = file:/C:/Users/viori/.m2/repository/com/android/tools/analytics-library/shared/25.3.0/shared-25.3.0.jar
[ERROR] urls[23] = file:/C:/Users/viori/.m2/repository/com/android/tools/analytics-library/tracker/25.3.0/tracker-25.3.0.jar
[ERROR] urls[24] = file:/C:/Users/viori/.m2/repository/com/squareup/javawriter/2.5.0/javawriter-2.5.0.jar
[ERROR] urls[25] = file:/C:/Users/viori/.m2/repository/org/ow2/asm/asm-tree/5.0.4/asm-tree-5.0.4.jar
[ERROR] urls[26] = file:/C:/Users/viori/.m2/repository/com/android/tools/build/builder-model/2.3.0/builder-model-2.3.0.jar
[ERROR] urls[27] = file:/C:/Users/viori/.m2/repository/com/android/tools/repository/25.3.0/repository-25.3.0.jar
[ERROR] urls[28] = file:/C:/Users/viori/.m2/repository/com/google/jimfs/jimfs/1.1/jimfs-1.1.jar
[ERROR] urls[29] = file:/C:/Users/viori/.m2/repository/com/android/tools/build/manifest-merger/25.3.0/manifest-merger-25.3.0.jar
[ERROR] urls[30] = file:/C:/Users/viori/.m2/repository/net/sf/kxml/kxml2/2.3.0/kxml2-2.3.0.jar
[ERROR] urls[31] = file:/C:/Users/viori/.m2/repository/com/android/tools/ddms/ddmlib/25.3.0/ddmlib-25.3.0.jar
[ERROR] urls[32] = file:/C:/Users/viori/.m2/repository/com/android/tools/layoutlib/layoutlib-api/25.3.0/layoutlib-api-25.3.0.jar
[ERROR] urls[33] = file:/C:/Users/viori/.m2/repository/com/intellij/annotations/12.0/annotations-12.0.jar
[ERROR] urls[34] = file:/C:/Users/viori/.m2/repository/com/android/tools/lint/lint/25.3.0/lint-25.3.0.jar
[ERROR] urls[35] = file:/C:/Users/viori/.m2/repository/org/eclipse/jdt/core/compiler/ecj/4.6.1/ecj-4.6.1.jar
[ERROR] urls[36] = file:/C:/Users/viori/.m2/repository/com/android/tools/lint/lint-api/25.3.0/lint-api-25.3.0.jar
[ERROR] urls[37] = file:/C:/Users/viori/.m2/repository/com/android/tools/external/com-intellij/uast/162.2228.14/uast-162.2228.14.jar
[ERROR] urls[38] = file:/C:/Users/viori/.m2/repository/com/android/tools/external/lombok/lombok-ast/0.2.3/lombok-ast-0.2.3.jar
[ERROR] urls[39] = file:/C:/Users/viori/.m2/repository/com/android/tools/lint/lint-checks/25.3.0/lint-checks-25.3.0.jar
[ERROR] urls[40] = file:/C:/Users/viori/.m2/repository/org/ow2/asm/asm-analysis/5.0.4/asm-analysis-5.0.4.jar
[ERROR] urls[41] = file:/C:/Users/viori/.m2/repository/org/sonatype/aether/aether-util/1.13.1/aether-util-1.13.1.jar
[ERROR] urls[42] = file:/C:/Users/viori/.m2/repository/org/sonatype/plexus/plexus-sec-dispatcher/1.3/plexus-sec-dispatcher-1.3.jar
[ERROR] urls[43] = file:/C:/Users/viori/.m2/repository/org/sonatype/plexus/plexus-cipher/1.4/plexus-cipher-1.4.jar
[ERROR] urls[44] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-interpolation/1.14/plexus-interpolation-1.14.jar
[ERROR] urls[45] = file:/C:/Users/viori/.m2/repository/org/sonatype/sisu/sisu-inject-bean/2.3.0/sisu-inject-bean-2.3.0.jar
[ERROR] urls[46] = file:/C:/Users/viori/.m2/repository/org/sonatype/sisu/sisu-guice/3.1.0/sisu-guice-3.1.0-no_aop.jar
[ERROR] urls[47] = file:/C:/Users/viori/.m2/repository/org/sonatype/sisu/sisu-guava/0.9.9/sisu-guava-0.9.9.jar
[ERROR] urls[48] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-component-annotations/1.5.5/plexus-component-annotations-1.5.5.jar
[ERROR] urls[49] = file:/C:/Users/viori/.m2/repository/org/apache/maven/maven-archiver/2.5/maven-archiver-2.5.jar
[ERROR] urls[50] = file:/C:/Users/viori/.m2/repository/emma/emma/2.0.5312/emma-2.0.5312.jar
[ERROR] urls[51] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-archiver/3.0.1/plexus-archiver-3.0.1.jar
[ERROR] urls[52] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-io/2.6/plexus-io-2.6.jar
[ERROR] urls[53] = file:/C:/Users/viori/.m2/repository/org/iq80/snappy/snappy/0.3/snappy-0.3.jar
[ERROR] urls[54] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-utils/3.1.0/plexus-utils-3.1.0.jar
[ERROR] urls[55] = file:/C:/Users/viori/.m2/repository/commons-jxpath/commons-jxpath/1.3/commons-jxpath-1.3.jar
[ERROR] urls[56] = file:/C:/Users/viori/.m2/repository/commons-io/commons-io/2.4/commons-io-2.4.jar
[ERROR] urls[57] = file:/C:/Users/viori/.m2/repository/org/ow2/asm/asm/5.0.4/asm-5.0.4.jar
[ERROR] urls[58] = file:/C:/Users/viori/.m2/repository/org/apache/commons/commons-lang3/3.4/commons-lang3-3.4.jar
[ERROR] urls[59] = file:/C:/Users/viori/.m2/repository/com/github/rtyley/android-screenshot-paparazzo/1.9/android-screenshot-paparazzo-1.9.jar
[ERROR] urls[60] = file:/C:/Users/viori/.m2/repository/com/madgag/animated-gif-lib/1.0/animated-gif-lib-1.0.jar
[ERROR] urls[61] = file:/C:/Users/viori/.m2/repository/com/github/rtyley/android-screenshot-celebrity/1.9/android-screenshot-celebrity-1.9.jar
[ERROR] urls[62] = file:/C:/Users/viori/.m2/repository/org/apache/maven/shared/maven-dependency-tree/2.2/maven-dependency-tree-2.2.jar
[ERROR] urls[63] = file:/C:/Users/viori/.m2/repository/org/eclipse/aether/aether-util/0.9.0.M2/aether-util-0.9.0.M2.jar
[ERROR] urls[64] = file:/C:/Users/viori/.m2/repository/com/google/apis/google-api-services-androidpublisher/v2-rev13-1.19.0/google-api-services-androidpublisher-v2-rev13-1.19.0.jar
[ERROR] urls[65] = file:/C:/Users/viori/.m2/repository/com/google/api-client/google-api-client/1.19.0/google-api-client-1.19.0.jar
[ERROR] urls[66] = file:/C:/Users/viori/.m2/repository/com/google/oauth-client/google-oauth-client/1.19.0/google-oauth-client-1.19.0.jar
[ERROR] urls[67] = file:/C:/Users/viori/.m2/repository/com/google/http-client/google-http-client/1.19.0/google-http-client-1.19.0.jar
[ERROR] urls[68] = file:/C:/Users/viori/.m2/repository/com/google/http-client/google-http-client-jackson2/1.19.0/google-http-client-jackson2-1.19.0.jar
[ERROR] urls[69] = file:/C:/Users/viori/.m2/repository/com/fasterxml/jackson/core/jackson-core/2.1.3/jackson-core-2.1.3.jar
[ERROR] urls[70] = file:/C:/Users/viori/.m2/repository/com/google/guava/guava-jdk5/13.0/guava-jdk5-13.0.jar
[ERROR] urls[71] = file:/C:/Users/viori/.m2/repository/org/apache/maven/plugins/maven-shade-plugin/2.3/maven-shade-plugin-2.3.jar
[ERROR] urls[72] = file:/C:/Users/viori/.m2/repository/junit/junit/4.12/junit-4.12.jar
[ERROR] urls[73] = file:/C:/Users/viori/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
[ERROR] urls[74] = file:/C:/Users/viori/.m2/repository/jaxen/jaxen/1.1.6/jaxen-1.1.6.jar
[ERROR] urls[75] = file:/C:/Users/viori/.m2/repository/org/jdom/jdom2/2.0.6/jdom2-2.0.6.jar
[ERROR] urls[76] = file:/C:/Users/viori/.m2/repository/net/sf/proguard/proguard-base/5.2.1/proguard-base-5.2.1.jar
[ERROR] urls[77] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-compiler-api/2.5/plexus-compiler-api-2.5.jar
[ERROR] urls[78] = file:/C:/Users/viori/.m2/repository/org/apache/maven/plugins/maven-compiler-plugin/3.5.1/maven-compiler-plugin-3.5.1.jar
[ERROR] urls[79] = file:/C:/Users/viori/.m2/repository/org/apache/maven/shared/maven-shared-utils/3.0.0/maven-shared-utils-3.0.0.jar
[ERROR] urls[80] = file:/C:/Users/viori/.m2/repository/com/google/code/findbugs/jsr305/2.0.1/jsr305-2.0.1.jar
[ERROR] urls[81] = file:/C:/Users/viori/.m2/repository/org/apache/maven/shared/maven-shared-incremental/1.1/maven-shared-incremental-1.1.jar
[ERROR] urls[82] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-compiler-manager/2.7/plexus-compiler-manager-2.7.jar
[ERROR] urls[83] = file:/C:/Users/viori/.m2/repository/org/codehaus/plexus/plexus-compiler-javac/2.7/plexus-compiler-javac-2.7.jar
[ERROR] Number of foreign imports: 1
[ERROR] import: Entry[import  from realm ClassRealm[maven.api, parent: null]]

Here is my pom.xml file:

<?xml version="1.0" ?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	 <parent>
        <groupId>org.jpmml</groupId>
        <artifactId>DailyActivity</artifactId>
        <version>1.4.7</version>
    </parent>

	<groupId>com.simpligility.maven.plugins</groupId>
	<artifactId>app-example</artifactId>
	<packaging>apk</packaging>

	<dependencies>
		<dependency>
			<groupId>org.jpmml</groupId>
			<artifactId>app</artifactId>
			<version>1.4.7</version>
			<exclusions>
				<exclusion>
					<groupId>*</groupId>
					<artifactId>*</artifactId>
				</exclusion>
			</exclusions>
		</dependency>

		<dependency>
			<groupId>com.google.android</groupId>
			<artifactId>android</artifactId>
			<version>4.1.1.4</version>
			<scope>provided</scope>
		</dependency>
		
		<dependency>
            <groupId>org.jpmml</groupId>
            <artifactId>DailyActivity</artifactId>
            <version>1.4.7</version>
            <type>pom</type>
        </dependency>
		
		<!-- https://mvnrepository.com/artifact/javax.xml.bind/jaxb-api -->
		<dependency>
			<groupId>javax.xml.bind</groupId>
			<artifactId>jaxb-api</artifactId>
			<version>2.3.1</version>
		</dependency>
		
		<!-- https://mvnrepository.com/artifact/com.sun.xml.bind/jaxb-impl -->
		<dependency>
			<groupId>com.sun.xml.bind</groupId>
			<artifactId>jaxb-impl</artifactId>
			<version>2.3.1</version>
		</dependency>	

		<!-- https://mvnrepository.com/artifact/org.apache.ws.commons.schema/XmlSchema -->
		<dependency>
			<groupId>org.apache.ws.commons.schema</groupId>
			<artifactId>XmlSchema</artifactId>
			<version>1.4.7</version>
		</dependency>

		<dependency>
			<groupId>org.jpmml</groupId>
			<artifactId>pmml-manager</artifactId>
			<version>1.1.20</version>
		</dependency>
	</dependencies>
	
	<properties>
        <android.sdk.path>/Users/viori/AppData/Local/Android/Sdk</android.sdk.path>
    </properties>

	<build>
		<plugins>
			<plugin>
				<groupId>com.simpligility.maven.plugins</groupId>
				<artifactId>android-maven-plugin</artifactId>
				<version>4.6.0</version>
				<extensions>true</extensions>
				<configuration>
					<androidManifestFile>${project.basedir}/src/main/android/AndroidManifest.xml</androidManifestFile>
					<assetsDirectory>${project.basedir}/src/main/android/assets</assetsDirectory>
					<resourceDirectory>${project.basedir}/src/main/android/resources</resourceDirectory>
					<sdk>
						<platform>29</platform>
					</sdk>
					<undeployBeforeDeploy>true</undeployBeforeDeploy>
				</configuration>
			</plugin>
		</plugins>
	</build>
</project>

Could you help me, please?!
Thank you!

Document org.dmg.pmml.PMML#serialVersionUID values across all release versions

The JPMML-Model project relies on implicit serialVersionUID class constant values. The mapping between JPMML-Model release versions and org.dmg.pmml.PMML#serialVersionUID class constant values (this is a typical "entry class" for JPMML-Model powered applications) should be documented in order to make the troubleshooting of version incompatibilities easier.

For example, here's an example exception message when there's a mismatch between JPMML-Model serializer and de-serializer library versions:

Caused by: java.io.InvalidClassException: org.dmg.pmml.PMML; Incompatible class (SUID): org.dmg.pmml.PMML: static final long serialVersionUID =7684337200530848876L; but expected org.dmg.pmml.PMML: static final long serialVersionUID =4488905061911255163L;

Ability to disable the generation of extensions attributes

Class ImportFilter is renaming the original version attribute to x-baseVersion attribute.

During validation, such PMML documents are reported as invalid, because the "x-" prefix has been deprecated in PMML 3.X and 4.X schema versions.

As a solution, class ImportFilter should take a boolean parameter, which would let the end user to enable or disable the generation of x-baseVersion attribute as appropriate.

Refactor Apache Maven plugin to support JSON output data format

From the mailbox:

You are converting pmml models to Java SER data format in a Maven Plugin. Do you have a solution which uses Gradle instead of Maven or is it even possible to do the conversion in Gradle? Nowadays everyone uses Gradle instead of Maven in Android apps so I guess every Android developer have this problem.

NoClassDefFoundError

Caused by: java.lang.NoClassDefFoundError: jakarta/xml/bind/JAXBContext
at org.jpmml.model.JAXBUtil.getContext(JAXBUtil.java:106)
at org.jpmml.model.JAXBUtil.createUnmarshaller(JAXBUtil.java:153)
at org.jpmml.evaluator.LoadingModelEvaluatorBuilder.load(LoadingModelEvaluatorBuilder.java:143)
at org.jpmml.evaluator.LoadingModelEvaluatorBuilder.load(LoadingModelEvaluatorBuilder.java:132)
at org.jpmml.evaluator.LoadingModelEvaluatorBuilder.load(LoadingModelEvaluatorBuilder.java:120)'

Java Version : java version "1.8.0_321"

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.