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.12.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | f6540d204d7cf27a6c54e8f0d603ebfc2ffe345ce5dddac7e7f7d5429a971ab0 |
|
MD5 | e92117820da3011d3c93a295490d0d2e |
|
BLAKE2b-256 | e56a8b6d62a35c97a2970611e05882f93e685891fd40c371a75339b8fc48fda9 |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 383eb3b14678d29305b8fea6046287e1fa89aaa224dd06c6fa7b63ac0fe5fcbf |
|
MD5 | 1d63f2effd667ad508cee4acdf8116f4 |
|
BLAKE2b-256 | 18547259f623ff0f4a77de84de2e480e8c2907cad47daf29b2d0e010416eeb96 |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2b42ac9cb595c9d3b8c7ffe6beb70cea61740c6f3bdbaa079fbab567c566f171 |
|
MD5 | a03c5776e5f7e812f4c4d2a2eca9e7d1 |
|
BLAKE2b-256 | 102c0a271ac4c3d187f7d3b91643ccd60eb777325a01d59636caccebb907ee57 |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e4fc8c88390c8f4b731274d0b129d9d5ab89cc61b7dd482c1a482cb3740fdf8e |
|
MD5 | bd08eda1113ee299b472f70223ee34b7 |
|
BLAKE2b-256 | f5830cf16d339d2f333840249912a0e6e51041b95de59ae9e026a927ceba6566 |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1ad154d6bee7e328bd4a917b41a655db541bef9a4cd14a97565224035fb326ff |
|
MD5 | f47690db02e2a589f9681b89eb888670 |
|
BLAKE2b-256 | a2c2e416cdeaa4f0ccd6f43c98b7c94dc04a57caa31914fa5ebf1366b07a4c2f |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c2b8af3c7b6adac48d3569af99fb44daed2dac61a338c9e3e79bbf10c1de43f1 |
|
MD5 | 77abe3c55b5d08dbc61a3bf5bf1c527b |
|
BLAKE2b-256 | 23c97ba5a67e2baaba38e192f2aa717d600d635493d327f48db314ea4b68016d |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c6ef34285535f95a2a66e8a6d7affc65e5122dc6046ee8e077e0dc5f63ef74af |
|
MD5 | 367d14074dbf294f2a0ba07e02f62be6 |
|
BLAKE2b-256 | 3bf297d6028dae9e3d819b3453696bfe8eed34e510232cd5eec0b9dcdb4d9d91 |
Hashes for sklearn_pmml_model-0.0.12-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d5498a9e92c012785f0347a4a56f7ef1b90a33d944785eb156fd90addd6100f |
|
MD5 | c99bc24b0dbbda2a0bd29f7fe2c8f455 |
|
BLAKE2b-256 | 1bc5559910008a69dcc851a1a917ec4068ac06f326ccb191dfb6e2b6395711eb |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0aeb7698d422eeb99a293992fe41cef004d736d9c7a33139b157efd15f84d8a |
|
MD5 | ee3d3534713810e315202db25686752e |
|
BLAKE2b-256 | 3a57b068aa0c57e833dbfb33cc2170c9e9b3a3d3b0f96f539ccf44b031442a11 |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fab8db0c30798d082fbdaf01f361bcc2db5a86395e20897b19f7740d48261147 |
|
MD5 | 833a60ce27c5c4e795811001b1c28479 |
|
BLAKE2b-256 | c208d06e2c661d243ed8967341ab6a6e6be9446c53e8d4ec1f438d384f2be94b |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1a6e803ece8017d0fdf88313a76b4f1ccd08333bdfb56100683810da0b3df20d |
|
MD5 | 7813893df892fb44cc671f491cf8a9a6 |
|
BLAKE2b-256 | 7b77e566670b0cf556e3736872151e8b02d6a40c847ce743682029c55afda4fe |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | becbe05d78ac12ba6f542596c7abd89f8b883b4d3239d70ce90977584f8a5662 |
|
MD5 | da8c9b2e407f26391ac049eee8ffd260 |
|
BLAKE2b-256 | a0f122e8b29bfc6fb7c1754c923605d4bcafce43e86da6ab07117be6fd45e495 |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3cd7d6b6564107e781012022204dd4cc66134fed27745603a67dc51c161b54a4 |
|
MD5 | a2cc97414098ac7a590d2b26cad60da0 |
|
BLAKE2b-256 | abd392702868ec76dc9e9b07686326626557baca22aaa9204baacec3645d2839 |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d5e43fbf0dd869cbe80b7e549ae016cf6d46e55618ffa898221d1007b7641aa2 |
|
MD5 | f0f82f0fcf52f5c67ccdb0ed21ec2f89 |
|
BLAKE2b-256 | 6a82ab544a8fc9753bdfe6e18118a92eb28b242a985f7447aba452338894455e |
Hashes for sklearn_pmml_model-0.0.12-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | db8a45d20db55294dd0a8bdd7425f73956711b91a8b4df5736be6539a94b6730 |
|
MD5 | 797c08216cef1ea448bff27f64134c36 |
|
BLAKE2b-256 | 446ac231068e7860c67cc50e6db9f2ca5fd5b5f48299f998f9cde8fceab6c9e5 |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6f3d91b66a8a117f3d4935235e6400d0478c16a7aaf20808d0aa1d5c08901663 |
|
MD5 | a2f09abbf70c49a721cf363a40922e7c |
|
BLAKE2b-256 | 5843c95998fc60743296caf5163f3775fc7d54ac27587b6fa0422ba78bc0b2a5 |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 945fba42863ef3783cc5305a791f746fc8e9bafa85e08a2eef95528190fcf3b9 |
|
MD5 | 29926b25a8f7307888b0c5cef6751737 |
|
BLAKE2b-256 | c682de52ccf9a6f8c4b6f02a2719ec00090900904a300263e9714a429c0b22ae |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8bc4dc0845c05c7f41cef9e7e69742433dfbd5b548e51295312cdc8a6e1a5d1a |
|
MD5 | 6a93cf0669c9df3c0dac44d5eb9862c8 |
|
BLAKE2b-256 | ac2f4079063109ada9b7485b76d0528668cd35dfa2cfae10748456bc07f8f3e7 |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4656b6a95cc0b463fd7269f47e4cdb65d908da6b9c22c861cadfcafab402e83b |
|
MD5 | a43f4b539fcaa8009f8cea9a850407cc |
|
BLAKE2b-256 | 61d4dedfd4b6c51277112e81edd354a55e33cf1d6d5b344355a65a328b14c0aa |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aeee3308b25157322e3e0e148b575641162bf203a5a2ee6c4162d40b5276d292 |
|
MD5 | d7312277ba6b5d598c8af388d2e51136 |
|
BLAKE2b-256 | cdbf1fb3dd256d3015c45e2b99cc0803bdab75c405113e18dcd5aed6a727e76d |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a03dfdd27b70bc6534dbb190c4e91c9cc25a08f2daa711c3092587232e48e3f7 |
|
MD5 | b8441c90c4f57b63c9b413263742c0eb |
|
BLAKE2b-256 | 950a8eb4199493fcc3236a72068be2f5f7ea87c67b69a835f54876221bcdc2b4 |
Hashes for sklearn_pmml_model-0.0.12-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bab24f42dc2c6672f39b5839f69d168dfded98dda88b650bef285814423c4dce |
|
MD5 | 5163a16102ad00fdb1ea3bb9b55168b5 |
|
BLAKE2b-256 | 1776bb1bb7c5e03e4d6bce4dd9223c6c4eda7b9b6fa98021c31cc5830629aa96 |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c436702f2c7239e99faeffda69084a9c36f6740c3d18d328c9f0f3da632f8a7 |
|
MD5 | 3979c5c863f60ce6781250e01b75e691 |
|
BLAKE2b-256 | 75a2af5cbe6cde176e31411aa55d52d9bfb66295a5ee7fd9d6fd2376c5b2664d |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fd44f5e1dbcf63e7f6a9a7796802bfcde4e5a9a29fb5c800998f888e0fde277a |
|
MD5 | 7100a9dabec8073738fa41a4d6fc0442 |
|
BLAKE2b-256 | 724ed64f6889bf24b1f806102380d80a6d7e17352671517710305dae67b3822d |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 86fa38e455c791c48011dfd224b096ef193a2da244236de4533d7f3a3b509b57 |
|
MD5 | f52ce83ade6573824899f2f85cb1a5af |
|
BLAKE2b-256 | 076710992992adffc02066036655554379f0552789172f6adcab9111d90ee5ad |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7153a2e61f75e92affec448eef112fc3c00efb4e07b7ebbd447bf64b0abf347b |
|
MD5 | 496ce3ae90196f1c45a7e467359226d9 |
|
BLAKE2b-256 | c00bd23c4f609450bd78153e34e3f811937e09f71cc1b0a45d2ecd6c4bb8c9cc |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3df2e5f7c10f43cfeb600ed2519a6673eb73004db3e008481528dcb6bec41253 |
|
MD5 | 775a9f4d7d449b272ebf954b14d7c041 |
|
BLAKE2b-256 | ffb6b7c24fae9aa6b44b3eae04e488a6471043075bc8eb06efbe37b184128d10 |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 152880839b15a4e402fe96ee53fc4dab27a5368d644e0db1cf4a97306a56a579 |
|
MD5 | 1ebcf74f6b1792609c732037d8055444 |
|
BLAKE2b-256 | 3f2e96fcbf6d82817422d7fafab95da952f91cf4ed1fdbfb2329345d3a002796 |
Hashes for sklearn_pmml_model-0.0.12-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e83ad06b173019727cd03abc9469efa27339fdae135807511c615b242de551c7 |
|
MD5 | 44d632510be4001f60ab6e44564d4993 |
|
BLAKE2b-256 | 6518a33232168320944281da1bd732ff6751dbdda7dc18bcfc60a630b521004a |