Home

Awesome

Neural-Decision-Forests

An implementation of the Deep Neural Decision Forests(dNDF) in PyTorch.

Features

Datasets

MNIST, UCI_Adult, UCI_Letter and UCI_Yeast datasets are available. For datasets other than MNIST, you need to go to corresponding directory and run the get_data.sh script.

Requirements

Usage

python train.py --ARG=VALUE

in the case of training the sNDF on MNIST with alternating optimization, the command is like

python train.py -dataset mnist -n_class 10 -gpuid 0 -n_tree 80 -tree_depth 10 -batch_size 1000 -epochs 100

Results

Not spending much time on picking hyperparameters and without bells and whistles, I got the accuracy results(obtained by training $\pi$ and $\Theta$ seperately) as follows:

DatasetsNDFdNDF
MNIST0.97940.9963
UCI_Adult0.8558NA
UCI_Letter0.9507NA
UCI_Yeast0.6031NA

By adding the nonlinearity in the routing function, the accuraries can reach 0.6502 and 0.9753 respectively on the UCI_Yeast and UCI_Letter.

Note

Some people may experience the 'loss is NaN' situation which could be caused by the output probability being zero. Please make sure you have normalized your data and used a large enough tree size and depth. In the case that you want to stick with your tree setting, a workaround could be to clamp the output value.