{"id":31784931,"url":"https://github.com/finite-sample/stable-cart","last_synced_at":"2025-10-10T11:25:58.057Z","repository":{"id":316310349,"uuid":"1054488176","full_name":"finite-sample/stable-cart","owner":"finite-sample","description":null,"archived":false,"fork":false,"pushed_at":"2025-09-23T20:34:11.000Z","size":22,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-23T22:21:56.141Z","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":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/finite-sample.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"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":"2025-09-10T23:15:29.000Z","updated_at":"2025-09-23T20:34:12.000Z","dependencies_parsed_at":"2025-09-23T22:21:58.827Z","dependency_job_id":"f93deed6-88de-42db-8334-d41e7b14e4ab","html_url":"https://github.com/finite-sample/stable-cart","commit_stats":null,"previous_names":["finite-sample/stable-cart"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/finite-sample/stable-cart","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finite-sample%2Fstable-cart","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finite-sample%2Fstable-cart/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finite-sample%2Fstable-cart/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finite-sample%2Fstable-cart/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/finite-sample","download_url":"https://codeload.github.com/finite-sample/stable-cart/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/finite-sample%2Fstable-cart/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279003712,"owners_count":26083610,"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","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":"2025-10-10T11:25:57.010Z","updated_at":"2025-10-10T11:25:58.051Z","avatar_url":"https://github.com/finite-sample.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# stable-cart\n\n\nAn experimental decision tree regressor that focuses on stability while\nmaintaining the familiar scikit-learn API.\n\n## Installation\n\nClone the repository and install dependencies:\n\n```bash\ngit clone https://github.com/your-username/stable-cart.git\ncd stable-cart\npip install -e .\n```\n\nOr install directly with pip (once published to PyPI):\n\n```bash\npip install stable-cart\n```\n\n## Usage\n\n### Training a stable CART\n\n```python\nfrom stable_cart.less_greedy_tree import LessGreedyTreeClassifier\n\n# Example dataset\nX = [[0, 0], [1, 1], [1, 0], [0, 1]]\ny = [0, 1, 1, 0]\n\n# Train a more stable decision tree\ntree = LessGreedyTreeClassifier(max_depth=3)\ntree.fit(X, y)\n\n# Predict\nprint(tree.predict([[1, 0], [0, 0]]))\n```\n\n### Evaluation\n\nThe package includes evaluation utilities for comparing model stability across different runs.\n\n```python\nfrom stable_cart import evaluation\nfrom sklearn.tree import DecisionTreeClassifier\n\n# Example: evaluate stability of sklearn CART vs. LessGreedyTree\nevaluation.compare_models(\n    models=[DecisionTreeClassifier(), LessGreedyTreeClassifier()],\n    X=X,\n    y=y,\n    n_trials=10\n)\n```\n\nThis produces accuracy, stability, and agreement metrics across multiple random seeds.\n\n## Modules\n\n- **`less_greedy_tree.py`**\n  Implements the `LessGreedyTreeClassifier`, a variant of CART with modified split selection to reduce variance and improve stability.\n\n- **`evaluation.py`**\n  Functions to test and compare models across seeds, reporting accuracy, stability, and cross-run consistency.\n\n- **`__init__.py`**\n  Exposes package-level imports for easy access.\n\n## Motivation\n\nStandard decision trees (CART) are **unstable**: small changes in the training data can result in very different tree structures. While ensembles like random forests address this with bagging, **stable CART** focuses on modifying the tree induction process itself to produce **more consistent models** without sacrificing interpretability.\n\n## Roadmap\n\n- [ ] Add regression tree support\n- [ ] Publish package to PyPI\n- [ ] Add visualization utilities for comparing stable vs. standard trees\n\n\n## Documentation\n\nThe project documentation is authored with [Sphinx](https://www.sphinx-doc.org)\nand is automatically published to GitHub Pages whenever changes are pushed\nto the `main` branch. To build the docs locally run:\n\n```bash\npython -m pip install -r docs/requirements.txt\nsphinx-build -b html docs docs/_build/html\n```\n\nThe rendered site will be available from the generated\n`docs/_build/html/index.html` file.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinite-sample%2Fstable-cart","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffinite-sample%2Fstable-cart","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffinite-sample%2Fstable-cart/lists"}