Skip to main content

Python Runtime for ONNX models, other helpers to convert machine learned models in C++.

Project description

https://github.com/sdpython/mlprodict/blob/master/_doc/sphinxdoc/source/phdoc_static/project_ico.png?raw=true

mlprodict

Build status Build Status Windows https://circleci.com/gh/sdpython/mlprodict/tree/master.svg?style=svg https://dev.azure.com/xavierdupre3/mlprodict/_apis/build/status/sdpython.mlprodict https://badge.fury.io/py/mlprodict.svg MIT License https://codecov.io/github/sdpython/mlprodict/coverage.svg?branch=master GitHub Issues Notebook Coverage Downloads Forks Stars https://mybinder.org/badge_logo.svg size

mlprodict explores ways to productionize machine learning predictions. One approach uses ONNX and tries to implement a runtime in python / numpy or wraps onnxruntime into a single class. The package provides tools to compare predictions, to benchmark models converted with sklearn-onnx. The second approach consists in converting a pipeline directly into C and is not much developed.

from sklearn.linear_model import LinearRegression
from sklearn.datasets import load_iris
from mlprodict.onnxrt import OnnxInference
from mlprodict.onnxrt.validate.validate_difference import (
    measure_relative_difference)
import numpy

iris = load_iris()
X = iris.data[:, :2]
y = iris.target
lr = LinearRegression()
lr.fit(X, y)

# Predictions with scikit-learn.
expected = lr.predict(X[:5])
print(expected)

# Conversion into ONNX.
from mlprodict.onnx_conv import to_onnx
model_onnx = to_onnx(lr, X.astype(numpy.float32))

# Predictions with onnxruntime
oinf = OnnxInference(model_onnx, runtime='onnxruntime1')
ypred = oinf.run({'X': X[:5]})
print(ypred)

# Measuring the maximum difference.
print(measure_relative_difference(expected, ypred))

Installation

Installation from pip should work unless you need the latest development features.

pip install mlprodict

The package includes a runtime for onnx. That’s why there is a limited number of dependencies. However, some features relies on sklearn-onnx, onnxruntime, scikit-learn. They can be installed with the following instructions:

pip install mlprodict[all]

Some functions used in that package may rely on features implemented in PR still pending. In that case, you should install sklearn-onnx from:

pip install git+https://github.com/xadupre/sklearn-onnx.git@jenkins

If needed, the development version should be directy installed from github:

pip install git+https://github.com/sdpython/mlprodict.git

On Linux and Windows, the package must be compiled with openmp. Full instructions to build the module and run the documentation are described in config.yml for Linux. When this project becomes more stable, it will changed to be using official releases. The code is available at GitHub/mlprodict and has online documentation.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

mlprodict-0.7.1625.tar.gz (608.0 kB view details)

Uploaded Source

Built Distributions

mlprodict-0.7.1625-cp39-cp39-win_amd64.whl (1.9 MB view details)

Uploaded CPython 3.9 Windows x86-64

mlprodict-0.7.1625-cp39-cp39-manylinux_2_24_x86_64.whl (16.3 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

mlprodict-0.7.1625-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (23.9 MB view details)

Uploaded CPython 3.9 manylinux: glibc 2.17+ x86-64

mlprodict-0.7.1625-cp39-cp39-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.9 macOS 10.9+ x86-64

mlprodict-0.7.1625-cp38-cp38-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.8 Windows x86-64

mlprodict-0.7.1625-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.0 MB view details)

Uploaded CPython 3.8 manylinux: glibc 2.17+ x86-64

mlprodict-0.7.1625-cp37-cp37m-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.7m Windows x86-64

mlprodict-0.7.1625-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.6 MB view details)

Uploaded CPython 3.7m manylinux: glibc 2.17+ x86-64

mlprodict-0.7.1625-cp37-cp37m-macosx_10_9_x86_64.whl (2.9 MB view details)

Uploaded CPython 3.7m macOS 10.9+ x86-64

mlprodict-0.7.1625-cp36-cp36m-win_amd64.whl (2.0 MB view details)

Uploaded CPython 3.6m Windows x86-64

mlprodict-0.7.1625-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (24.6 MB view details)

Uploaded CPython 3.6m manylinux: glibc 2.17+ x86-64

File details

Details for the file mlprodict-0.7.1625.tar.gz.

File metadata

  • Download URL: mlprodict-0.7.1625.tar.gz
  • Upload date:
  • Size: 608.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625.tar.gz
Algorithm Hash digest
SHA256 99efbee837436b01f3ce991c40df00b10759660f1b25c79660b2cd98988b8655
MD5 a17de254e98a523cde4f12767fda7a3f
BLAKE2b-256 4014cbfa7f1cdd61086c97c58e374feef75682efe75469ee6cd15437624b843d

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp39-cp39-win_amd64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp39-cp39-win_amd64.whl
  • Upload date:
  • Size: 1.9 MB
  • Tags: CPython 3.9, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp39-cp39-win_amd64.whl
