{"id":38945256,"url":"https://github.com/eminyous/fipe","last_synced_at":"2026-03-04T05:11:16.278Z","repository":{"id":255272057,"uuid":"849060134","full_name":"eminyous/fipe","owner":"eminyous","description":null,"archived":false,"fork":false,"pushed_at":"2025-01-21T02:30:55.000Z","size":498,"stargazers_count":3,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"main","last_synced_at":"2026-01-26T06:09:15.491Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/2408.16167","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/eminyous.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-08-28T22:49:15.000Z","updated_at":"2025-02-22T03:04:05.000Z","dependencies_parsed_at":null,"dependency_job_id":"8a7a92b9-706a-4d4a-937d-0f704d7b47fd","html_url":"https://github.com/eminyous/fipe","commit_stats":null,"previous_names":["eminyous/fipe"],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/eminyous/fipe","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminyous%2Ffipe","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminyous%2Ffipe/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminyous%2Ffipe/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminyous%2Ffipe/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/eminyous","download_url":"https://codeload.github.com/eminyous/fipe/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/eminyous%2Ffipe/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30071938,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-04T03:25:38.285Z","status":"ssl_error","status_checked_at":"2026-03-04T03:25:05.086Z","response_time":59,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":"2026-01-17T16:00:28.839Z","updated_at":"2026-03-04T05:11:16.240Z","avatar_url":"https://github.com/eminyous.png","language":"Python","readme":"# FIPE: Functionally Identical Pruning of Ensembles\n\n[![PyPI](https://img.shields.io/pypi/v/fipepy\n)](https://pypi.org/project/fipepy/)\n[![Supported Python\nversions](https://img.shields.io/pypi/pyversions/fipepy.svg)](https://pypi.org/project/fipepy/)\n![test](https://github.com/eminyous/fipe/actions/workflows/main.yml/badge.svg)\n\nThis repository provides methods for Functionally-Identical Pruning of Tree Ensembles (FIPE). Given a trained scikit-learn model, FIPE provides a pruned model that is certified to be equivalent to the original model on the entire feature space. The algorithm is described in detail in the paper: \u003chttps://arxiv.org/abs/2408.16167\u003e .\n\n## Installation\n\nThis project requires the gurobi solver. Free academic licenses are available. Please consult:\n\n- [Gurobi academic program and licenses](https://www.gurobi.com/academia/academic-program-and-licenses/)\n- [Gurobi academic license agreement](https://www.gurobi.com/downloads/end-user-license-agreement-academic/)\n\nRun the following commands from the project root to install the requirements. You may have to install python and venv before.\n\n```shell\nvirtualenv -p python3.12 env\npip install fipepy\n```\n\nThe installation can be checked by running the test suite:\n\n```shell\npip install tox\ntox\n```\n\nThe integration tests require a working Gurobi license. If a license is not available, the tests will pass and print a warning.\n\n### Getting started\n\nA minimal working example to prune an AdaBoost ensemble is presented below.\n\n```python\nimport gurobipy as gp\nimport numpy as np\nimport pandas as pd\nfrom sklearn.datasets import load_iris\nfrom sklearn.ensemble import AdaBoostClassifier\nfrom sklearn.model_selection import train_test_split\n\nfrom fipe import FIPE, FeatureEncoder\n\n# Load data encode features\ndata = load_iris(as_frame=True)\nX = pd.DataFrame(data.data)\ny = data.target\n\nencoder = FeatureEncoder(X)\nX = encoder.X.to_numpy()\n\n# Train tree ensemble\nX_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.2, random_state=42)\nbase = AdaBoostClassifier(n_estimators=100, random_state=42)\nbase.fit(X, y)\n\n# Read and normalize weights\nw = base.estimator_weights_\nw = (w / w.max()) * 1e5\n\n# Prune using FIPE\nnorm = 1\nprint(f\"Pruning model by minimizing l_{norm} norm.\")\nenv = gp.Env()\nenv.setParam(\"OutputFlag\", 0)\npruner = FIPE(\n    base=base,\n    encoder=encoder,\n    weights=w,\n    norm=norm,\n    env=env,\n    eps=1e-6,\n    tol=1e-4,\n)\nprint(\"Building pruner...\")\npruner.build()\npruner.add_samples(X_train)\nprint(\"Pruning...\")\npruner.prune()\nprint(\"Finished pruning.\")\n\n# Read pruned model\nn_active_estimators = pruner.n_active_estimators\nprint(\n    f\"The pruned ensemble has {n_active_estimators}\"\n    f\"/{base.n_estimators} active estimators.\"\n)\n\n# Verify functionally-identical on test data\ny_pred = base.predict(X_test)\ny_pruned = pruner.predict(X_test)\nfidelity = np.mean(y_pred == y_pruned)\nprint(f\"Fidelity to initial ensemble is {fidelity * 100:.2f}%.\")\n```\n","funding_links":[],"categories":["2025"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminyous%2Ffipe","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Feminyous%2Ffipe","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Feminyous%2Ffipe/lists"}