Skip to main content

PyPMML-Spark

PyPMML-Spark is a Python PMML scoring library for PySpark as SparkML Transformer, it really is the Python API for PMML4S-Spark.

Prerequisites

  • Java >= 1.8
  • Python 2.7 or >= 3.5

Dependencies

Module PySpark
pypmml-spark PySpark >= 3.0.0
pypmml-spark2 PySpark >= 2.4.0, < 3.0.0

Installation

pip install pypmml-spark

Or install the latest version from github:

pip install --upgrade git+https://github.com/autodeployai/pypmml-spark.git

After that, you need to do more to use it in Spark that must know those jars in the package pypmml_spark.jars. There are several ways to do that:

  1. The easiest way is to run the script link_pmml4s_jars_into_spark.py that is delivered with pypmml-spark:

    link_pmml4s_jars_into_spark.py
    
  2. Use those config options to specify dependent jars properly. e.g. --jars, or spark.executor.extraClassPath and spark.executor.extraClassPath. See Spark for details about those parameters.

Usage

  1. Load model from various sources, e.g. filename, string, or array of bytes.

    from pypmml_spark import ScoreModel
    
    # The model is from http://dmg.org/pmml/pmml_examples/KNIME_PMML_4.1_Examples/single_iris_dectree.xml
    model = ScoreModel.fromFile('single_iris_dectree.xml')
    
  2. Call transform(dataset) to run a batch score against an input dataset.

    # The data is from http://dmg.org/pmml/pmml_examples/Iris.csv
    df = spark.read.csv('Iris.csv', header='true')
    score_df = model.transform(df)
    

Use PMML in Scala or Java

See the PMML4S project. PMML4S is a PMML scoring library for Scala. It provides both Scala and Java Evaluator API for PMML.

Use PMML in Python

See the PyPMML project. PyPMML is a Python PMML scoring library, it really is the Python API for PMML4S.

Use PMML in Spark

See the PMML4S-Spark project. PMML4S-Spark is a PMML scoring library for Spark as SparkML Transformer.

Deploy PMML as REST API

See the AI-Serving project. AI-Serving is serving AI/ML models in the open standard formats PMML and ONNX with both HTTP (REST API) and gRPC endpoints.

Support

If you have any questions about the PyPMML-Spark library, please open issues on this repository.

Feedback and contributions to the project, no matter what kind, are always very welcome.

License

PyPMML-Spark is licensed under APL 2.0.

Metadata

Release files for pypmml-spark 1.5.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pypmml-spark 1.5.5
File Size Uploaded
pypmml_spark-1.5.5.tar.gz 5.0 MB Details

Release files / pypmml_spark-1.5.5.tar.gz

Download URL pypmml_spark-1.5.5.tar.gz
Size 5.0 MB
Tags Source
SHA-256 checksum
How to use checksums
ed06fd5adc6501133ed71d59f96515c3f202342b6e1003044c8f252513ca7d9c
BLAKE2b-256 checksum
How to use checksums
184094056c563c176a74eec5ee673089ceb5bfcb0903e3e1aa6cbed757da36a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.0.1 CPython/3.9.21

Release history Release notifications | RSS feed

This release

1.5.5 This release

1 release file

1.5.4

1 release file

1.5.3

1 release file

1.5.2

1 release file

1.0.2

1 release file

0.9.16

1 release file

0.9.15

1 release file

0.9.14

1 release file

0.9.11

1 release file

0.9.10

1 release file

0.9.9

1 release file

0.9.7

1 release file

0.9.6

1 release file

0.9.5

1 release file

0.9.4

1 release file

0.9.3

1 release file

0.9.2

1 release file

0.9.1

1 release file

0.9.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page