Java library and command-line application for converting Scikit-Learn pipelines to PMML.
META-INF/sklearn2pmml.properties resource files.For a full list of supported transformer and estimator classes see the features.md file.
Enter the project root directory and build using Apache Maven:
mvn clean install
The build produces a library JAR file pmml-sklearn/target/pmml-sklearn-1.9-SNAPSHOT.jar, and an executable uber-JAR file pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar.
A typical workflow can be summarized as follows:
pickle data format to a file in a local filesystem.Assembling and fitting a pipeline:
from sklearn.compose import ColumnTransformer
from sklearn.datasets import load_iris
#from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
iris_X, iris_y = load_iris(return_X_y = True, as_frame = True)
iris_X.columns = [col.rstrip(" (cm)") for col in iris_X.columns]
pipeline = Pipeline([
# Column-oriented feature engineering
("transformer", ColumnTransformer([
("scaler", StandardScaler(), [0, 1, 2, 3])
], remainder = "drop")),
# Table-oriented feature engineering
#("pca", PCA(n_components = 3)),
# Final model
("classifier", LogisticRegression())
])
pipeline.fit(iris_X, iris_y)
Serializing the pipeline in Joblib-flavoured pickle data format:
import joblib
joblib.dump(pipeline, "pipeline.pkl")
Please see the test script file main.py for more classification (binary and multi-class) and regression workflows.
Converting a pickle file to a PMML file:
java -jar pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar --pkl-input pipeline.pkl --pmml-output pipeline.pmml
Getting help:
java -jar pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar --help
Integrations:
Extensions:
Miscellaneous:
Archived:
JPMML-SkLearn is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.
If you would like to use JPMML-SkLearn in a proprietary software project, then it is possible to enter into a licensing agreement which makes JPMML-SkLearn available under the terms and conditions of the BSD 3-Clause License instead.
JPMML-SkLearn is developed and maintained by Openscoring Ltd, Estonia.
Interested in using Java PMML API software in your company? Please contact info@openscoring.io
2,288 commits
Java
87.8%
Python
12.2%
Java library and command-line application for converting Scikit-Learn pipelines to PMML.
META-INF/sklearn2pmml.properties resource files.For a full list of supported transformer and estimator classes see the features.md file.
Enter the project root directory and build using Apache Maven:
mvn clean install
The build produces a library JAR file pmml-sklearn/target/pmml-sklearn-1.9-SNAPSHOT.jar, and an executable uber-JAR file pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar.
A typical workflow can be summarized as follows:
pickle data format to a file in a local filesystem.Assembling and fitting a pipeline:
from sklearn.compose import ColumnTransformer
from sklearn.datasets import load_iris
#from sklearn.decomposition import PCA
from sklearn.linear_model import LogisticRegression
from sklearn.pipeline import Pipeline
from sklearn.preprocessing import StandardScaler
iris_X, iris_y = load_iris(return_X_y = True, as_frame = True)
iris_X.columns = [col.rstrip(" (cm)") for col in iris_X.columns]
pipeline = Pipeline([
# Column-oriented feature engineering
("transformer", ColumnTransformer([
("scaler", StandardScaler(), [0, 1, 2, 3])
], remainder = "drop")),
# Table-oriented feature engineering
#("pca", PCA(n_components = 3)),
# Final model
("classifier", LogisticRegression())
])
pipeline.fit(iris_X, iris_y)
Serializing the pipeline in Joblib-flavoured pickle data format:
import joblib
joblib.dump(pipeline, "pipeline.pkl")
Please see the test script file main.py for more classification (binary and multi-class) and regression workflows.
Converting a pickle file to a PMML file:
java -jar pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar --pkl-input pipeline.pkl --pmml-output pipeline.pmml
Getting help:
java -jar pmml-sklearn-example/target/pmml-sklearn-example-executable-1.9-SNAPSHOT.jar --help
Integrations:
Extensions:
Miscellaneous:
Archived:
JPMML-SkLearn is licensed under the terms and conditions of the GNU Affero General Public License, Version 3.0.
If you would like to use JPMML-SkLearn in a proprietary software project, then it is possible to enter into a licensing agreement which makes JPMML-SkLearn available under the terms and conditions of the BSD 3-Clause License instead.
JPMML-SkLearn is developed and maintained by Openscoring Ltd, Estonia.
Interested in using Java PMML API software in your company? Please contact info@openscoring.io
2,288 commits
Java
87.8%
Python
12.2%