RoCELib
The increasing use of machine learning models to aid decision-making in high-stakes industries like finance and healthcare demands explainability to build trust. Counterfactual Explanations (CEs) provide valuable insights into model predictions by showing how slight changes in input data could lead to different outcomes. A key aspect of CEs is their robustness, which ensures that the desired outcomes remain stable even with minor alterations to the input. Robustness is important since produced CEs should hold up in the future should the original model be altered or replaced.Despite the importance of robustness, there has been a lack of standardised tools to comprehensively evaluate and compare robust CE generation methods. To address this, RoCELib was developed as an open-source Python library aimed at benchmarking the robustness of various CE methods. RoCELib provides a systematic framework for generating, evaluating, and comparing CEs with a focus on robustness, enabling fair and effective benchmarking. The library is highly extensible, allowing for custom models, datasets, and tools to be integrated, making it an essential tool for enhancing the reliability and interpretability of machine learning models in critical applications.
Features
- Standardises the evaluation and benchmarking of robust CEs.
- Supports multiple ML frameworks, including PyTorch, Keras, and scikit-learn.
- Extensible to incorporate custom models, datasets, CE methods, and evaluation metrics.
- Includes several robust CE generation algorithms (e.g., TRexNN, RNCE) and non-robust baselines (e.g., MCE, BLS).
Setup
To set up do:
(1) Create a virtual environment in the root
python -m venv venv
(2) Activate it. (You may have to use a different command depending on your platform)
source venv/bin/activate
(3) Install the package from PyPi:
pip install rocelib
Generating Docs
The documentation for RoCELib is automatically generated and hosted online. You can access the latest version here:
There is no need to manually build the documentation unless making local modifications. However, if you need to generate docs locally, navigate to docs/source and run:
make html
If that does not work, try:
sphinx-build -b html . _build/html
Examples
Python notebooks demonstrating the usage of RoCELib are available:
- An overview of all features.
- Showing how to use the example datasets include
- Showing how to use your own datasets
Release Process
For detailed instructions on publishing a new version of RoCELib to PyPI, refer to the RELEASE.md file in the repository. This file contains step-by-step guidance on versioning, tagging, and triggering the GitHub Action workflow for automated publishing.
License
RoCELib is licensed under the MIT License. For more details, please refer to the LICENSE file in this repository.
Metadata
Release files for RoCELib 0.2.3
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| rocelib-0.2.3.tar.gz | 8.1 MB | With provenance | Details for rocelib-0.2.3.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| rocelib-0.2.3-py3-none-any.whl | Python 3 | none | any | Details for rocelib-0.2.3-py3-none-any.whl |
Total release size: 8.2 MB
Release files / rocelib-0.2.3.tar.gz
| Download URL | rocelib-0.2.3.tar.gz |
|---|---|
| Size | 8.1 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d43a5ea4f490f7aa32f735221eb3136a1062354b7432f746f674cbc4333a0ec7
|
|
BLAKE2b-256 checksum How to use checksums |
96a0db3608e2841065a8ac94a503b1ffa5762b4377e35a92d50661a801da9c85
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2025.
Transparency logRelease files / rocelib-0.2.3-py3-none-any.whl
| Download URL | rocelib-0.2.3-py3-none-any.whl |
|---|---|
| Size | 99.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5afbfb9117567c589ec3667596984d3bf0518e62dabc8ac41c76aa9f2711e712
|
|
BLAKE2b-256 checksum How to use checksums |
1d51364eab382bbacc40153096b132129249c0f0b3e81896b1c14b462650d19e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
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.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2025.
Transparency logSecurity for RoCELib 0.2.3
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.
Full provenance
All 2 files in this release have been uploaded with provenance metadata.
Attestation for rocelib-0.2.3.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Mar 6, 2025.
Transparency logA 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.