Skip to main content

IMoTE: Interactive Model Tree Explorer

PyPI Tests Python Documentation License: MIT

IMoTE is an interactive application to fit, visualize and explore linear model trees for regression on tabular data. It shows a fitted tree as an interactive graph, lets you look at the linear model and the data behind every node, and traces a single data point through the tree to explain its prediction.

IMoTE: the tree graph with the interaction cards on the right

Highlighted path with node plots pinned on the graph Data flow through a large tree Every node shown as its plot
Trace a data point, with node plots pinned on the graph Data flow through a large tree Every node shown as its plot

More examples in the Gallery.

Why IMoTE?

A linear model tree combines the rule based structure of a decision tree with linear models in its leaves. That usually makes it more accurate than a classic regression tree of the same depth. In practice, these trees are often hard to read from code or a text dump. IMoTE makes them easy to explore, explain and present.

Features

Fit or load a tree

  • Fit PILOT [1], M5 [2] or decision trees on datasets you search and download from PMLB or the UCI repository, or on your own file (CSV, Excel, Parquet, ARFF, JSON, ...), for regression.
  • Download the tree you are looking at as an SVG image, or save it to load it again later.
  • Load trees fitted with other tools through an adapter. An adapter for trees from the R package partykit is included as an example.

Edit and explore the tree

  • Pan, zoom and click through the tree as an interactive graph.
  • Collapse and expand branches, collapse the whole tree to a given level, show a single branch as a subtree, or prune the tree (PILOT only).
  • Switch between normal, minimal and tiny nodes or color nodes by the feature they use.
  • Show the data flow: edge width or node size scale with the number of training samples that pass through them.

Inspect nodes and predictions

  • Click a node to see its type, split and metrics (number of samples, RSS, MAE, ...).
  • See the plot of any node: the data and the fit of a split, or the prediction plot of a leaf that shows how each feature contributes to its predictions.
  • Use the global predsplot of a leaf to see how the splits on the path and the leaf model together build up the prediction.
  • Turn on Show all node plots to replace every node of the graph by its plot, or pin the plots of a few nodes next to them on the graph.
  • Highlight the path of a data point through the tree, with its prediction.

Installation

IMoTE needs Python 3.10 or newer.

pip install imote

Start the application with:

imote

Then open the address shown in the terminal (by default http://127.0.0.1:8050). The app starts with an example PILOT tree, fitted on the 1199_BNG_echoMonths dataset. To get started:

  1. Click a node in the graph and turn on Show node plot in the Node Information card to see its data and fit.
  2. Open the Highlight card, click Random point and then Highlight to follow a data point through the tree.
  3. Open the New Tree card to fit a tree on another dataset.

IMoTE stores saved trees, uploaded datasets, downloaded datasets and generated plots in ~/.imote. Set the IMOTE_HOME environment variable to use another folder.

Documentation

The full documentation is at https://stan-uantwerp.github.io/IMoTE/, it includes:

  • the User Guide, with a page for every part of the interface,
  • the Gallery, with screenshots of what IMoTE can show,
  • a guide on how to write your own adapter for another type of linear model tree,
  • an API reference of the tree and node classes used for visualization.

Citing IMoTE

If you use IMoTE, please cite the software with Cite this repository on the GitHub page (from CITATION.cff). A paper describing IMoTE is under review.

Development

git clone https://github.com/STAN-UAntwerp/IMoTE
cd IMoTE
pip install -e ".[dev]"   # IMoTE in editable mode, plus pytest, build and twine
python -m imote.app       # start the app in Dash debug mode, it reloads on code changes

To work on the documentation: pip install -e ".[docs]", then mkdocs serve.

Questions, ideas and bugs are welcome as an issue.

References

[1] Raymaekers, J., Rousseeuw, P. J., Verdonck, T., & Yao, R. (2024). Fast linear model trees by PILOT. Machine Learning, 113(9), 6561-6610. https://doi.org/10.1007/s10994-024-06590-3 (implementation: fast-model-trees)

[2] Quinlan, J. R. (1992). Learning with continuous classes. In 5th Australian Joint Conference on Artificial Intelligence (Vol. 92, pp. 343-348). (implementation: m5py)

Metadata

Release files for IMoTE 0.4.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for IMoTE 0.4.2
File Size Uploaded Provenance Actions
imote-0.4.2.tar.gz 1.8 MB Without provenance Details for imote-0.4.2.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for IMoTE 0.4.2
File Interpreter ABI Platform Actions
imote-0.4.2-py3-none-any.whl Python 3 none any Details for imote-0.4.2-py3-none-any.whl

Total release size: 3.7 MB

Release files / imote-0.4.2.tar.gz

Download URL imote-0.4.2.tar.gz
Size 1.8 MB
Tags Source
SHA-256 checksum
How to use checksums
414fca3c8e93ce44b9a3bdf39f3539cc6ed3bce8cab88bb3515177e5deb53dec
BLAKE2b-256 checksum
How to use checksums
beacbbe98346b7837b0d78880ef8b7d5470ec69c6639a7d3db69ca949c07eef5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / imote-0.4.2-py3-none-any.whl

Download URL imote-0.4.2-py3-none-any.whl
Size 1.9 MB
Tags Python 3
SHA-256 checksum
How to use checksums
6a93ecd8201a543bf561a3c308fffffcb7c25fec4c73b3ec30eb676849f0bc9e
BLAKE2b-256 checksum
How to use checksums
462cf5b531a4e296b348c63cf5e49b68f093f234dacd472613bbe682b5ef95d5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for IMoTE 0.4.2

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page