Giter Site home page Giter Site logo

zeta1999 / soft-decision-tree Goto Github PK

View Code? Open in Web Editor NEW

This project forked from xuyxu/soft-decision-tree

0.0 0.0 0.0 98 KB

Distilling a Neural Network Into a Soft Decision Tree., Nicholas Frosst, Geoffrey Hinton., 2017.

Home Page: https://arxiv.org/abs/1711.09784

Python 100.00%

soft-decision-tree's Introduction

Introduction

This 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).

Quick Start

Here I offer one demo on MNIST. To run the demo, simply type the following command:

python main.py 

Introduction

Please see main.py for details on how to use SDT. For personal use, one need to change following variables:

  • use_cuda: Actually, using CPU can be faster because you know......it's a tree
  • learner_args: Parameters on SDT model, optimizer, etc.
  • data_dir, train_loader, test_loader

Furthermore, main arguments in learner_args are:

  • depth: tree depth (root node is with depth 0)
  • lamda: regularization coefficient defined in equation (5) from raw paper, which decayes exponentially with the depth
  • lr, weight_decay: learning rate, weight decay in optimizer

If you are interested in implementations on SDT, please see SDT.py for details. Instead of formally defining the structure of inner node and leaf node, I directly use one linear layer with sigmoid activation to simulate all inner nodes, for the sake of acceleration.

MNIST Experiment Result

After training for 40 epochs with batch_size 128, the best testing accuracy using one SDT of depth 5, 7 are 94.15 and 94.38, separately (which is much close to the accuracy reported in raw paper). Related hyper-parameters are available in learner_args.

Better and more stable performance can be achieved by fine-tuning hyper-parameters. Below are the testing accuracy curve and training loss curve:

MNIST Experiment Result

Package Dependencies

SDT is developed in python 3.6.5. Following are the name and version of packages used in SDT:

  • pytorch 0.4.1
  • torchvision 0.2.1

soft-decision-tree's People

Contributors

xuyxu avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.