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.1.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9907cc90d0dd63b380df41c40ea9d628cf9cab75d505d6a15389ab830548a991 |
|
MD5 | 3ef041db9c7a5b08e9cc916198fa5a6f |
|
BLAKE2b-256 | 5ef07876cc21ed17045ffaa97640d2fa41f63094fa7b8a428fc1084ba6155af2 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | da75e72863deb7f53408ad2830e58ae6f6b9d6c32d1da6072bb5d3556557ff50 |
|
MD5 | 599715d6ff639efd8e6d274743aa9bee |
|
BLAKE2b-256 | f9ea567ba945067e8709bc0b44d919a68461077e8b7d43c75b542f56b793732e |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9de85fb5d2c153b48a5dae816601f3ae84a636d0fa4ed291d3ba093a273e555d |
|
MD5 | d195b366a0ad4796b4fb24b8238824db |
|
BLAKE2b-256 | 82df5e45f7fa4bc6e63afa1ecfa7d1371f0b2dda1e82b2be62c635988f0eaa34 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 113f1f0f243d6b7b28acf70cd5914d96c0d5cebd8b7f25afa6e64cf3ca82c78e |
|
MD5 | d830943506a7c0e372b5e86b9cac3cc2 |
|
BLAKE2b-256 | aee49d0fc7587673b56306dba639bfa418b9b058aa90e77d0f69e82612fcef43 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9e90e3272b6b9dd18789301d238d9d957da9d46fb1e213ea1eb69a2a29d4a288 |
|
MD5 | ca0812414be9633efbe52522dd7791bb |
|
BLAKE2b-256 | 617486a6210c439fc26ca3590883f9cf80712e3c864b22a3eecb8f79652f75a1 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 725bbc7bf9eeb6d59722dc70701c55aa81ca960b4922b3d7853d0be55d8e255a |
|
MD5 | ec964ef9037eb905fbc68ea1e978184a |
|
BLAKE2b-256 | 7e5d5892333d153349d0d2df9b980b0086e2a9f1af7dd5fa9daa70a77b6a49f3 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 20656abf179c5913ef50f1bf713f90e662fc4185bb5598715bf5c1db202ac342 |
|
MD5 | 63caab4915594b711f020fd3ea55eb21 |
|
BLAKE2b-256 | da382aaaf128a4bbfb484105942fa056c4c58e090fc2019ddc184f3220613651 |
Hashes for sklearn_pmml_model-0.0.14.1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6ba09fd949781db8be43cb67455128d28101795b9849a3651f4b4e2aee0cde8d |
|
MD5 | 7ff7f37d45659ea0bef490e76d1a487e |
|
BLAKE2b-256 | ccffa3dd462294d5c96b58c1665b7dd98b35a0357bb6cc8772fb63e2c5b6c687 |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ae343090514df46e210df5cbb631bf2ff8c891d326b174819b3813f8aa0efbde |
|
MD5 | 2d4902555176a1e65e9dd4e51b5cbaa8 |
|
BLAKE2b-256 | eca752200de52d96e6cde9ea2f95b51f0eb5f39cf2338f0db041676bc7297eee |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8ac27aeda91fde192a87c43967e3125b1d15681c5648165c5a6fb6832eb08ac0 |
|
MD5 | 294bd9953936873f6b580d94d6ec67dd |
|
BLAKE2b-256 | 2baa863b2c25c65dc8f9eea8c4e98e74e4108271b641f7a1c8b8305769c7b5fc |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5289229c55d1a197835a8c3b87d895ef2327fbad071b565d71019703f0ff49a3 |
|
MD5 | 3eb5a5ba116dca27abcf073abbe79faa |
|
BLAKE2b-256 | 46aa2ec94a4672c39688375942261a4147ffac25cd025aa4db3fa21cbb6feb67 |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71d6cf3602ac6eae448319bcefd899d10bb98c5778095c8aa162a537aca53ba1 |
|
MD5 | d15b546cb18a7b48f1d22177858738db |
|
BLAKE2b-256 | b07e8f285e68878bad4a364c2549f863f212790ab72c3574789ba117cab97e40 |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bd86d59125d172d2922897aad9623297e10eac937165bd400f378fcc14f311b9 |
|
MD5 | f4c9067432d7e8f80d5360d4abdbf0c2 |
|
BLAKE2b-256 | 18ffc6899fb9dd7fbda535fe54f0249ce26f6814f12bc6327f18f8c8df253205 |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 15413b03015f7995259ee334df8e448ea629fc800d62a13f8f4676efb73f85a4 |
|
MD5 | bbd919f7c4e52614497907de6c3396c7 |
|
BLAKE2b-256 | 8a9245f86815bee58f572786035b86cb21aecd3299f3814a751eef17f70092fe |
Hashes for sklearn_pmml_model-0.0.14.1-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9da9519a68f1db9a033c32f03165cefb34c586e39653e69b84b5cef9084546f9 |
|
MD5 | 32f6348197317ba5071eff558a89be62 |
|
BLAKE2b-256 | d55c8672c4b105bce55ee7275910b663857fe4743376d4e1af67fc29c8b32ec3 |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 559c707e938c51f94cd30978ba381dc258036d5255547869a02dd210fe2f8c99 |
|
MD5 | adbf9fd1ee54be73dd1b189ecd834d5a |
|
BLAKE2b-256 | 0b0c7830606ad61852f90c975fac296a97289ea74575898187e1b3f06966f5be |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6fca793e6acb4eb6721b72c6898c38e244a58259a06be3131b7db36de1d7a733 |
|
MD5 | cce02a473f6758f88766eda215f43db2 |
|
BLAKE2b-256 | b55252f709fdc3072703280a4d33426385e9c43d8fa646f8976f3f5a748813ec |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1cbf886f50db59c9734b773263b3e4d7e4c8bdb38eb22fedfa2d67c7dd162d29 |
|
MD5 | 3ed135d4be8cbb05ce08b8897ad2ffcb |
|
BLAKE2b-256 | c2fe884b3e95183ab4c3311d1ba5b85d15791aabe31a2e43a0c1d1faebc5fd22 |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b0cb3bafd2f50896cfbb915fae63d070a0929b35c78873cc2c65d869193f39a |
|
MD5 | 9c404551b7d8dda1edb6d2ff847c0a56 |
|
BLAKE2b-256 | 77d5a55313e42403a6b5699e7ec543f565116e108b47b49dd3cd6f13a9a41c6b |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3fda7e3527550423950aa40d74e0c007e4ef48afc853216548fd812fadbcff6d |
|
MD5 | d3672e1ecb0282fc9c3b3d4027db12be |
|
BLAKE2b-256 | da221a50ada193099e8206399ad4a605a7ea1b7e6ae0d84544f4a0c2b772b2e2 |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fa72ed0f32ff0e834affb3d62b1c91220109ddcc8134a653f0ee073fe4f6549a |
|
MD5 | 6d55c50413b6f5bcdad6f33544b5bfa7 |
|
BLAKE2b-256 | b8d72baca3ed20309332f84d64a69b27734e0909ca52fe601f545663f2da36ea |
Hashes for sklearn_pmml_model-0.0.14.1-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9f27751f2a6349da286999d8d9ac32e0260a91c4a9e1b612d23e17f6551ee17c |
|
MD5 | 3eca0d7e0e8cdbc99fba251f7afd7017 |
|
BLAKE2b-256 | b2b73455342634da90a05657d02536aeee62612e77cac42f311146b62d71a5aa |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3791f93dc884f7de3d8e7cf30d3140938b6c38bba0561fec91b64ee6be9d637c |
|
MD5 | c769bab0c4086e191c50d73e626135c0 |
|
BLAKE2b-256 | 5d3987cdf06c94d2a440a7e548657878c384069fbec4b38ccd2b32496bae4ff2 |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4acc95fea19874d66dc0ec7af2ccc77ade0edb3fa904780d86a45a62f7a8b10c |
|
MD5 | 2fd68a3f0115fae1cbd7914cea5db570 |
|
BLAKE2b-256 | dc98642a1c398947f138d74b107d5bf90a150f48b759493e5417922abf86b8c3 |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a96bcd0ef9b7410b072d42a0397434c36ba7bb1b487d14101df9ade170af08aa |
|
MD5 | 6fe35c2d07e5db5c024db849c04fcd7f |
|
BLAKE2b-256 | c9130c99f80af27ed0d6c05ebef94233aa8c0b2ac865efbf2d729feb26a905b3 |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8c48df90ecf3c435cbe9fc95b85e6cf37b19c29cdef64dc0bbedb0959a2f17a3 |
|
MD5 | 5d58f635a6c7014ff67c1ce963ea1375 |
|
BLAKE2b-256 | 62179d5dc06cf4c35c12e2faffe631fee793128c2d00d4a4ebc2ca87e9440d5b |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9b9368ba3ae5284a04f69900f7af2821cfaf108a597229db6230bbe1843ca41a |
|
MD5 | 87ee1b0c97e14ae1f84cae5aa61abc33 |
|
BLAKE2b-256 | bffed72b5128528bb9dea880caddce2451253612a7946ae7b03048c8a2e72d46 |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7b9023bf35c9bd78f333fa7ecdac8c26a79033e4d69a668c8bf912e0c983b624 |
|
MD5 | 48728d9b6404b9bc405d8b6e5add0906 |
|
BLAKE2b-256 | 6563b15c73bb70d8cef4ca8dcb886b15a12d96b266f0c65a171f5586b3f5df75 |
Hashes for sklearn_pmml_model-0.0.14.1-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 2d2da24dde421bed1e5daf4dad420f21754e66bff76eb4f06b77dab996b1c9b4 |
|
MD5 | 05fb92c822a4a154fd5dd60ab67f0ece |
|
BLAKE2b-256 | be867e3e88c2313114ef42a0cb2ca628ab9fcd8cb7b7020c4d94055fb60328b9 |