{"id":17293388,"url":"https://github.com/xuyxu/soft-decision-tree","last_synced_at":"2025-04-14T11:07:29.206Z","repository":{"id":39911764,"uuid":"153288483","full_name":"xuyxu/Soft-Decision-Tree","owner":"xuyxu","description":"PyTorch Implementation of \"Distilling a Neural Network Into a Soft Decision Tree.\" Nicholas Frosst, Geoffrey Hinton., 2017. ","archived":false,"fork":false,"pushed_at":"2024-02-22T06:24:56.000Z","size":578,"stargazers_count":100,"open_issues_count":3,"forks_count":19,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-14T11:07:08.420Z","etag":null,"topics":["classification-trees","decision-tree","deep-learning","pytorch","tree"],"latest_commit_sha":null,"homepage":"https://arxiv.org/abs/1711.09784","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/xuyxu.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}},"created_at":"2018-10-16T13:17:50.000Z","updated_at":"2025-04-13T20:30:46.000Z","dependencies_parsed_at":"2024-11-08T04:00:54.031Z","dependency_job_id":"8e6a131c-2e36-40d0-b925-4ef31e524f3a","html_url":"https://github.com/xuyxu/Soft-Decision-Tree","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyxu%2FSoft-Decision-Tree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyxu%2FSoft-Decision-Tree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyxu%2FSoft-Decision-Tree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/xuyxu%2FSoft-Decision-Tree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/xuyxu","download_url":"https://codeload.github.com/xuyxu/Soft-Decision-Tree/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248868768,"owners_count":21174758,"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":["classification-trees","decision-tree","deep-learning","pytorch","tree"],"created_at":"2024-10-15T10:48:00.534Z","updated_at":"2025-04-14T11:07:29.181Z","avatar_url":"https://github.com/xuyxu.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Introduction \nThis is the pytorch implementation on Soft Decision Tree (SDT), appearing in the paper \"Distilling a Neural Network Into a Soft Decision Tree\". 2017 (https://arxiv.org/abs/1711.09784).\n\n## Quick Start \nTo run the demo on MNIST, simply use the following commands:\n```\ngit clone https://github.com/AaronX121/Soft-Decision-Tree.git\ncd Soft-Decision-Tree\npython main.py\n``` \n\n## Parameters\n\n| Parameter | Type | Description |\n|-----------|------|-------------|\n| input_dim | int  | The number of input dimensions |\n| output_dim | int| The number of output dimensions (e.g., the number of classes for multi-class classification) |\n| depth | int| Tree depth, the default is `5` |\n| lamda | float | The coefficient of the regularization term, the default is `1e-3` |\n| use_cuda | bool | Whether use GPU to train / evaluate the model, the default is `False` |\n\n## Frequently Asked Questions\n* **Training loss suddenly turns into NAN**\n    * **Reason:** Sigmoid function used in internal nodes of SDT can be unstable during the training stage, as its gradient is much close to `0` when the absolute value of input is large.\n    * **Solution:** Using a smaller learning rate typically works.\n* **Exact training time**\n    * **Setup:** MNIST Dataset | Tree Depth: 5 | Epoch: 40 | Batch Size: 128\n    * **Results:** Around 15 minutes on a single RTX-2080ti\n\n## Experiment Result on MNIST\nAfter training for 40 epochs with `batch_size` 128, the best testing accuracy using a SDT model of depth **5**, **7** are **94.15** and **94.38**, respectively (which is much close to the accuracy reported in raw paper). Related hyper-parameters are available in `main.py`. Better and more stable performance can be achieved by fine-tuning hyper-parameters. \n\nBelow are the testing accuracy curve and training loss curve. The testing accuracy of SDT is evaluated after each training epoch. \n\n![MNIST Experiment Result](./mnist_exp.png)\n\n## Package Dependencies\nSDT is originally developed in `Python 3.6.5`. Following are the name and version of packages used in SDT. In my practice, it works fine under different versions of Python or PyTorch.\n\n - pytorch 0.4.1\n - torchvision 0.2.1\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuyxu%2Fsoft-decision-tree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fxuyxu%2Fsoft-decision-tree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fxuyxu%2Fsoft-decision-tree/lists"}