DEXiRE stands Deep Explanations and Rule extractor is an XAI tool to explain deep learning models extracting rule sets from their hidden layers.
This project allows to explain supervised learning models (e.g., classification and regression).
Before you begin, ensure you have met the following requirements:
- You have a
<Windows/Linux/Mac>
machine. State which OS is supported/which is not. - You have installed version of
python 3.9
. - It is recommended to create an environment with conda or venv to isolate the execution and avoid version conflict.
To install DEXiRE, follow these steps:
Windows, Linux and macOS:
python -m pip install --upgrade setuptools wheel twine
In the root directory DEXIRE execute the following command with the active environment activated:
pip install .
Or in the main folder with the environment activated execute the following command in the terminal:
python setup.py install
The package can be compile to a wheel fire and the easy installed. To build a wheel execute the following command in the terminal and localized in the DEXIRE main folder:
For Unix/Linux/macOS build:
python3 -m pip install --upgrade build
python3 -m build
For Windows:
py -m pip install --upgrade build
py -m build
The wheel installer will be appear in the dist subdirectory. Localize in the dist subdirectory execute the following command:
pip install dexire-0.0.1-py3-none-any.whl
The wheel installer (.whl file) cna be distributed to install in other environments.
Once DEXIRE have been successfully installed can be used following the next steps:
-
Train a tensorflow model using the functional or sequential API.
-
Create and configure the DEXiRE object in a python notebook or script:
dexire = DEXiRE(model=model)
-
Execute the rule extraction process, with the following method:
rule_set = dexire.extract_rules(X_train, y_train)
-
Visualize and use rules to predict:
y_pred = rule_set.predict(X_test)
To contribute to DEXiRE, follow these steps:
- Fork this repository.
- Create a branch:
git checkout -b <branch_name>
. - Make your changes and commit them:
git commit -m '<commit_message>'
- Push to the original branch:
git push origin <project_name>/<location>
- Create the pull request.
Alternatively see the GitHub documentation on creating a pull request.
Thanks to the project manager Davide Calvaresi, who support the development of this project.
Thanks to the following people who have contributed to this project:
To acknowledge the contributions of DEXiRE or cite the original paper use the following bibtex:
@article{contreras2022dexire,
title={A dexire for extracting propositional rules from neural networks via binarization},
author={Contreras, Victor and Marini, Niccolo and Fanda, Lora and Manzo, Gaetano and Mualla, Yazan and Calbimonte, Jean-Paul and Schumacher, Michael and Calvaresi, Davide},
journal={Electronics},
volume={11},
number={24},
pages={4171},
year={2022},
publisher={MDPI}
}
This work is supported by the Chist-Era grant CHIST-ERA19-XAI-005, and by the Swiss National Science Foundation (G.A. 20CH21_195530).
If you want to contact me you can reach me at [email protected].
This project uses the following license: MIT.