jpmml/sklearn2pmml

Python library for converting Scikit-Learn pipelines to PMML

What it solves

It addresses the lack of portability in Scikit-Learn estimators, which often lack the metadata required to move models between different environments. It allows users to export Scikit-Learn pipelines into the Predictive Model Markup Language (PMML) format, enabling models to be used in diverse production environments without needing the original Python environment.

How it works

The package acts as a Python wrapper for the JPMML-SkLearn library. It can convert fitted Scikit-Learn estimator objects or pickle files directly into PMML files. To enhance portability, it provides a PMMLPipeline meta-estimator that extends the standard Scikit-Learn pipeline to collect feature and label metadata, perform prediction post-processing, and embed verification data.

Who it’s for

Data scientists and ML engineers who need to deploy Scikit-Learn models into production systems that support PMML, or those who want to ensure their models are portable and self-documenting.

Highlights

  • Broad Compatibility: Supports a wide variety of Scikit-Learn transformers, selectors, and predictors.
  • Metadata Enrichment: Automatically captures column names for input and target fields via PMMLPipeline.
  • Customization: Allows for extra edits to the PMML XML fragments and configuration of the final estimator step.
  • Advanced Transformers: Includes specialized PMML-oriented tools like ExpressionTransformer, LookupTransformer, and BusinessDecisionTransformer.
  • Safe Loading: Uses a custom Java component to read pickle files, making it safer to use with unvetted files.

Related

  • Project
  • Project
  • Project
  • Project
  • Project