{"id":19505273,"url":"https://github.com/interpretml/ebm2onnx","last_synced_at":"2025-04-26T00:33:49.845Z","repository":{"id":47345555,"uuid":"349067583","full_name":"interpretml/ebm2onnx","owner":"interpretml","description":"A tool to convert EBM models to ONNX","archived":false,"fork":false,"pushed_at":"2024-11-05T17:10:42.000Z","size":560,"stargazers_count":21,"open_issues_count":1,"forks_count":5,"subscribers_count":5,"default_branch":"master","last_synced_at":"2024-11-24T19:30:02.669Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"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/interpretml.png","metadata":{"files":{"readme":"README.rst","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":"GOVERNANCE.md","roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-03-18T12:36:21.000Z","updated_at":"2024-11-05T17:06:07.000Z","dependencies_parsed_at":"2024-07-25T16:23:04.788Z","dependency_job_id":null,"html_url":"https://github.com/interpretml/ebm2onnx","commit_stats":null,"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interpretml%2Febm2onnx","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interpretml%2Febm2onnx/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interpretml%2Febm2onnx/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/interpretml%2Febm2onnx/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/interpretml","download_url":"https://codeload.github.com/interpretml/ebm2onnx/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250917283,"owners_count":21507561,"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":[],"created_at":"2024-11-10T22:29:26.787Z","updated_at":"2025-04-26T00:33:49.242Z","avatar_url":"https://github.com/interpretml.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"========\nEbm2onnx\n========\n\n\n.. image:: https://img.shields.io/pypi/v/ebm2onnx.svg\n        :target: https://pypi.python.org/pypi/ebm2onnx\n\n.. image:: https://github.com/interpretml/ebm2onnx/actions/workflows/ci.yml/badge.svg\n    :target: https://github.com/interpretml/ebm2onnx/actions/workflows/ci.yml\n    :alt: CI\n\n.. image:: https://coveralls.io/repos/github/interpretml/ebm2onnx/badge.svg?branch=master\n    :target: https://coveralls.io/github/interpretml/ebm2onnx?branch=master\n    :alt: Code Coverage\n\n.. image:: https://readthedocs.org/projects/ebm2onnx/badge/?version=latest\n    :target: https://ebm2onnx.readthedocs.io/en/latest/?version=latest\n    :alt: Documentation Status\n\n.. image:: https://mybinder.org/badge_logo.svg\n    :target: https://mybinder.org/v2/gh/interpretml/ebm2onnx/master?filepath=examples%2Fconvert.ipynb\n\n\nEbm2onnx converts `EBM \u003chttps://github.com/interpretml/interpret\u003e`_ models to\nONNX. It allows to run an EBM model on any ONNX compliant runtime.\n\n\nFeatures\n--------\n\n* Binary classification\n* Regression\n* Continuous, nominal, and ordinal variables\n* N-way interactions\n* Multi-class classification (support is still experimental in EBM)\n* Expose predictions probabilities\n* Expose local explanations\n* Export a model as part of a scikit-learn pipeline (experimental)\n\nThe export of the models is tested against `ONNX Runtime \u003chttps://github.com/Microsoft/onnxruntime\u003e`_. \n\nGet Started\n------------\n\nTrain an EBM model:\n\n.. code:: python\n\n    # prepare dataset\n    df = pd.read_csv('titanic_train.csv')\n    df = df.dropna()\n\n    feature_columns = ['Age', 'Fare', 'Pclass', 'Embarked']\n    label_column = \"Survived\"\n    y = df[[label_column]]\n    le = LabelEncoder()\n    y_enc = le.fit_transform(y)\n    x = df[feature_columns]\n    x_train, x_test, y_train, y_test = train_test_split(x, y_enc)\n\n    # train an EBM model\n    model = ExplainableBoostingClassifier(\n        feature_types=['continuous', 'continuous', 'continuous', 'nominal'],\n    )\n    model.fit(x_train, y_train)\n\n\nThen you can convert it to ONNX in a single function call:\n\n.. code:: python\n\n    import onnx\n    import ebm2onnx\n\n    onnx_model = ebm2onnx.to_onnx(\n        model,\n        ebm2onnx.get_dtype_from_pandas(x_train),\n    )\n    onnx.save_model(onnx_model, 'ebm_model.onnx')\n\n\nIf your dataset is not a pandas dataframe, you can provide the features' types\ndirectly:\n\n.. code:: python\n\n    import ebm2onnx\n\n    onnx_model = ebm2onnx.to_onnx(\n        model,\n        dtype={\n            'Age': 'double',\n            'Fare': 'double',\n            'Pclass': 'int',\n            'Embarked': 'str',\n        }\n    )\n    onnx.save_model(onnx_model, 'ebm_model.onnx')\n\n\nTry it live\n-------------\n\n- You can live test the `model conversion \u003chttps://mybinder.org/v2/gh/interpretml/ebm2onnx/master?filepath=examples%2Fconvert.ipynb\u003e`_.\n- You can live test `local explanations \u003chttps://mybinder.org/v2/gh/interpretml/ebm2onnx/master?filepath=examples%2Fexplain_local.ipynb\u003e`_.\n- You can live test the export of a `scikit-learn pipeline \u003chttps://mybinder.org/v2/gh/interpretml/ebm2onnx/master?filepath=examples%2Fsklearn-pipeline.ipynb\u003e`_.\n\n\nSupporting organizations\n-------------------------\n\nThe following organizations are supporting Ebm2onnx:\n\n- `SoftAtHome \u003chttps://www.softathome.com\u003e`_: Main supporter of Ebm2onnx development.\n- `InterpretML \u003chttps://interpret.ml\u003e`_: Ebm2onnx is hosted under the umbrella of the InterpretML organization.\n\n|img_sah| |img_interpret|\n\n.. |img_sah| image:: https://raw.githubusercontent.com/interpretml/ebm2onnx/master/assets/sah_logo.png\n    :target: https://www.softathome.com\n\n.. |img_interpret| image:: https://raw.githubusercontent.com/interpretml/ebm2onnx/master/assets/interpretml-logo.png\n    :target: https://interpret.ml\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterpretml%2Febm2onnx","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Finterpretml%2Febm2onnx","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Finterpretml%2Febm2onnx/lists"}