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.13.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | 34afc55494882ada07fb608ed59c9f2f99fe735bd4c230a0c4b0d0e52dbab0cc |
|
MD5 | 4814a600fb2f73a89937dc5e0a6a1c7a |
|
BLAKE2b-256 | 6a194d70611daa783dc5605c42867ba8b7bd76c744e52ae6a17215c710a96291 |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7a9af257c73948f3370571e58f62211e25b59d537437f2c10cd47aa5834c0bcc |
|
MD5 | df01a1fa307a1e3a751aa5820e3827e4 |
|
BLAKE2b-256 | e3b351646d283f841329422fe4dcfd1fc7b277350bc8e846d89d2df740a1aaa8 |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a5968cef63a49b1821cc1920c995bd5eebf8a44c3de0d6438852ac8f361b80e8 |
|
MD5 | ef0d81a6916bd032bf41d9d9030052c5 |
|
BLAKE2b-256 | 2b599746435a42304a3abd20df644548586400d832b63107e73fd5fb26c2452f |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a2fdcc87510ca3ea2072f03cb2d7c9df495be8c51471bbf4df8d9e67d20f249b |
|
MD5 | 2c67bb23f0a0b8c3856e3bed18a433e7 |
|
BLAKE2b-256 | ef6232b850803b11c7ba3fb954525ab0926f3940b2f45d5b543d2cc73642f75d |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 476483e872992ddd28080bdddc8cf37eb49ed5e4005b91d857cbe833503958d7 |
|
MD5 | b66ffd9513dfd570f4aaa7f5fd9cfcb3 |
|
BLAKE2b-256 | 324db0b2cb8bf16db85a569366f2f3657289cb93e7af549b9c3b876a7850b3ab |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | cdd50f3df11579590864429576e2819b3b0d032a1cc4c8b7e9bd9493426f85f8 |
|
MD5 | 56ebc1bf7e1a03c869c48874ca82db4a |
|
BLAKE2b-256 | 950a0cf25e21d41ded879d531042b2ae96c53505c7a462a26f0955d85fdf817e |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 255bef883bf77e6bcf2fab3d9d4de982e79ebc8fc417c77870346c9ed38a89fe |
|
MD5 | 165af78d18e509284f0668fe0d2d41c3 |
|
BLAKE2b-256 | cdff547fcc06630a4097d35bb006c63536587583f18ec74a258d2956de6f3722 |
Hashes for sklearn_pmml_model-0.0.13-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d0220d96971bdf4c52f9dd7ad3bb6c53383accdea1abdd03203cb1b64ac46902 |
|
MD5 | 3bea713967fc4c0896b924ba2102ae70 |
|
BLAKE2b-256 | 7d686b858dd8fa688ee3dda947a2ef590fb35cc5df9104222795bf6a51be6762 |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a0bec57cf5476dd73de9ec4cd4251b1f7e6588c72277efa637a523581979b0d4 |
|
MD5 | fd9bb59721095a9726a4cdb55f293c8f |
|
BLAKE2b-256 | fd97a1ec75249cdf789c941d3493ddf5990b2afbb8ad647c77e522d0873bd550 |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 49bdc029c3768cc24e2744a6b40776a382c9e9258e591fcd08cb199cac6a4c64 |
|
MD5 | de97155c9a5bdfadaea586c8ed567662 |
|
BLAKE2b-256 | 5611db96afe00ba06ea157fe4a003b833313f835a7cf18169061906981c7b7ac |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c30d24cde96ea5c009845d0c9d1c4f396cda06e5840af68b9bca29b3102b2f4a |
|
MD5 | ff59960904a34de38c31992be180ce61 |
|
BLAKE2b-256 | 5011068f7e3ac8226cf1f8411d9d764d232e9a0b2a00de5f1f4b37cd4081de2e |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b319ce7e317984b8e1cec3d73bc95aa16a50691852d89dd0ee7fb37065c27f9a |
|
MD5 | efe5402510a60e58dfe6e6ad49c92781 |
|
BLAKE2b-256 | 595a902cd8fbdb1835b5c031f39f7cd8567402a7e956518a6cedb498882c71e8 |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 513208df9e2c07e46b7d9832ced467079c9bf4d2e55053505edba42549fafc13 |
|
MD5 | 6329a9c4b496851e403866a1ed6e5936 |
|
BLAKE2b-256 | d44bbeb830a0f7e4a3184cc38c69e78138102f5a1049530e794703fdddcafc07 |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | acb7ebbfa1ea26066c1eed0393d0bbadfc7b87ace091d787e3950116c7157e8f |
|
MD5 | 3a00c5435495b79a7a3d0d3a9c980625 |
|
BLAKE2b-256 | 0b83651dbe7a0a1c42dc6bcb8ce7aef9480b343ad417cb4fbb4ce49b4a42cd37 |
Hashes for sklearn_pmml_model-0.0.13-cp37-cp37m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 8fce72e299b3e67bfc8d6ef5a438cdb1217e6541be4c46b0aba2b3ba235face0 |
|
MD5 | b73159feae5b586804610f2d228c6449 |
|
BLAKE2b-256 | 01488e7334fcfead07ab52ed60ce5a1a1babd6a8ca6f66fd470adc418a4c8a22 |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 1d38b42504d09ba8f08c5b7b658da61f8abe91954d26319301998117100771bc |
|
MD5 | 937d85394b83d0dcb28325ae420d7a27 |
|
BLAKE2b-256 | 5730ca2897c6331b9e0bb3e89e384e8e943a6abe66fe5bbf17c456dad2326fd3 |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | bde1f3a9dc485ce48cec6cd26137bfbdbc0f48772ac56cd2e6d37030b89ed1ee |
|
MD5 | 3106ca334824a867d8b476ff410106df |
|
BLAKE2b-256 | f815bc91c3992574097cc878d29d7f8fcedd02e792ffbe854ba6f0c9fd8873d3 |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 66af9fbb6a987f1e07c7f5ac7660e236fe78baed87baf5391108b4375d4bc448 |
|
MD5 | 430a45cc720addf94a75bfe641becb40 |
|
BLAKE2b-256 | e3e0c7d6df7463a0c43cd428e7571985969d5b1d5702100eeb664bd2e5b639dd |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b9ce0c9f4feaa1f5d55639482aa59f77bcec7bd76af59de4d6c1623611a72c23 |
|
MD5 | 53f240ded8a3b76182fd50798caa4812 |
|
BLAKE2b-256 | a1a797a1b440a02ede81c3fe418d146cee31ccf7eeb03479849d6779c528a923 |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 929977e5dedb85f5fcb255199576bd2acc2111f89d58fb15628b28bfccd108e0 |
|
MD5 | ff13c18d72df45c0ea3ff6381900b04c |
|
BLAKE2b-256 | 0642920583e995f8a88f4934636a75e94cb6e037d05d51e3e1eb49dbc9caf27a |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 6abe80cf9bd45659cef0769060eca6813d1496c80737f446ab16ad91a06e01d6 |
|
MD5 | 05f37696e028a2de6f77280474bb1fab |
|
BLAKE2b-256 | 6a24c814f544caced54f43bba9468067bb4ecb4f9b20bf0f32ddc9a309941a74 |
Hashes for sklearn_pmml_model-0.0.13-cp36-cp36m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 4411f63f93a8b57d0cdbc767940195301b91a8fbf93a31da7d58c447b180a857 |
|
MD5 | 8faa6ffd21291cb1069005b6e0b484be |
|
BLAKE2b-256 | c7b3f224717aca4efa8419af33ed6add8d4620e55308991ac97d20656e574776 |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-win_amd64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef77df71615aba99864ebe0434111b106af6d2119d7b585c62e6ee6ae0af648e |
|
MD5 | 71f72db900cf2593aea4f214ece68675 |
|
BLAKE2b-256 | 796887ea4145cc4dce827b989179ce56b56033aa53d97766c33892a7d6a41f01 |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-win32.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 60961834aea77fa54876d4513f8424925ba3c4dc89b667e342a13ccd0b3ee17e |
|
MD5 | e31c3c3f6ab517fa7ac019185fea3e19 |
|
BLAKE2b-256 | 3ef568e4dcb1a15c2a7aff292c2ac2f6ff073b18f037d98b63f62af78a624e4c |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-manylinux2010_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 37a6361171cc85b7f87a3e28c42c07d0a684da72f46f187b3daf3252a11d72e1 |
|
MD5 | 61d006464c4374234401fd5db9e86cbd |
|
BLAKE2b-256 | c805a544786ea3f762e4d2f69c7abf7c40f14933ca8ded7cc7c5bf50e758d354 |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-manylinux2010_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7af6bd151e7a66b92d8b045cbf52c0c308fbfda34704c66d4ba46beffe278c86 |
|
MD5 | 10b5b82cfd96ee0dc6efba5dfa42305f |
|
BLAKE2b-256 | f9e90d2ca9adc2ae642ac62f8d579774b22376eeb0fdca3dcd23d0d24bef1a5f |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-manylinux1_x86_64.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | d1279a211c71f61ca774c271151f02e165e367ae5ba9afe12028208a1b9ae141 |
|
MD5 | cf0a0c7dcc5ea19e72ad5ba077a3e1ce |
|
BLAKE2b-256 | 8046ac6a00b5a34fc59b85a566df2f724bf74096f6ad7e95bb40b3349108b8c3 |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-manylinux1_i686.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 336a323467f447e410fc87ad596d00981dc9e6e28e295b24ada66a25b79b07b2 |
|
MD5 | f70a99f943c4a70613946e75292d6c3a |
|
BLAKE2b-256 | 7edad90119f5c400e5b61e1ec3d1f4d5bdc3abed8ae0c079ccc10089e2ed00c7 |
Hashes for sklearn_pmml_model-0.0.13-cp35-cp35m-macosx_10_6_intel.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | c7efb0001744f8d41fa55ca9a865868e0c1375cb0a8ebed2a2d46f940acc62cf |
|
MD5 | a945c64207dd13f2b8c6283662dca83e |
|
BLAKE2b-256 | 3b2f1bac28c688756e0d3243cd9d516bd15e6c34f00c3f2314910c2e7927a9c2 |