Skip to main content

A toolbox for Building Explanations through a LocaLly AccuraTe Rule EXtractor

Project description

Bellatrex Logo

Welcome to Bellatrex!

Random Forest models can be difficult to interpret, and Bellatrex addresses this challenge by generating explanations that are easy to understand, and by providing insights into how the model arrived at its predictions. Bellatrex does so by Building Explanations through a LocalLy AccuraTe Rule EXtractor (hence the name: Bellatrex) for a given test instance, by extracting only a few, diverse rules. See the published paper for more details. The code for reproducing its results is available in a different GitHub branch.

To illustrate how Bellatrex works, let's consider an example: when a user provides a test instance to Bellatrex, the tool begins by 1) pre-selecting a subset of the rules used to make the prediction; it then creates 2) a vector representation of such rules and 3) projects them to a low-dimensional space; Bellatrex then 4) clusters such representations to pick a rule from each cluster to explain the instance prediction. One rule per cluster is shown to the end user through visually appealing plots, and the tool's GUI allows users to explore similar rules to those extracted.

Bellatrex image
Overview representation of Bellatrex, starting from top left, proceeding clockwise, we reach the output and explanation on the bottom left.

Another strength of Bellatrex lies in its ability to handle several prediction tasks within scikit-learn implementations of Random Forests. For instance, Bellatrex can generate explanations for binary classification and multi-label predictions tasks with RandomForestClassifier, as well as single- or multi-output regression tasks with RandomForestRegressor. Moreover, Bellatrex is compatible with scikit-survival's RandomSurvivalForest, allowing it to generate explanations for time-to-event predictions in the presence of right-censored data.

This repository contains:

  • instructions to run Bellatrex on your machine
  • an overview of the datasets used to test the effectiveness of the method
  • access to such datasets, as they appear after the pre-processing step.

Set-up

To install the standard version of Bellatrex, run:

pip install bellatrex

In case the previous step does not work, then the pip distribution is not working as expected so please contact us, and in the meantime try with a manual clone from the repository.

Enable Graphical User Interface

For an enhanced user experience that includes interactive plots, you can etiher pip install the following additional packages:

pip install dearpygui==1.6.2
pip install dearpygui-ext==0.9.5

Or install everything at once with:

pip install bellatrex[gui]

Note: When running Bellatrex with the GUI for multiple test samples, the program will generate an interactive window. The process may take a couple of seconds, and the the user has to click at least once within the generated window in order to activate the interactive mode. Once this is done, the user can explore the generated rules by clicking on the corresponding representation. To show the Bellatrex explanation for the next sample, close the interactive window and wait until Bellatrex generates the explanation for the new sample.

Ready for the tutorial!

If you have downloaded the content of this folder and installed the packages successfully, you can dive into the tutorial.ipynb code and try Bellatrex yourself.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

bellatrex-0.2.1.tar.gz (117.8 kB view details)

Uploaded Source

Built Distribution

bellatrex-0.2.1-py3-none-any.whl (120.7 kB view details)

Uploaded Python 3

File details

Details for the file bellatrex-0.2.1.tar.gz.

File metadata

  • Download URL: bellatrex-0.2.1.tar.gz
  • Upload date:
  • Size: 117.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for bellatrex-0.2.1.tar.gz
Algorithm Hash digest
SHA256 45bab4d6b021bf1809ef827efddfc8eb228fffcce149cdf0f9694bb233ee5909
MD5 4c336bf0dc82df58d05e9750c04d80f3
BLAKE2b-256 daa2040e0e04986ab804cecd4b22293107e350ccc59becabe70e738fc769dbbd

See more details on using hashes here.

File details

Details for the file bellatrex-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: bellatrex-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 120.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.10.13

File hashes

Hashes for bellatrex-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a5256c5eb6bda9e02f5ed3516bc576c877c47b6551c3c4af9f92868d6c7e6f88
MD5 4998e2b07e9f62723f87093dfc461dff
BLAKE2b-256 80aeeeacfab5ac2ed443c738db9f3acc57e21df48ff6420488be8e8f097c517e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page