A library to parse PMML models into Scikit-learn estimators.
Project description
sklearn-pmml-model
A library to parse PMML models into Scikit-learn estimators.
Installation
The easiest way is to use pip:
$ pip install sklearn-pmml-model
Status
This library is very alpha, and currently only supports a limited number of models. The library currently supports the following models:
- Decision Trees (
sklearn_pmml_model.tree.PMMLTreeClassifier
) - Random Forests (
sklearn_pmml_model.ensemble.PMMLForestClassifier
) - Linear Regression (
sklearn_pmml_model.linear_model.PMMLLinearRegression
) - Ridge (
sklearn_pmml_model.linear_model.PMMLRidge
) - Lasso (
sklearn_pmml_model.linear_model.PMMLLasso
) - ElasticNet (
sklearn_pmml_model.linear_model.PMMLElasticNet
) - Gaussian Naive Bayes (
sklearn_pmml_model.naive_bayes.PMMLGaussianNB
)
The following part of the specification is covered:
- DataDictionary
- DataField (continuous, categorical, ordinal)
- Value
- Interval
- DataField (continuous, categorical, ordinal)
- TransformationDictionary / LocalTransformations
- DerivedField
- TreeModel
- SimplePredicate
- SimpleSetPredicate
- Segmentation ('majorityVote' only, for Random Forests)
- Regression
- RegressionTable
- NumericPredictor
- CategoricalPredictor
- RegressionTable
- GeneralRegressionModel (only linear models)
- PPMatrix
- PPCell
- ParamMatrix
- PCell
- PPMatrix
- NaiveBayesModel
- BayesInputs
- BayesInput
- TargetValueStats
- TargetValueStat
- GaussianDistribution
- TargetValueStat
- PairCounts
- TargetValueCounts
- TargetValueCount
- TargetValueCounts
- TargetValueStats
- BayesInput
- BayesInputs
Example
A minimal working example is shown below:
from sklearn.datasets import load_iris
from sklearn.model_selection import train_test_split
import pandas as pd
import numpy as np
from sklearn_pmml_model.ensemble import PMMLForestClassifier
# Prepare data
iris = load_iris()
X = pd.DataFrame(iris.data)
X.columns = np.array(iris.feature_names)
y = pd.Series(np.array(iris.target_names)[iris.target])
y.name = "Class"
Xtr, Xte, ytr, yte = train_test_split(X, y, test_size=0.33, random_state=123)
clf = PMMLForestClassifier(pmml="models/randomForest.pmml")
clf.predict(Xte)
clf.score(Xte, yte)
More examples can be found in the subsequent packages: tree, ensemble, linear_model and naive_bayes.
Development
Prerequisites
Tests can be run using Py.test. Grab a local copy of the source:
$ git clone http://github.com/iamDecode/sklearn-pmml-model
$ cd sklearn-pmml-model
create a virtual environment and activating it:
$ python3 -m venv venv
$ source venv/bin/activate
and install the dependencies:
$ pip install -r requirements.txt
The final step is to build the Cython extensions:
$ python setup.py build_ext --inplace
Testing
You can execute tests with py.test by running:
$ python setup.py pytest
Contributing
Feel free to make a contribution. Please read CONTRIBUTING.md for details on the code of conduct, and the process for submitting pull requests.
License
This project is licensed under the BSD 2-Clause License - see the LICENSE file for details.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for sklearn-pmml-model-0.0.14.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | bec19d28c66c1efbada490db26a7d4fc63887d4273ce68f542ea13a48e4df557 |
|
MD5 | 8b6cdaa14ec7b49da86d9966be4322bb |
|
BLAKE2b-256 | 56e966b047b0936dd1f56befff53a3c3f5c9058dfc1294dfca7140412f6f5570 |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 012fe888ba126c2d9e919d26b19c765cecc1f3d9e957a79b0d90e8ec8481e63c |
|
MD5 | 9f96cdbc06a8f17016cf0a4511dfc263 |
|
BLAKE2b-256 | 15d59cefef302468744fde2c155e54b12ce8ea7602c71d5ed3e4ad42e7a1164c |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e707dfe46b3605803583863af2ca887b4e8d56a057eace583192a1d31456c321 |
|
MD5 | d9ab6231538984fe396edd56d95ca354 |
|
BLAKE2b-256 | 0bcb1110aa5670763234d42a9148cbc4cf3f981fd87d474cb1d514132fc9e8a8 |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e9b8d7d59dd1e9f3e5aa6f4e1b87b54d4e75b6e0c2cc89a5f6a734529629e520 |
|
MD5 | 4a97204992be3f3637b75c2cdc206330 |
|
BLAKE2b-256 | a3100f641fa91147e7116f8fdedeefb02bad788287fc778a8d584bf8c4343de6 |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2e36bd337bb33f6be9e20577e3f2ff6e3d0a40c3fe3a9d37e133367f40cce217 |
|
MD5 | 4dc4242e639482daa2c942a933111238 |
|
BLAKE2b-256 | ba520622e7409c7bfdf44cb43c931287e875c2166b77896444d1b7b4e9db24fe |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d234dced0b3bb5ad6bf49c7025c15760a4701425f08578cb2621b8c28fd256a |
|
MD5 | 199ef9bcec9f6d3f937fd62efffa1ae3 |
|
BLAKE2b-256 | e28f6ef38af22faea476c78eb6da66bdd206bd59cfa8079ab99bfa2991bb05fd |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5885c2857778b49074b7db680316b1974906ccfb2f73e6087f9d5c2243af7aef |
|
MD5 | c291394f71d1ddd747298d1579eac35f |
|
BLAKE2b-256 | 81c0e41a4dcf665ee52fa09fb74cc32dae456c7be2008a73fbf356ba6ca0e9bc |
Hashes for sklearn_pmml_model-0.0.14-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 95ad85d5dbd54887557ca9b7c94f56d3e1e3584bd1faf3a1e0e4d5f9762cd949 |
|
MD5 | 850bb51ba454ef570e59c284b8ef8666 |
|
BLAKE2b-256 | 3c004a096ece24fbc25de3001324fc18e4ac7c1b498a70d730e0125231db705e |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89a7cf0c7a7bff6c5dad77f921be771ba0d3ebca30bba9832bcb3e298d4cc96f |
|
MD5 | 8088a9d7225f1801a0abf8273b288b84 |
|
BLAKE2b-256 | 8f075d8f756d54ed1fc0086bff98d25c200161d40b2a26c65f781d38e88e5acc |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7daf5861b1fbfc3288a858e8ae2c35c4ceccc900a51a27be9c01c05b922f0776 |
|
MD5 | abc5ba8c687c0908713b29ec952251d9 |
|
BLAKE2b-256 | 1a2a01aa289e9158ef77e56ef61082c16fefeee149cbde11eea924bd8b2b05f9 |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6300899a4ebba37e47161e6f52791b2db105748ba7473fd3e568761cff3fb76f |
|
MD5 | 0d275a796f4ea75705a5e17eeba89d4a |
|
BLAKE2b-256 | 7ad849a828337dc81cd1b45350f2f2596c6360799f7f2f1c24be497437ccbd2d |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 59f6f4078385b1ae1f08a0e231dd08b58e0a348c35cd503116f9b1ed56d081d1 |
|
MD5 | bb4d2a9ed7cdae46ca212b8f4145a668 |
|
BLAKE2b-256 | 3db3458a71acd70b98dfa5d0eaaffdaf4178799cb5229f12a412c49384b85806 |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1c67a090d7a3d5e0e2b3efc68d6a6383db4812068a1e9a1f6d9af531c659ea8f |
|
MD5 | 7807c7b392b00bfbc74be22b8ad7b073 |
|
BLAKE2b-256 | 94e8c35611bcd3a3acaee7b786ec0a694d9967a52ebaf9b5b0ba42c815f166fa |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 987efc362add389b2d0d88ebfed73ca869869a594c37ac29fe016b29c3f41c13 |
|
MD5 | 71981e9d89eb423ec815ed4400465328 |
|
BLAKE2b-256 | a7d6aa55a5870f09a3f1543307ff55efacc98d5c37b09615030791d75e8c1712 |
Hashes for sklearn_pmml_model-0.0.14-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f185a264248334bf0a238ca0409bf2ae10370b6fdea2fdddeb2bb2824db76439 |
|
MD5 | 72ddd665fe426d6eb793dad66e5eccda |
|
BLAKE2b-256 | e79daa4b0873b7ae83f450b8a8d5ffd5c07563ce4c7011fdb31f040d333bdf7e |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 51210c1cfdfd275979795dfbda2b94c519419dcea8267a96623ada2f4d52681f |
|
MD5 | 55be6e5a568ad102a009044353d54166 |
|
BLAKE2b-256 | 4468edcb362f226880a245b53a4acc8c109e0220c206cc7d46089413487ec795 |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 94e3e5eedd10a3ddadc3e681c610ace8385d3cba693f4dce445149a597dfd4b0 |
|
MD5 | 3156e363e06a66c6725299e0ec0fa009 |
|
BLAKE2b-256 | f3ae84866c96f8125f2cbbcc4838ec59c3c042159212dde5a5e2d202a1f25c24 |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb203c93bb976d6fb469b6a15bbfb174c8fd5a39ba79e3fb231bb2f454e8d9d7 |
|
MD5 | 718ee9c4a831d9f9d2796a383e01ace4 |
|
BLAKE2b-256 | 54cfeb163507fa95f5852bd02824263ee679e5d021546cea0b1ba7528b8ca7dd |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7933605c9dcbd4e8c82552848ae14742c46eb67932fcd598b46bce4940e858f4 |
|
MD5 | 46d6dc5294fb652537654c7e3df41a81 |
|
BLAKE2b-256 | a0fc4faca0d5e422e5d910b72f918f32dfa5b9a8d8fb72e6d806285436f18b34 |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e7205b2e9947e8ccc0638db43405292088c93606d922840e87dacd996d32b5ec |
|
MD5 | 0354f1c644665dfb593c8fee8168f41c |
|
BLAKE2b-256 | acfdf3defb247c27f8c616506c93bbb4dc84462683e503a5b46dde8c1e4f30fc |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5c798e34c86dd1499e8c2a3c1ada3ec673b340f4f00d87146316ca14f297aba3 |
|
MD5 | b3f4b3c96443ff037785aeef525a0062 |
|
BLAKE2b-256 | 699c2a1fced71f6cd987b5ca8b5e41a5501137e3a2cad7b2a1e947638511aa18 |
Hashes for sklearn_pmml_model-0.0.14-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 93be80380245f2cfd18a77204ac158c9d99d323500092f1757baffda06eb0d8d |
|
MD5 | b37010479a2e8f04f84d4baf20ae29be |
|
BLAKE2b-256 | c1aa6bf77089feecc7932e471c3b139c987550d3fe3cd32d9272c80d68347571 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6a2c447e1796d45975a0c020f88f719d262056ea68f3563a276d14f6a375171 |
|
MD5 | d8fcc9304cb04768718e940382f65afc |
|
BLAKE2b-256 | 3f1c75818b3ade93e3fe6e73cae2bc8d5b26e04d3b4ab490f6c04814da6f3aa6 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 79f5d85932c51428aa8857dc0f2e0045656938f07d00f75709f83deb5eb45f11 |
|
MD5 | 8bdb3786401b27503076ba3cfd97758d |
|
BLAKE2b-256 | 64c2184feecff56f0ed9a357dc85d7e7d6bae2dae00ef43c5ba6cef8249391d4 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9148c3efe6b698291a27c10e08d58a6adfd8c11e5da76a5744b39cc1e1385d3e |
|
MD5 | 141515fb47cc73751d84e6b9fdbfb1b2 |
|
BLAKE2b-256 | bfc0fdbd7c80cae44c23e69d65c5edff826ccdb2584e2fa5c21818e1c2b913fa |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4599d70b04cc6c79f89ff0b15cd2efb301478898d9b93e2ceece056e59524e1f |
|
MD5 | d9ad8d2b0bfa2a9c1b686b68d7c1bdfe |
|
BLAKE2b-256 | c2e6bba612cbeabef2b24a18fc3f2f923349f445189657e00bf492f28ab9e408 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 260c66a88dd95cc1a5f7974c30487caa8374feabbf7d854f0943972262965da8 |
|
MD5 | a8aa794b7a21adbf7ebc2047846f0b4b |
|
BLAKE2b-256 | 689afe16e7357fdc1bea7a30561cdeb86a6185933f5e26365ac4fdb76a558669 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7d4c67173975ce565bca749ba0177e34d22637ff55ceac9406ec1ee50a63806e |
|
MD5 | 5901ded18956ced0f33d9c60d4517704 |
|
BLAKE2b-256 | a0ca919633ad26f4ff5ef8734226d138531f392bcebcf2940098271fd18f37a4 |
Hashes for sklearn_pmml_model-0.0.14-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47b0af292b59330e8d03baccdc3a95189e116cd7ed1995daa00641ebe2adff57 |
|
MD5 | 215519ac456d1bae85a1ec5646376dee |
|
BLAKE2b-256 | 806f9f203d1e7243dbeb101b94dec7eefe726ce9125df950aabbbdf2e2d87597 |