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 in beta, and currently not all models are supported. The library currently does support the following models:
Model | Classification | Regression | Categorical features |
---|---|---|---|
Decision Trees | ✅ | ✅1 | |
Random Forests | ✅ | ✅1 | |
Gradient Boosting | ✅ | ✅1 | |
Linear Regression | ✅ | ||
Ridge | ✅ | ||
Lasso | ✅ | ||
ElasticNet | ✅ | ||
Gaussian Naive Bayes | ✅ |
1 Categorical feature support using slightly modified internals, based on scikit-learn#12866.
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' for Random Forests, 'modelChain' and 'sum' for Gradient Boosting)
- 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.16.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 407df2020c234cd90addd5a634161639f07bf88441d20c7600e863190332b8d7 |
|
MD5 | a54c67e1fcf555a39bdfd16bcaf0ec14 |
|
BLAKE2b-256 | 9035b667c5c7f8e0d33708c7e3ababecec7f3d30068fc254602e0308e2f23231 |
Hashes for sklearn_pmml_model-0.0.16-pp37-pypy37_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d16c42b1c29128f98fb09e6c84fb65537fba8ba01c1e8f93235412f3a8f63442 |
|
MD5 | d695ff68374d1b300501b52a5e8affaf |
|
BLAKE2b-256 | 65613b9955d18b5b0e1035e93e5a1e91fdab2797406751bb863a3f7f2279e309 |
Hashes for sklearn_pmml_model-0.0.16-pp36-pypy36_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 195834d4d0919d7f702a3d6ef648e607283c1379210bc8f7d2a38a5aa13ee8d2 |
|
MD5 | 07d1a7acf1e630f91047673a088981af |
|
BLAKE2b-256 | c3f72ebb0aeb4f5b61b44fa7ee5629abf323afd3bb2ffea3146706fb3241f53d |
Hashes for sklearn_pmml_model-0.0.16-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a31247d83ce0c7136e0fc91949a9512906d9f0f96551c59ad92ef2286600eb8d |
|
MD5 | edfffe27c20dca8869cfa716d748a721 |
|
BLAKE2b-256 | 505cf3a4b6d5dd2fa23945da3194cecb4df84922e7565a2963eb3b6844114bfe |
Hashes for sklearn_pmml_model-0.0.16-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | e1236655e595e2533499d94b7412cdb24adf3eabe820fc81b407227353298d02 |
|
MD5 | d383c359694d2c6ff1cd56ea1ac93521 |
|
BLAKE2b-256 | bdb922e8c268600d9390db7c9896998af37bd5bf11f95c02967ded4882716c08 |
Hashes for sklearn_pmml_model-0.0.16-pp27-pypy_73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 897437b93daacedbd79ba1d5cc799c18999f603434fd2ff68a9fe4c9181d3afa |
|
MD5 | f0d01f4319736820e4753ebbe9cf303e |
|
BLAKE2b-256 | 1b21edd62bf21450a568192e590a7683348095220123f9a4082e3d1769e38b45 |
Hashes for sklearn_pmml_model-0.0.16-pp27-pypy_73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09054bfd774ec0b881718223dbf1ce436ecafb68d2c9eb6ef47c27cbd166659b |
|
MD5 | db7e77216e8e0421f9dbbe42e4caf979 |
|
BLAKE2b-256 | 30de5e9cb5476068091f2d69b714ac4bdec74dcdd3ece8b51cafd8a1cd46e847 |
Hashes for sklearn_pmml_model-0.0.16-cp39-cp39-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3816248603bc07c2d352da0c4dab1a9a577ea2b7feffcb878d0b78dcbd88f627 |
|
MD5 | 3afec4bbdf7b100926b5dab00228bdcd |
|
BLAKE2b-256 | a3b0e016bbabc697b8e3129627c861a4add4f1c1bc9b199300b77b5e3ce42ae5 |
Hashes for sklearn_pmml_model-0.0.16-cp39-cp39-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67ffbb15e3e75550505f0bc32bcac69fa58e8bd45750cce3972f3fb38e0df3bf |
|
MD5 | 4877f36632845c6d6912b3b6c2ae65c3 |
|
BLAKE2b-256 | 4c27c31a8ba184bc17eac10bbe1a06dadd227f84f7331e2a718475c75b9cb6a8 |
Hashes for sklearn_pmml_model-0.0.16-cp39-cp39-macosx_11_0_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cd9e88b749d54b83e904944e6b245797674b9ad362bf288321aaa5d7d18b4cb0 |
|
MD5 | 7ead820ccebf9f20a819bc1711d7d7e8 |
|
BLAKE2b-256 | 7ac866167f63d93e078d53ab1d57ca376448ed0b8e1fa8c0b992e3579c68500c |
Hashes for sklearn_pmml_model-0.0.16-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 09ecd7eff70d516e322f0dfd963c02908ebe956098a5df6853ac0fd1a0632a1b |
|
MD5 | 95e43dbd2d7f6cf3292097fb005a2326 |
|
BLAKE2b-256 | 3e99a6febdb33eda25fbc5a6e5b56c66c53cacc99a93661b1574c80d0acb0bd8 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 940d785d76a4e85914c8106a92477f13bdbb95b4af85afb261bcaaf536733c80 |
|
MD5 | 9ab94696e594817a9d7440ccf883bde5 |
|
BLAKE2b-256 | f8570fc0c142ab3788a4e453acff131f69bb9e233d69cd6323d208204aeab447 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dd96637669d3e22707ff1b8f4ab5f7d64d2852685ab84727901ba147b35f0e26 |
|
MD5 | da4113493d8cdb4b288184f03c96f7e8 |
|
BLAKE2b-256 | aac1876c26e1c2525923cb973006587bc601a5020d7675b66d16499ab5a97ff0 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ec39c0185fa6ed6aaa3de2caec6de44eece5d5e9a4b53901487bcdb5a1aef22b |
|
MD5 | 53c1c952aab3df65ff04c8971519743a |
|
BLAKE2b-256 | e51e8f15bd34d13259c778f59da3c48e661e1cf5639d3b2b60c73e70157d9460 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 69def48bda9c8c160be412b0fd8dfa812236a65faa2b68aa3d7a4614c75420ef |
|
MD5 | 56a3ea3999a369a8923322168fca4d9a |
|
BLAKE2b-256 | ac4e9431ed962c4eb5f0d3480a53d07617af1863494339e3eea2bbb7a7fda6b1 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0266e6a9555a6dc167fd420bd7d00c0c1191b664f34a4ef55b54beb72a26d589 |
|
MD5 | 2fd789c3437eea88f7c0deb419fdcf65 |
|
BLAKE2b-256 | eb32062e1b47f9a9e0f7b822cbfa5e546b96cc605f9dfe0af1aea4ec8f55a786 |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d41e49a0cc0a2665b174f6b21d41e7f5a6b4eb45b5faab6d489657c78ba35e37 |
|
MD5 | 88a7c8950e473b9a9ab84b65b11ceb64 |
|
BLAKE2b-256 | 410d268f4da77f44824fa466b11801d6e688ec234b7f91047b85ed7d8ff8390a |
Hashes for sklearn_pmml_model-0.0.16-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7c0bec29bb0fc128d06bc1cfa08f331557f8383aa9778b433e4d31d34b433d11 |
|
MD5 | 7dd6e3e51124916bcb0fa7f2d4440b20 |
|
BLAKE2b-256 | ca1613871f441bb33abc58d7ff6736bb879282b8cf22b3e0591852fe4867c237 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 246f894a4761105fb60cf5a49b295c251aaa25d743cbfffd0b5c75814a8089cd |
|
MD5 | 5e2bbf2a2c33cb0ddd7a89c0493b9d78 |
|
BLAKE2b-256 | 21f0376c7c7b42da8bfb01e39eb3d0bf241d33b21a3e9200a013eed167c8405b |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | caadd1200c24323e67383de5dbbb924d15b7a193fee4022e0f575860539e127d |
|
MD5 | e6ccb188ebf730257492f1e103935f4f |
|
BLAKE2b-256 | d980981e14df8ba462f59630ab064846c3170037f121f25528ce1055d575ba72 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3149c8a93fa693278263f47fd06c19f75ece6dbbf482710c3c0ba7202ee69543 |
|
MD5 | 07c482662313a517c8de1e58c71bb04c |
|
BLAKE2b-256 | c37759125444f200129280d43a9af4003b237ac79b0e74e90f9d9f3060084db0 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cf0c17de47f8bda0c0ba3b82186bf03b41a953f54664793cd570cbf1e01ec190 |
|
MD5 | a8fd6c10070b8847cc200275d6dd2393 |
|
BLAKE2b-256 | 58ff483f06a92679c0c0e5f52412f42374e7b671df46744062890885acca8c65 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 520d2063158c0d2c4464b91c6ce501787b94f68194d91ee4afeebabff72c7311 |
|
MD5 | 6d6fc3db2a43e0670bab71bb840d407a |
|
BLAKE2b-256 | 4a50bf7dacb2195855804c526db5f30148f0570b8a62d9846dae8ce1ed7b4842 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | dafd2da14ea34a3f9ba62a6a05bae42c7a4e3714dacdaab0ec2efbabdf08a733 |
|
MD5 | ed74ff4cb1f642d555100bf1b2298f03 |
|
BLAKE2b-256 | 8d9667445da6cda9cc91c422951294c1da691d2a8cdb9921b4a613398392ae79 |
Hashes for sklearn_pmml_model-0.0.16-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 89379b0c921266a1728a5437c65209e6f283baead693d7729eab7d5202e7086e |
|
MD5 | 41d3e00e38d12f78ab32b06bbff19860 |
|
BLAKE2b-256 | 7bfee6b20e803d84f101c8d969b192782921fbf0448b5ac800b091d63662a44a |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 43471267e10e74a3948061b526d4e62f21b440b0f29bb53adc9e38245fcb9ad1 |
|
MD5 | ad8ff0545545194d73958df9f13b5427 |
|
BLAKE2b-256 | 9ce3ed5cfb1e69ccf59f6755ffd68c38fb85135a24efd227929c82a2d2690fb4 |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 62460ac57e687ba2819d75615a171789190f9ff0824e72c02d506b0558b7ede4 |
|
MD5 | 86fea43968c6a2dddddc35591ddbf992 |
|
BLAKE2b-256 | fde2832c4b73f695fab270c05c63e0cf101e0037d0f234cd924c5de07242d4cf |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7afe0e87f8ccc16f21d810b51fb8f6f1330789cbabed646bff7f63784913683c |
|
MD5 | d185bb70ea233616c1c07c9fa2f9ad30 |
|
BLAKE2b-256 | 1b0cfc4ad1c2c6c0e1d233405e430dca2f44a66d5ca07589e64ad326a4aaeff0 |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0f933a733ed608de97ceff5151eb53716d64efc32f5d3b4e0533d543096503db |
|
MD5 | 31faf3d689f445a934521ce7ed4c972e |
|
BLAKE2b-256 | d453ecffc76d2d8ea014d88f6ca757a71f84627f9e5986c89677aa10a06e646a |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 41a5ac28f547c452561f2d757bf1160a34a93fc5db6ce52fe5b8e56741cfb040 |
|
MD5 | 767b9c76ebc63ec35ef8e208a299c4fe |
|
BLAKE2b-256 | 9ebdf4b249dfead0b0d4462551c767d66cfff3ff386990bc55f5e8ec10dbb87a |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a080e03a94333b5dd55ea378dd8cfa7f4e280a6d0f90821de8b519d1a15114b5 |
|
MD5 | f1755d1e0f351edaae8c39f33c0bf7e0 |
|
BLAKE2b-256 | a2d3cc3271f2ab431836b4b692e479f48905d3d335723d0674e4a6ba575117c6 |
Hashes for sklearn_pmml_model-0.0.16-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa0593b4bde21f71cb50a3820b0f1cc2a4d21d82908e4e43b5057bdd8cf059bc |
|
MD5 | 3b58414f650581c6225fd7f9b924ee74 |
|
BLAKE2b-256 | 005650cd4d98af70562c03538bb55e3156dc3f238dbce33dee4f1804d69c33d3 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8e027c23dccab391b468e1ec5e28a20ca51f6b52a0f9544a23e4463457b382c7 |
|
MD5 | 87d220d2fea50fe2b9c75908dbd8517c |
|
BLAKE2b-256 | ae240e362f7db219a04d99a09603e1a2d9336c7892496bc0c16b549d0c7047e5 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 582c1198e03e66199e7b0be609d797762d9b45fbc333a1611c2f2156029ea065 |
|
MD5 | a24c059035355e486965ef8e9648fb1d |
|
BLAKE2b-256 | ce07f340a94a4da621fccc05f1d3ef819ff1dfa4817d70269444d45926efa382 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f487b21ce7605da7998caa0b205c58670cdc1923b78d53f5331e35ca869d5aee |
|
MD5 | d701128354082fee3f534a8b902ad693 |
|
BLAKE2b-256 | cbb10ec1c9ce0441a9920dfb7c5b5045633cc21339044e5c9dd12707b5018f57 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | f013782167841200e7f22cdf5e7687bdba1ff830a34e36fdcb7aa13ed9a9c08a |
|
MD5 | 2284c215e15deb7abfce2fff5b666af2 |
|
BLAKE2b-256 | ce586ca84d4103a998c40af89e0e05eead43b920e4177337a260587272d07a21 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aec06f711a69388c0ac5717d46f16a1b198b7e2d3b4a06f409488bc002913839 |
|
MD5 | 0ecfa3ccf210c462fdc4f2327b1ce14a |
|
BLAKE2b-256 | c32067d9c2eb9cf8a0796b0c75815d9fefb11bf4106972cf88389068ca37c04f |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9048ce06c2e409643e265249e269d052a2aecc094c9d33fc46fefdbf1e1c0bd0 |
|
MD5 | 1cc6db64eb9241999e76724f4853cba6 |
|
BLAKE2b-256 | ac23f685e614ee3aee1a7cc2448a63bb29d7e726dcf759ee8cc97eb59c474563 |
Hashes for sklearn_pmml_model-0.0.16-cp35-cp35m-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 363aaac2b37120ade268bd43fa8221e5ac11f197d52af2fb73a4d04b162d9303 |
|
MD5 | 68fec864d04890f809a9cda8dd762213 |
|
BLAKE2b-256 | fe01072f3d34913f6b4d02a722fd5a93563323d88afca056029d4845ec1a6809 |