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
- 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.11.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4e4ba1efc6f3a8016d6b08cc4067c04b87b3ab780718a25bfa6ff6a11d0f8b4d |
|
MD5 | c05abbc73545e1e0d365cdd3e7bfcfbb |
|
BLAKE2b-256 | ad7d74baca04a16a7ea76b77be0afa437ba00057d54da2d3d7e31d6bd076d18b |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4d6fd425d40d466bc6a24c8dfd5270c82913fdf36ee0e2bcc380852c43b13405 |
|
MD5 | 6931121bc03d0efd432f4ed2bb802880 |
|
BLAKE2b-256 | bd1a78d79c1dc9e9b7445c807b6cc32b99fffd948c06457a181e0ee1ae71973f |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d7d9b62d05e40909ccdce03991541914c2bc96b8512584563efcb17beb843781 |
|
MD5 | cbc5c714cbf064a9f68f507958f1987b |
|
BLAKE2b-256 | 9daf94bc5ae151916b8008be023539c8a9bd0befdcb952d9eb66e7ae111b3ce4 |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e0af6a88bfd9eec974df044e6f734e18cbfc2733e9276a4811b18ae681843b3 |
|
MD5 | 99f0b46dc7285e49f7e5b04db1677915 |
|
BLAKE2b-256 | ff0cfebf29f5abbe06e87d381c5f73ea9dce6838c487f752edfd85d14d245a40 |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5d6237dbb9a67bfad3e8c4a6ed02b46d9db79429d738d4bd97c285aa6e484954 |
|
MD5 | fbccf967d53313ab695373b09b7c9920 |
|
BLAKE2b-256 | ba5e28c9426c50bf65a6d6bb19fab59884da9e771a11a49ea7d0541b78b9e113 |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e5dca4b128baa905223b52c9cac8ead4804746c856bf83036c3960cb8ca84bc8 |
|
MD5 | 220e9fbd4daaf5b4bdbe56d0c51d916a |
|
BLAKE2b-256 | cb787628270d289a363c23f4437e4081a3cae1dc1ab150dbd7b8b539a80d1653 |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 03f911ee8395195678586dc66e2a8bd3163663f759394275f2439c718cb74238 |
|
MD5 | 17c2a95e41093e2246fc0a31ce89200a |
|
BLAKE2b-256 | 62fb235b6285c80455459de8daccc429bb2417b32d7d12936353f2cccf3df8c4 |
Hashes for sklearn_pmml_model-0.0.11-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 530c773a81a6c3a7fa3ad85049458a79395c31e78782cc4e90185215aaeb11fe |
|
MD5 | e3ed5b4f921a84d96d74a73bc93c7e9d |
|
BLAKE2b-256 | c5cceab93a21de1ffff64760ae073f5518bffbe2c4fede01f5fa6c278d6c43a3 |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e3239be7053c8cc7ea25629a5fb6f5a25088b30d99ef65c76d7e57c86e0056a |
|
MD5 | 2ab0063ed91dbbd6776b5c7c88e4fb2c |
|
BLAKE2b-256 | 5951724de9940adc4289458de86861a49fadac2121fdca0254e288a1a75d3056 |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4c9114d479a69924b6c9787f72577da3848b32e092cd28b3da42807f6b29ca8d |
|
MD5 | 3e60a5f35d4f2dd27e5115a950b1eccb |
|
BLAKE2b-256 | cc5f5dc87de64adcf3837eb58bf7ceccc1253bd393f970f5fefb98bf8e6ac73e |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50125c2b47be62f41f826c62e3189ca6c2b7419991b43542ba96fe3e2e0a2b08 |
|
MD5 | 240c62b7bdaa539a7101d148ad523e57 |
|
BLAKE2b-256 | 5ede2f8dc802a40895a033434aca2890a6374cbdbeba3317633db3ba75ad8cbc |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 895243ccc78d4e5ec3000c8c8ae6515b8679a63aa1e49282ff1e2d5389e8257a |
|
MD5 | 6f720578f3892b114de1fc270a82e7ec |
|
BLAKE2b-256 | 68afa80c1ee4de5ffcda78bbf9c6b96f91725ea4b0c097d93fdd4b7d25ff268a |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3adebbfd435a9ec74b312c409afaff61afa2dd16fe622c14070dce5c8f96f4ff |
|
MD5 | 35973dfd8c7f2a2931a1ae36391dee84 |
|
BLAKE2b-256 | 64234faad17dd54e27f0c89cb74bdaefb4fd57b279301bcba8f30fd669521972 |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ee3eb3653e1986a7bf0393fb88ca3549def7e0c9bb7f49c3e42d1657eeda7ef4 |
|
MD5 | ae0621baf7d1ae7077e5df9470252b8c |
|
BLAKE2b-256 | 22714b8873040bb19a0fb9a835594dc42efae6d8b458227189aefe0814776224 |
Hashes for sklearn_pmml_model-0.0.11-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6a4fdb51bb069de39fffff6e9d1789ceb1a61275322ea1ef1ffe35f519704969 |
|
MD5 | b84dd08a5f66e737939d153067d78694 |
|
BLAKE2b-256 | 5eab9c95479748897ef7206218d11f2b3e9f46cbf5ea64e080c231f4458d2581 |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e062714db1bd5aaa86084df225a5c9c6aa9ca4700001c531c056069bfb7925fb |
|
MD5 | f8e153a08bedb86098a0095dbcad6956 |
|
BLAKE2b-256 | d1e5f5e3988278e80f910133bb03fd49d117d53e1d929d9063123eba4b584dba |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea5fe99eee1ecb9b74f09bbcf56eb5af24fafa4d37e43d019bfbe19d33316d0b |
|
MD5 | 87d6d616ba8c1b0068f1245ef13ef1d5 |
|
BLAKE2b-256 | 13a4731576d46f7618b65f895a84b193313af0ee4a3d69086e9aa8d73c380cc0 |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b86bedb49480a403008ad89c49e35216d6c42bb2b466cf8c9621a31b7fca3e44 |
|
MD5 | eacf4a12a2eb398b73a0b47ab3f03f61 |
|
BLAKE2b-256 | a77125ff6432486c25a925aeacbc62dcd43fa19dd16cd1de25052ad0e572cf3a |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f29198a8a6040125094b0a64a49fb450d1ccac61c8401ba94f76e4a905d0780f |
|
MD5 | 5d88dd76265d8b92dd0871a4212471de |
|
BLAKE2b-256 | e84d5dc1de7b19d34c170dd96535ccff6bb08ffc8a5250eb39ff4460c4ceb6e9 |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b70a8c32db139ce56634e165d30fd3cd2d79817c284516532a1c0697587fabc1 |
|
MD5 | b79276074139aea9b33b71e4c15acf47 |
|
BLAKE2b-256 | 3faffde237aac1384aed09a0c094f96707cf90f063cb42dbf79dd4978c709019 |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 061be82668b011dd5d11e78e77918f0561b528cb5c77ff489c77aafc69a3fde9 |
|
MD5 | c9691b66da3dc08fc9262c1a749f86b9 |
|
BLAKE2b-256 | cb6dc1423d9513c89c7e963275f88606d3dcd3a05611e9b7ff505cd14c23ad17 |
Hashes for sklearn_pmml_model-0.0.11-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4dc64296ae3856f2bfe3b849274fe3daf6b34d0da786f627de37c2322576a9de |
|
MD5 | ac832426300a91b1202b2b1678ef2982 |
|
BLAKE2b-256 | e0bff9e2ff26ff056e1d782156386b4ad3642d0c29078069bca98e097cd2d03c |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3e0791207268fea52a9f3a208b37ae27a46752915f2124962c33202fcc39a783 |
|
MD5 | a0c3ba762100d4e08e380747193e0032 |
|
BLAKE2b-256 | 0ecbbcdfa8f03a7eff03e59ed617a8895101ee4c92679234f3a815b70dd72e43 |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 955b53889a53ff90234b7061c8d9ae4810947e8a0335fe7f75329fe8657507d8 |
|
MD5 | ce424a877426e1b1812373758ade13ce |
|
BLAKE2b-256 | 1c2bf221a91c40e18ff3908c768712cac5b1237084464dcc2d880914d292a8ee |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 246e0239ea9843c41600d30aec5805481cfefe06e30f3044f8302e5196fd67ba |
|
MD5 | 4cfc1065c465c44c7dba20ac0d1420e8 |
|
BLAKE2b-256 | 7c9c06021a4f65e148d9ebe4490360d42a81b5d0df5c291229dd91468d875251 |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5f8cb6ee59f6b27cd765539d7a1081a994f71279ea1bd6e7e22b101f888bbca1 |
|
MD5 | 3f9928f33ea5e7521baf11630803634b |
|
BLAKE2b-256 | 025bb092ca80099d4802065459df60d57a0cdfea6af82d292b6abd81a4de148d |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | df350265a86eda982ef887bc0c6bb95e5d4848273b7ea684b5c163433babd499 |
|
MD5 | 601fd6ef6cb290a849f6b59c11f22fbe |
|
BLAKE2b-256 | 69fd2c015e23a086b12590b31701969076370784afb0151cba91107a39d77c45 |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bb1c77ec9a81e3189140472435c6ae0c251cfb2f108e87c9fc80129885cfc296 |
|
MD5 | 65a6ae0976e783e01e565e7286290c15 |
|
BLAKE2b-256 | bd8c6cce42aa52c4fd757ad439e6ea9411a02c09dcbfcaa3412d0934f26e3447 |
Hashes for sklearn_pmml_model-0.0.11-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 83a8fb82ae3e758731b773419917d54ee8f5a3e07628d79ce0cd525063451660 |
|
MD5 | 98debcc21e6b0dfd70af932d5948aa58 |
|
BLAKE2b-256 | 768801eea7cc26654ea03277021717de34167790a9e3f31362d95dd94d388899 |