Skip to main content

IMoTE: Interactive Model Tree Explorer

PyPI Python Documentation License: MIT

IMoTE is an interactive application to fit, visualise 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

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] or M5 [2] trees on built-in PMLB datasets or on your own CSV file.
  • Save the tree you are looking as an SVG image or 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.
  • Turn on Show all node plots to replace every node of the graph by its plot or only pin next to their node.
  • 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. Click a node to inspect it, or open the New Tree card on the right to fit a tree on another dataset.

IMoTE stores saved trees, uploaded datasets, downloaded PMLB 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 visualisation.

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 and ideas are welcome in Discussions, bugs can be reported 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.3.0

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.3.0
File Size Uploaded Provenance Actions
imote-0.3.0.tar.gz 1.9 MB Without provenance Details for imote-0.3.0.tar.gz

Built distribution (wheel)

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

Total release size: 3.9 MB

Release files / imote-0.3.0.tar.gz

Download URL imote-0.3.0.tar.gz
Size 1.9 MB
Tags Source
SHA-256 checksum
How to use checksums
1c4c79146c06e6f21b1a6a3ef54a0a67fcd61644520b6320868862c0be08045a
BLAKE2b-256 checksum
How to use checksums
608d8eeb7e052f61b5825f6bdfb56ffb470512e9ed28cd1ee33eaad82e36b917
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

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

Download URL imote-0.3.0-py3-none-any.whl
Size 2.0 MB
Tags Python 3
SHA-256 checksum
How to use checksums
92eed4754c236cf68c82af15230deae43206d2246d09f2486df1df1bb29a40a2
BLAKE2b-256 checksum
How to use checksums
9f0affbe49d74ff0bac7da5e5c72b412095805172997592fa5d889b6fd319f66
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for IMoTE 0.3.0

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