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.15.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 18ea196bc7053694525103c1ab641c44518a10ab7b88dca3f4fce50abc58b6ee |
|
MD5 | c6da91eb455f897e3e8c00978cdc6cf4 |
|
BLAKE2b-256 | 441e8a895b344122554b01519f1b1fd5b780df78b67c7732afae65c015d193bd |
Hashes for sklearn_pmml_model-0.0.15-pp36-pypy36_pp73-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 77d89d380e6910d83c39e90e7fc49af0084d64c4aca228e33751715252832639 |
|
MD5 | de982c03984ba86f25794373a781452d |
|
BLAKE2b-256 | 6d3525d7c0d714f6417ecf6297756d83c5019177c6fe042ef0a90c1fca582c70 |
Hashes for sklearn_pmml_model-0.0.15-pp36-pypy36_pp73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 71bd87981c01aafdc94af8941511f8dcb2c3044a448e828a685f6c32f8009fd7 |
|
MD5 | 97763ae5110356192c155bb0854b4082 |
|
BLAKE2b-256 | d8becbf8e91f89720276a9dd4e4b0adcc3a0f7f3046cbde150661b0910ad93af |
Hashes for sklearn_pmml_model-0.0.15-pp36-pypy36_pp73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6d867eacd7af285eb2e7c11b928f158765df2c4c0c181b4fd6054bb4039dcc63 |
|
MD5 | 034e6daa7c81a19e370196ebc2bfc5f4 |
|
BLAKE2b-256 | 443444825aa72efe3a70c777f30adbefa1057b81c6140dc2f565bd843b08f984 |
Hashes for sklearn_pmml_model-0.0.15-pp27-pypy_73-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 0aec3e0b0cb1fab9120bbfc7562c470a1a0c76e0244baf93365910d68de0aef0 |
|
MD5 | a8caf1aac3e2f1fd0e0afb2820fa364f |
|
BLAKE2b-256 | 9613643647d358543392f8e71c94dd59b8616f0f4b33ef16dd933ad74d1d880f |
Hashes for sklearn_pmml_model-0.0.15-pp27-pypy_73-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d61bc5e5a4093626f1bbc95ca1b317935418b1df26841e4b0d3dfa66de754e92 |
|
MD5 | 68af31f66f6aa5e7b074d4f1b2599f7c |
|
BLAKE2b-256 | 71d9cfa8d9e1c89aca958b0de0ce6bf4cba907a5fdbbdf417158ca5e70929298 |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 333427df014faadd2d7a2c53ab7c41c42367e6b7fa3e24345822f4e40cd905ed |
|
MD5 | c041bad15c7aa422c5b8f489def92d79 |
|
BLAKE2b-256 | 9fca445fe3646f72d99b84b283ea3a35f57acdd6d7e5c32f405d7f64f8492f11 |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a4f560ee00e7195767b19b1637f650b312d53f09531cd456cafe1a015dc25a13 |
|
MD5 | 0ac7f0cb17c492757be4eb42fc518f92 |
|
BLAKE2b-256 | d60a6d93fef334f7032ef03a00f65b4dfeee8aa1939cf87bc35fdbef1a509ddd |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66ea8582a8d117ddccb8bd8efa76a216fae4868921b8fffefa6716583fd36772 |
|
MD5 | 41e465293292234dbf73aa283109d655 |
|
BLAKE2b-256 | 3d74ec5479520cb9d74ff74b20c5511d32f4dc819f14313ec9c6873bd556c065 |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 434b2fbb9a39dec419afcde931b6e77d25959ec03195b37abd790ab77f204dfe |
|
MD5 | 608303dc2e7c33ee8462a2b4a3397b66 |
|
BLAKE2b-256 | c14683b0f4f20e8ba8b590fe14b06347b06aec0f5fe888f4b70444dc02b70792 |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5a22327cbc81305e29d5d6c0937536df859db3eefe2a9f224c8745bd49ebb79e |
|
MD5 | e0147c01add81869169b464d5a7c87c0 |
|
BLAKE2b-256 | 78176e8904fe4ecc8f8d23048fa6a8a618d3522a602181044194facfa6ec9ebc |
Hashes for sklearn_pmml_model-0.0.15-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1dd5d4c738a2bdea6e788c737bd4abb718e809ba6cbc6c3c55afc6acb344898b |
|
MD5 | cb052ec645f6229354159e9683707371 |
|
BLAKE2b-256 | 3b254db402eb1ca82b4fd194f41d3c9a90fb793d35116480528c43ab00beb3b4 |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fdb73a9e72835cd1035caad4e830949a986ea7f7111921ca66b1411dc55b1ad8 |
|
MD5 | 8b9b54cb28c46eff02939dfabaacf2f1 |
|
BLAKE2b-256 | 61d2476beeed26390e19734d85c31f11d04cc09b3a8e4abeb825d3244e5510a4 |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 9aa7f43aefe2be94eb3b9a0dbbebc0d08dd2b360739157980cd7ed215d1d2905 |
|
MD5 | ca8f606af38b63dfb0f14cbc1fcd28c6 |
|
BLAKE2b-256 | a9855e7694b58094015898d802f5e025d3203a10b363dcc7099bc19d8bcc8c5c |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 47267f695554040d2ae964cd62beb9435596cf9d91b97b486c8c4823a3eb400f |
|
MD5 | f2056927f259c8a66d1408a826beb207 |
|
BLAKE2b-256 | 44146f85b6709a00b4742d581ddc95ed0bcaa36240dba2ca7e6e51120af37071 |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1b529fc051c41c13baf18fdc0d71ba77923695a5b5ac699c3d46b041d6d52f11 |
|
MD5 | bc8a465852e201e21bdc3ba23dc72118 |
|
BLAKE2b-256 | 2b9b3becad652c46108524ff6e5631db37e9852ffda200a4ebd06aea7583ffaa |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21726ae053880b4630157d3affa4bb2706641c005193723c5c6965b2d246634a |
|
MD5 | 982e3dc6b7ec8944ec2e2addf2f3f6f9 |
|
BLAKE2b-256 | 44f98f39cd31c0b1672b53f6afea3371f11e46d76d8904f2ec4917585b2200af |
Hashes for sklearn_pmml_model-0.0.15-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 663ead40d509c4a6318d1a4619634b55ea0fdf1951a338b5e0758231e26e7865 |
|
MD5 | 5cb6b63ab1e80f0e651d6f7b43599f60 |
|
BLAKE2b-256 | 750dcdd02dd240a94c9503800175369bfbc7b6b2dfe148fc70fb47dac19ffd51 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c0578e2c2163e5417d6ab4ce6a7dcca739864e1cde92ae271cb82c4654f88be7 |
|
MD5 | de94cfbfc3537eb7556b930d7f1fa5ae |
|
BLAKE2b-256 | c77b08f5768675425b82e7a983985a9b5d4d1ac0321b28973c8c91d2af947639 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | aac87bafec94fc6fbc7df19049d7bdcefe7c6ca9bd763caea7ad666b71c074a8 |
|
MD5 | b40d889bd80eb13ad1f222ae00574085 |
|
BLAKE2b-256 | fbe0ce217ce22f4bf6d82d2319b23d807cb62a9462fd27581b9de3cb63b39718 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 22a6c5999aa9a478774965b2709b946c8ebe0e7cbe98f49d20eed606634dc034 |
|
MD5 | e23ea0800de57070b735d49a6afd018e |
|
BLAKE2b-256 | b49e9afae9b4c199bb6dc8d891f455f15afefbd840e144193447e6a70b5a6df6 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d22407347a461342a9a6bf61916d3a386c264b007bfc62bc16a4b517d927aa9a |
|
MD5 | e2cbb366dcdd74affce51f03357207a2 |
|
BLAKE2b-256 | 74a5780bdcac7c0d13282611b63fc9f336ab56918ed313047630e8b82b8a8c77 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8d2fb44f4e43d62632dae5e4a848263e9dc59752a79c67fc9f4f7c1e29e7ec2c |
|
MD5 | d6c11b93b6ce90570758eb68e032c1ee |
|
BLAKE2b-256 | 9fd395fb4f50059013fccd30b316e09ab3ddd9d739dba6050cdefae42bd5f696 |
Hashes for sklearn_pmml_model-0.0.15-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d93531861c1025224ca9fb734cc46d1d9b164245cfad33faa716fd51d70370ff |
|
MD5 | f71bc1147e8550cb7c733182703713f0 |
|
BLAKE2b-256 | 8678614b10aef35a1b6069d1786853d7dddc366a651ec6366fa17572605ef5e1 |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | fb2f1ea99a090e18fbf8291c6ce4a9820d9b87ea96098105a946aaf2ad902188 |
|
MD5 | fa307a87eaa2abc364d4f002a9bf94e9 |
|
BLAKE2b-256 | fdd1722aaacee1a72972eab2cd7e74b7c0141067148a0a2b4169472a66af2e1a |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 529f82ac7071f80e1f660b58e7b6061ec019fc77a005f1a986d77f40d697b001 |
|
MD5 | a1999aa490ee7a6ff23dfcc302870a0f |
|
BLAKE2b-256 | 2f5625a8b0a81a908c7901f3a53157cc4f14e008cc8944f005a07969ffa5b640 |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | eb21c89cbe9774070be91c9019d1757a51a1e829ffc76c5fab19a3d1672874ea |
|
MD5 | 1f79989cc4cf511adcefc63639b4066b |
|
BLAKE2b-256 | ae4e069043ac812fd4eb38e657d364a5b5e293e61987c7eae83f328cbf803938 |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c70ca9569446618d17e4221978c1d42c2ba9956b627cae1bdaf2f85aacd93c14 |
|
MD5 | 7035c60113197a98e461517c2209c862 |
|
BLAKE2b-256 | 90569101d8a35364404dedbbac7953fea355561f259e16b052a92d77e71ef7e2 |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 67c500a5ffdf0a164ea2393e5582ffd6819ba2533721d7b1aac64b26781bbbd0 |
|
MD5 | 35ccab1a8965dfdbe2325b4d7db1cf05 |
|
BLAKE2b-256 | ffc5afff9beae00a084e12f6fadd04e1aac59211c7a8fc047c62ab606583c0bf |
Hashes for sklearn_pmml_model-0.0.15-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 3793791cf0ccaf408a23a99d78ca7aba4a1843f8d433966956174b34703a4251 |
|
MD5 | 1ebea76efbb665db473b80765000357e |
|
BLAKE2b-256 | c0be6edf4b3b43d5e2c0dae65aa81c834a052bd6146fdd46730714153ca56ad1 |