--- id: sklearn2pmml version: "0.132.0" license: GNU Affero General Public License (AGPL) version 3.0 license_treatment: agpl maintenance: active --- # sklearn2pmml — Python library for converting Scikit-Learn pipelines to PMML License: agpl · Maintenance: active · Downloads: 452.9K/mo ## What it is and what it does sklearn2pmml is a Python wrapper around the JPMML-SkLearn Java library that converts trained estimators and pipelines into PMML, an XML-based standard for representing machine learning models. It works with native estimators as-is, and also provides a PMMLPipeline class that captures feature metadata, enables prediction post-processing, embeds verification data, and allows fine-grained PMML customization. The package includes a command-line interface and a library API, plus additional transformer and predictor classes for domain specification, feature engineering, and model combination. The main use case is exporting trained models from Python for deployment in other systems that consume PMML. It handles pickling safely using a custom Java component rather than Python's built-in unpickler, making it suitable for untrusted pickle files. Runtime dependencies are standard (scikit-learn, pandas, joblib, dill), but Java 11 or newer must be present on the system. Use it for: - Export a trained estimator to PMML for deployment in a non-Python scoring engine or business rules platform. - Preserve feature names and metadata in PMML when working with older scikit-learn versions that lack feature tracking. - Add prediction post-processing, verification data, and custom PMML edits to a pipeline before export using PMMLPipeline. - Convert pickled estimators from disk to PMML via the command-line interface without writing Python code. - Safely deserialize untrusted pickle files using sklearn2pmml's Java-based unpickler instead of Python's native pickle module. ## Worth the install? AI-flagged interpretation of the facts above — verify before relying. Converts fitted Scikit-Learn pipelines to PMML (Predictive Model Markup Language) for deployment in other environments, supporting a wide range of estimators and transformers. Yes, with conditions. Install if you need to export scikit-learn models to PMML for deployment outside Python and can accept the AGPL license terms. The package is actively maintained, has low install friction, and carries no known vulnerabilities. Do not install if your project is proprietary or closed-source without explicit AGPL compliance, or if Java 11 or newer is not available on your deployment system. ## Install pip install sklearn2pmml uv add sklearn2pmml poetry add sklearn2pmml ## Installing sklearn2pmml Before you install: Low friction: pure Python wheel with four common runtime dependencies (dill, joblib, pandas, scikit-learn). Requires Java 11 or newer on the system path; this is the only non-Python prerequisite. Package is actively maintained with a recent release. License in practice: Licensed under GNU Affero General Public License (AGPL) version 3.0. Use is restricted to projects that can comply with copyleft obligations—derivative works and distributed modifications must be released under the same license. Not suitable for proprietary or closed-source applications without explicit permission. Quickstart: pip install sklearn2pmml from sklearn2pmml import sklearn2pmml import joblib estimator = joblib.load("model.pkl") sklearn2pmml(estimator, "model.pmml") Java 11 or newer must be installed and available on the system PATH. Verify before relying: - Whether all scikit-learn versions from 0.17 onward are truly compatible with a single package version. - Performance overhead of Java-based pickle deserialization versus native Python unpickler for large models. - Scope and completeness of supported estimator classes beyond the reference to JPMML-SkLearn features. ## Package facts - License: GNU Affero General Public License (AGPL) version 3.0 (agpl) - Python support: supports_current - Install friction: low - Maintenance: active - Downloads: 452.9K/month (top 15,000 on PyPI) - Known vulnerabilities: none known ## Tags scikit-learn to PMML conversion, pipeline export format, PMML model serialization, machine learning model portability, model to XML conversion, cross-platform ML deployment, model interchange format, model-export, interoperability, pmml [View on SkillFed](https://skillfed.io/packages/sklearn2pmml) · [View on PyPI](https://pypi.org/project/sklearn2pmml/)