{"id":25441943,"url":"https://github.com/jokoum/stochastic-gradient-trees-python","last_synced_at":"2025-08-17T21:34:53.598Z","repository":{"id":42531393,"uuid":"418636896","full_name":"JoKoum/stochastic-gradient-trees-python","owner":"JoKoum","description":"Stochastic Gradient Trees implementation in Python","archived":false,"fork":false,"pushed_at":"2022-11-18T18:15:28.000Z","size":87,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-21T22:39:39.358Z","etag":null,"topics":["classification-algorithm","machine-learning","python","regression-algorithms","scikit-learn","sklearn","stochastic-gradient","tree-algorithms","tree-classifiers","tree-regressor"],"latest_commit_sha":null,"homepage":"https://pypi.org/project/pysgt/","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/JoKoum.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-10-18T19:15:20.000Z","updated_at":"2022-11-18T18:17:37.000Z","dependencies_parsed_at":"2023-01-21T11:31:54.495Z","dependency_job_id":null,"html_url":"https://github.com/JoKoum/stochastic-gradient-trees-python","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JoKoum/stochastic-gradient-trees-python","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoKoum%2Fstochastic-gradient-trees-python","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoKoum%2Fstochastic-gradient-trees-python/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoKoum%2Fstochastic-gradient-trees-python/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoKoum%2Fstochastic-gradient-trees-python/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JoKoum","download_url":"https://codeload.github.com/JoKoum/stochastic-gradient-trees-python/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JoKoum%2Fstochastic-gradient-trees-python/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270912487,"owners_count":24666737,"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-08-17T02:00:09.016Z","response_time":129,"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":["classification-algorithm","machine-learning","python","regression-algorithms","scikit-learn","sklearn","stochastic-gradient","tree-algorithms","tree-classifiers","tree-regressor"],"created_at":"2025-02-17T13:16:05.387Z","updated_at":"2025-08-17T21:34:53.575Z","avatar_url":"https://github.com/JoKoum.png","language":"Python","readme":"Stochastic Gradient Trees - Python\n=========================\n\n[Stochastic Gradient Trees](https://arxiv.org/abs/1901.07777)[^1] by Henry Gouk, Bernhard Pfahringer, and Eibe Frank implementation in Python. Based on the [parer's accompanied repository](https://github.com/henrygouk/stochastic-gradient-trees) code.\n\n### Python Version 3.7 or later\n\n### Used Python libraries:\n* numpy\u003e=1.20.2\n* scipy\u003e=1.6.2\n* pandas\u003e=1.3.3\n* scikit-learn\u003e=0.24.2\n\n### Usage:\n\n```python\n    from pysgt.StochasticGradientTree import StochasticGradientTreeClassifier\n\n    from sklearn.model_selection import train_test_split\n    from sklearn.datasets import load_breast_cancer\n    from sklearn.metrics import confusion_matrix, accuracy_score, log_loss\n\n    def train(X, y):\n\n        X_train, X_test, y_train, y_test = train_test_split(X, y, test_size=0.34)\n        \n        tree = StochasticGradientTreeClassifier()\n\n        tree.fit(X_train, y_train)\n    \n        y_pred = tree.predict(X_test)\n\n        proba = tree.predict_proba(X_test)        \n\n        acc_test = accuracy_score(y_test, y_pred)\n        print(confusion_matrix(y_test, y_pred))\n        print('Acc test: ', acc_test)\n        print('Cross entropy loss: ', log_loss(y_test, proba))\n\n        return tree, acc_test\n\n    if __name__ == \"__main__\":\n\n        breast = load_breast_cancer(as_frame=True)\n\n        X = breast.frame.copy()\n        y = breast.frame.target\n        \n        X.drop(['target'], axis=1, inplace=True) \n\n        tree, _ = train(X, y)\n\n```\n\n### Binary classification example:\n\n    python classification_breast.py\n\n### Multiclass classification (using the [One-vs-the-rest](https://scikit-learn.org/stable/modules/generated/sklearn.multiclass.OneVsRestClassifier.html) multiclass strategy):\n\n    python classification_iris.py\n\n### Regression example:\n\n    python regression_diabetes.py\n\n[^1]: Gouk, H., Pfahringer, B., and Frank, E. Stochastic gradient trees. In Proceedings of The Eleventh Asian Conference on Machine Learning, volume 101 of Proceedings of Machine Learning Research, pp. 1094–1109. PMLR, 2019.","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokoum%2Fstochastic-gradient-trees-python","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjokoum%2Fstochastic-gradient-trees-python","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjokoum%2Fstochastic-gradient-trees-python/lists"}