{"id":15158075,"url":"https://github.com/sdpython/mlprodict","last_synced_at":"2025-12-13T22:56:02.905Z","repository":{"id":37080438,"uuid":"112469804","full_name":"sdpython/mlprodict","owner":"sdpython","description":"Productionize machine learning predictions, with ONNX or without","archived":true,"fork":false,"pushed_at":"2024-01-11T19:19:46.000Z","size":23053,"stargazers_count":66,"open_issues_count":19,"forks_count":13,"subscribers_count":9,"default_branch":"master","last_synced_at":"2025-01-15T17:22:09.995Z","etag":null,"topics":["machine-learning","onnx","python3","scikit-learn"],"latest_commit_sha":null,"homepage":"http://www.xavierdupre.fr/app/mlprodict/helpsphinx/index.html","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/sdpython.png","metadata":{"files":{"readme":"README.rst","changelog":"HISTORY.rst","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-11-29T11:57:10.000Z","updated_at":"2024-08-17T14:03:33.000Z","dependencies_parsed_at":"2024-06-19T00:24:05.210Z","dependency_job_id":null,"html_url":"https://github.com/sdpython/mlprodict","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdpython%2Fmlprodict","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdpython%2Fmlprodict/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdpython%2Fmlprodict/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/sdpython%2Fmlprodict/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/sdpython","download_url":"https://codeload.github.com/sdpython/mlprodict/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234712899,"owners_count":18875527,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["machine-learning","onnx","python3","scikit-learn"],"created_at":"2024-09-26T20:22:55.330Z","updated_at":"2025-09-30T07:31:06.966Z","avatar_url":"https://github.com/sdpython.png","language":"Python","readme":"\n.. image:: https://github.com/sdpython/mlprodict/blob/master/_doc/sphinxdoc/source/_static/project_ico.png?raw=true\n    :target: https://github.com/sdpython/mlprodict/\n\n.. _l-README:\n\nmlprodict\n=========\n\n.. image:: https://travis-ci.com/sdpython/mlprodict.svg?branch=master\n    :target: https://app.travis-ci.com/github/sdpython/mlprodict/\n    :alt: Build status\n\n.. image:: https://ci.appveyor.com/api/projects/status/g8chk1ufyk1m8uep?svg=true\n    :target: https://ci.appveyor.com/project/sdpython/mlprodict\n    :alt: Build Status Windows\n\n.. image:: https://circleci.com/gh/sdpython/mlprodict/tree/master.svg?style=svg\n    :target: https://circleci.com/gh/sdpython/mlprodict/tree/master\n\n.. image:: https://dev.azure.com/xavierdupre3/mlprodict/_apis/build/status/sdpython.mlprodict\n    :target: https://dev.azure.com/xavierdupre3/mlprodict/\n\n.. image:: https://badge.fury.io/py/mlprodict.svg\n    :target: https://pypi.org/project/mlprodict/\n\n.. image:: https://img.shields.io/badge/license-MIT-blue.svg\n    :alt: MIT License\n    :target: http://opensource.org/licenses/MIT\n\n.. image:: https://codecov.io/github/sdpython/mlprodict/coverage.svg?branch=master\n    :target: https://codecov.io/github/sdpython/mlprodict?branch=master\n\n.. image:: http://img.shields.io/github/issues/sdpython/mlprodict.png\n    :alt: GitHub Issues\n    :target: https://github.com/sdpython/mlprodict/issues\n\n.. image:: http://www.xavierdupre.fr/app/mlprodict/helpsphinx/_images/nbcov.png\n    :target: http://www.xavierdupre.fr/app/mlprodict/helpsphinx/all_notebooks_coverage.html\n    :alt: Notebook Coverage\n\n.. image:: https://pepy.tech/badge/mlprodict/month\n    :target: https://pepy.tech/project/mlprodict/month\n    :alt: Downloads\n\n.. image:: https://img.shields.io/github/forks/sdpython/mlprodict.svg\n    :target: https://github.com/sdpython/mlprodict/\n    :alt: Forks\n\n.. image:: https://img.shields.io/github/stars/sdpython/mlprodict.svg\n    :target: https://github.com/sdpython/mlprodict/\n    :alt: Stars\n\n.. image:: https://mybinder.org/badge_logo.svg\n    :target: https://mybinder.org/v2/gh/sdpython/mlprodict/master?filepath=_doc%2Fnotebooks\n\n.. image:: https://img.shields.io/github/repo-size/sdpython/mlprodict\n    :target: https://github.com/sdpython/mlprodict/\n    :alt: size\n\n*mlprodict* was initially started to help implementing converters\nto *ONNX*. The main features is a python runtime for\n*ONNX* (class `OnnxInference\n\u003chttp://www.xavierdupre.fr/app/mlprodict/helpsphinx/mlprodict/onnxrt/onnx_inference.html\u003e`_),\nvisualization tools\n(see `Visualization\n\u003chttp://www.xavierdupre.fr/app/mlprodict/helpsphinx/api/tools.html#visualization\u003e`_),\nand a `numpy API for ONNX\n\u003chttp://www.xavierdupre.fr/app/mlprodict/helpsphinx/tutorial/numpy_api_onnx.html\u003e`_).\nThe package also provides tools to compare\npredictions, to benchmark models converted with\n`sklearn-onnx \u003chttps://github.com/onnx/sklearn-onnx/tree/master/skl2onnx\u003e`_.\n\n::\n\n    import numpy\n    from sklearn.linear_model import LinearRegression\n    from sklearn.datasets import load_iris\n    from mlprodict.onnxrt import OnnxInference\n    from mlprodict.onnxrt.validate.validate_difference import measure_relative_difference\n    from mlprodict import __max_supported_opset__, get_ir_version\n\n    iris = load_iris()\n    X = iris.data[:, :2]\n    y = iris.target\n    lr = LinearRegression()\n    lr.fit(X, y)\n\n    # Predictions with scikit-learn.\n    expected = lr.predict(X[:5])\n    print(expected)\n\n    # Conversion into ONNX.\n    from mlprodict.onnx_conv import to_onnx\n    model_onnx = to_onnx(lr, X.astype(numpy.float32),\n                         black_op={'LinearRegressor'},\n                         target_opset=__max_supported_opset__)\n    print(\"ONNX:\", str(model_onnx)[:200] + \"\\n...\")\n\n    # Predictions with onnxruntime\n    model_onnx.ir_version = get_ir_version(__max_supported_opset__)\n    oinf = OnnxInference(model_onnx, runtime='onnxruntime1')\n    ypred = oinf.run({'X': X[:5].astype(numpy.float32)})\n    print(\"ONNX output:\", ypred)\n\n    # Measuring the maximum difference.\n    print(\"max abs diff:\", measure_relative_difference(expected, ypred['variable']))\n\n    # And the python runtime\n    oinf = OnnxInference(model_onnx, runtime='python')\n    ypred = oinf.run({'X': X[:5].astype(numpy.float32)},\n                     verbose=1, fLOG=print)\n    print(\"ONNX output:\", ypred)\n\n**Installation**\n\nInstallation from *pip* should work unless you need the latest\ndevelopment features.\n\n::\n\n    pip install mlprodict\n\nThe package includes a runtime for *ONNX*. That's why there\nis a limited number of dependencies. However, some features\nrelies on *sklearn-onnx*, *onnxruntime*, *scikit-learn*.\nThey can be installed with the following instructions:\n\n::\n\n    pip install mlprodict[all]\n\nThe code is available at\n`GitHub/mlprodict \u003chttps://github.com/sdpython/mlprodict/\u003e`_\nand has `online documentation \u003chttp://www.xavierdupre.fr/app/\nmlprodict/helpsphinx/index.html\u003e`_.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdpython%2Fmlprodict","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsdpython%2Fmlprodict","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsdpython%2Fmlprodict/lists"}