Algorithm Hash digest
SHA256 03015efe4225fca427087a21cc17ccc6d2ca78005c0444dba825bc606e7a4842
MD5 2358e1f2bdd490fe6fbc6e0f21b643b6
BLAKE2b-256 f6efe30d47388fe532a5a9edea74ba06373c51a4b73e5bda144bcc86f8724ea3

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp39-cp39-manylinux_2_24_x86_64.whl
  • Upload date:
  • Size: 16.3 MB
  • Tags: CPython 3.9, manylinux: glibc 2.24+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 754fbd4b8fe0f6b40458a882a746897cf1b2bc9fe0bcad00eebf23ad8c21cbd3
MD5 5fb5847149df0a1763ac216fee91ab12
BLAKE2b-256 9fb88b678d0048a79a90858f2cb19f4dc3c87a937e4023286f825ad1c59dad79

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mlprodict-0.7.1625-cp39-cp39-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 798ce337fc0e7704e6f8df6f7695d3a8aae0b05b691066871c59684954d474bb
MD5 8ddf09e9b2ae1ba354fee9a67beb06a6
BLAKE2b-256 d679d28a1fa5d9df9ce2ea20ed8e4a7091056a0be6fe163042b5c513f2cacc43

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp39-cp39-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.9, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 4b21c106e3e582a44a438f8a815dad9591ed8211396a865b8177c3a3d068a8ba
MD5 c19ff835ebaaca4a929be0e0c72561d2
BLAKE2b-256 003cf1ef843aee1b81d2890fd310eab35f402c867b26298beb5657c2a29c0218

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp38-cp38-win_amd64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp38-cp38-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.8, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp38-cp38-win_amd64.whl
Algorithm Hash digest
SHA256 714438faa4aa9f4fb1e68a5bf6892aff68ed58ea8dedb22989e53c6f54924d88
MD5 69ae7b159d1c7531834fb5fe952d1477
BLAKE2b-256 b12c98c5e2b481c4ab9a0652e34818cc496d8ce86b957dff36653faa52cd6d50

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mlprodict-0.7.1625-cp38-cp38-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 d58564b2ebbc4979ea1fcce33657635755dcac7e5fb076b3c3ac652dda3279d1
MD5 bdae76bb0be0aa752c9f6544e1153662
BLAKE2b-256 b0a913f4a7165c415125a2ec2303fa34b4f26972590a588c95af4ffe559f9be7

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp37-cp37m-win_amd64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp37-cp37m-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.7m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp37-cp37m-win_amd64.whl
Algorithm Hash digest
SHA256 54e9d12a6d6b757c0256c905d53d3b5eae10ec666257fa60da3b48611e3863f1
MD5 101313479f5f9cc246027d9f8392bf24
BLAKE2b-256 2912096166387cb7b8707d0682f0f92745c86cc42cce87a73f4f138c4ef333c3

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mlprodict-0.7.1625-cp37-cp37m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 55d443a6d6d227ba9d9085feffbdbb7cf4e325ba9a43ea9f8ff57eb34d832231
MD5 6bfe34ec975000140a8b660e4ea106c2
BLAKE2b-256 33c702e18b9f7079b1ef8556c12102b18c606801f11daac0c8b9a57f63fbb11e

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp37-cp37m-macosx_10_9_x86_64.whl
  • Upload date:
  • Size: 2.9 MB
  • Tags: CPython 3.7m, macOS 10.9+ x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 8bcc45de4dc10f9be06498e59c04c0e3801863a8d9f6d63c6106b8fe90b3d723
MD5 2295a1604e1601d6391cb317f57dd0c4
BLAKE2b-256 b6572d151582e7341831a03c8c4a6b7423efe9830d65777f0193d2303e6224fa

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp36-cp36m-win_amd64.whl.

File metadata

  • Download URL: mlprodict-0.7.1625-cp36-cp36m-win_amd64.whl
  • Upload date:
  • Size: 2.0 MB
  • Tags: CPython 3.6m, Windows x86-64
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.6.1 pkginfo/1.7.1 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.61.1 CPython/3.9.5

File hashes

Hashes for mlprodict-0.7.1625-cp36-cp36m-win_amd64.whl
Algorithm Hash digest
SHA256 a2afe2b1edd4560ee8b50ef3a257ee3e0bae5b564989e658f79ca17946fef8d1
MD5 a61c36493e4ee98f1773899970aacc2f
BLAKE2b-256 28de9ddb567ae0ac1870905f266bbca0737cc563b0ad0f1b461d9c2f9c4159c8

See more details on using hashes here.

File details

Details for the file mlprodict-0.7.1625-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for mlprodict-0.7.1625-cp36-cp36m-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 ddf02042d950dfd14207ad90fac19f50342f3ef5ed3f79470477a892c2426950
MD5 6ab78353f13aa861c5d096f4ff3732fe
BLAKE2b-256 4804be4e0cb2cb7f5b0a91026d3851e638c3e58101c98fb5b3040edcccf36205

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page