sgtlearn

sgtlearn is a Python package for learning Shape Generalized Trees (SGTs) — a class of decision trees where each internal node applies a learnable, axis-aligned shape function to a feature, producing non-linear yet interpretable splits.

It implements the algorithms from the NeurIPS 2025 paper Empowering Decision Trees via Shape Function Branching, with a scikit-learn-compatible estimator API.

Highlights

  • 🌳 Shape Generalized Trees (SGTs): each node applies a learnable, axis-aligned shape function to a feature for non-linear, interpretable splits.

  • 👁 Interpretability: every node’s shape function can be visualized directly with plot_tree().

  • ShapeCART algorithm: an efficient native (C++/pybind11) induction method for learning SGTs from data.

  • 🔀 Extensions: multi-way branching (\(\mathrm{SGT}_K\)) and bootstrap ensembling via RandomSGForestClassifier / RandomSGForestRegressor.

Note

This codebase is an efficient, working implementation of the paper’s algorithms. See the Release Roadmap for which features are implemented and which are planned. The canonical research code lives at optimal-uoft/Empowering-DTs-via-Shape-Functions.

Project

Indices