JPMML schema

JPMML schema annotations for class model

License

License

Categories

Categories

JPMML Business Logic Libraries Machine Learning
GroupId

GroupId

org.jpmml
ArtifactId

ArtifactId

pmml-schema
Last Version

Last Version

1.3.9
Release Date

Release Date

Type

Type

jar
Description

Description

JPMML schema
JPMML schema annotations for class model
Project Organization

Project Organization

University of Tartu

Download pmml-schema

How to add to project

<!-- https://jarcasting.com/artifacts/org.jpmml/pmml-schema/ -->
<dependency>
    <groupId>org.jpmml</groupId>
    <artifactId>pmml-schema</artifactId>
    <version>1.3.9</version>
</dependency>
// https://jarcasting.com/artifacts/org.jpmml/pmml-schema/
implementation 'org.jpmml:pmml-schema:1.3.9'
// https://jarcasting.com/artifacts/org.jpmml/pmml-schema/
implementation ("org.jpmml:pmml-schema:1.3.9")
'org.jpmml:pmml-schema:jar:1.3.9'
<dependency org="org.jpmml" name="pmml-schema" rev="1.3.9">
  <artifact name="pmml-schema" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.jpmml', module='pmml-schema', version='1.3.9')
)
libraryDependencies += "org.jpmml" % "pmml-schema" % "1.3.9"
[org.jpmml/pmml-schema "1.3.9"]

Dependencies

There are no dependencies for this project. It is a standalone project that does not depend on any other jars.

Project Modules

There are no modules declared in this project.

JPMML-Model Build Status

Java Class Model API for Predictive Model Markup Language (PMML).

Features

  • Full support for PMML 3.0, 3.1, 3.2, 4.0, 4.1, 4.2, 4.3 and 4.4 schemas:
    • Schema version annotations.
    • Extension elements, attributes, enum values.
  • Enhanced API:
    • Class hierarchy.
    • Marker interfaces for common traits.
    • Value constructors.
    • Method chaining-friendly setter methods.
    • Optional SAX Locator information.
  • Visitor pattern:
    • Validation agents.
    • Optimization and transformation agents.
  • Supported platforms:
    • Java SE and EE.
    • Android.
    • Google Web Toolkit (GWT).
  • Supported JAXB runtimes:
  • Supported SerDe runtimes:

Prerequisites

  • Java 1.8 or newer.

Installation

JPMML-Model library JAR files (together with accompanying Java source and Javadocs JAR files) are released via Maven Central Repository.

The current version is 1.5.6 (12 November, 2020).

<dependency>
	<groupId>org.jpmml</groupId>
	<artifactId>pmml-model</artifactId>
	<version>1.5.6</version>
</dependency>

Usage

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.

The class model should be self-explanatory. The application developer is advised to consult with the latest PMML specification about the specifics of individual PMML elements and attributes.

Unmarshalling

Loading any PMML schema version 3.X or 4.X document into live org.dmg.pmml.PMML instance:

public PMML load(InputStream is) throws SAXException, JAXBException {
  return org.jpmml.model.PMMLUtil.unmarshal(is);
}

Important: It is the responsibility of the application developer to ensure that the XML document does not contain malicious content (eg. XEE and XXE attacks).

Applying visitors

Deleting SAX Locator information from the class model:

public void optimize(PMML pmml){
  LocatorNullifier nullifier = new LocatorNullifier();
  nullifier.applyTo(pmml);
}

Marshalling

Storing live org.dmg.pmml.PMML instance into PMML schema version 4.4 document:

public void store(PMML pmml, OutputStream os) throws JAXBException {
  org.jpmml.model.PMMLUtil.marshal(pmml, os);
}

Example applications

Module pmml-model-example exemplifies the use of JPMML-Model library.

This module can be built using Apache Maven:

mvn clean install

The resulting uber-JAR file target/pmml-model-example-executable-1.5-SNAPSHOT.jar contains the following command-line applications:

  • org.jpmml.model.example.CopyExample (source). Copies and transforms a PMML schema version 3.X or 4.X document to a PMML schema version 4.4 document.
  • org.jpmml.model.example.ObfuscationExample (source). Obfuscates a PMML document by replacing field names with their MD5 hashes.
  • org.jpmml.model.example.TranslationExample (source). Translates a PMML document to a JSON or YAML document.
  • org.jpmml.model.example.ValidationExample (source). Validates a PMML document against the built-in XML Schema Definition (XSD) resource.

Copying input.pmml to output.pmml; the size of the class model is estimated using the Java agent technology:

java -javaagent:../pmml-agent/target/pmml-agent-1.5-SNAPSHOT.jar -cp target/pmml-model-example-executable-1.5-SNAPSHOT.jar org.jpmml.model.example.CopyExample --summary true --input input.pmml --output output.pmml

Translating a PMML XML document input.pmml to PMML JSON document output.json:

java -cp target/pmml-model-example-executable-1.5-SNAPSHOT.jar org.jpmml.model.example.TranslationExample --input input.pmml --output output.json --indent "\\t"

Checking the validity of model.pmml:

java -cp target/pmml-model-example-executable-1.5-SNAPSHOT.jar org.jpmml.model.example.ValidationExample --input model.pmml

Getting help:

java -cp target/pmml-model-example-executable-1.5-SNAPSHOT.jar <application class name> --help

It is possible to activate a specific Java XML Binding (JAXB) runtime by setting the value of the javax.xml.bind.context.factory system property. Use com.sun.xml.bind.v2.ContextFactory for activating a GlassFish Metro runtime, and org.eclipse.persistence.jaxb.JAXBContextFactory for activating an EclipseLink MOXy runtime.

For example:

java -Djavax.xml.bind.context.factory=org.eclipse.persistence.jaxb.JAXBContextFactory -cp target/pmml-model-example-executable-1.5-SNAPSHOT.jar ...

Documentation

Current:

Slightly outdated:

Support

Limited public support is available via the JPMML mailing list.

License

JPMML-Model is licensed under the BSD 3-Clause License.

Additional information

JPMML-Model is developed and maintained by Openscoring Ltd, Estonia.

Interested in using Java PMML API software in your company? Please contact [email protected]

org.jpmml

Java PMML API

Java libraries for producing and consuming PMML documents

Versions

Version
1.3.9
1.3.8
1.3.7
1.3.6
1.3.5
1.3.4
1.3.3
1.3.2
1.3.1
1.3.0
1.2.17
1.2.16
1.2.15
1.2.14
1.2.13
1.2.12
1.2.11
1.2.10
1.2.9
1.2.8
1.2.7
1.2.6
1.2.5
1.2.4
1.2.3
1.2.2
1.2.1
1.2.0
1.1.16
1.1.15
1.1.14
1.1.13
1.1.12
1.1.11
1.1.10
1.1.9
1.1.8
1.1.7
1.1.6
1.1.5
1.1.4
1.1.3
1.1.2
1.1.1
1.1.0
1.0.22
1.0.21
1.0.20
1.0.19
1.0.18
1.0.17
1.0.16
1.0.15
1.0.14
1.0.13
1.0.12
1.0.11
1.0.10
1.0.9
1.0.8
1.0.7
1.0.6
1.0.5
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0