An implementation of NODE - the core contribution is a differentiable oblivious decision tree using soft decision boundaries:
Create a Python 3 virtual environment and activate:
virtualenv -p python3 env
source ./env/bin/activate
Install requirements by running:
pip install -r requirements.txt
Then export project to python path:
export PYTHONPATH=$PATH_TO_REPO/node
To test the scripts, run pytest
in the root directory, you may wish to
install pytest
separately
Below is an example of a binary classifier implemented with 3 layers of decision trees ensemble, each of depth 5 with 100 estimators.
import tensorflow as tf
from node.networks.model import NODE
model = NODE(n_layers=3,
n_trees=100,
tree_depth=5,
units=2,
link=tf.keras.activations.softmax)
x = tf.keras.Input(shape=10)
y = model(x)
print(y.shape)
# (None, 2)