Skip to main content

RoCELib is an open-source Python library designed for benchmarking the robustness of counterfactual explanation (CE) methods.

Project description

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:

🔗 RoCELib Documentation

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:

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.

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

rocelib-0.2.3.tar.gz (8.1 MB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

rocelib-0.2.3-py3-none-any.whl (99.0 kB view details)

Uploaded Python 3

File details

Details for the file rocelib-0.2.3.tar.gz.

File metadata

  • Download URL: rocelib-0.2.3.tar.gz
  • Upload date:
  • Size: 8.1 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rocelib-0.2.3.tar.gz
Algorithm Hash digest
SHA256 d43a5ea4f490f7aa32f735221eb3136a1062354b7432f746f674cbc4333a0ec7
MD5 9e8932765aaed65e79005b1e956a0315
BLAKE2b-256 96a0db3608e2841065a8ac94a503b1ffa5762b4377e35a92d50661a801da9c85

See more details on using hashes here.

Provenance

The following attestation bundles were made for rocelib-0.2.3.tar.gz:

Publisher: publish-to-pypi.yml on JStadl/RoCELib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file rocelib-0.2.3-py3-none-any.whl.

File metadata

  • Download URL: rocelib-0.2.3-py3-none-any.whl
  • Upload date:
  • Size: 99.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.12.9

File hashes

Hashes for rocelib-0.2.3-py3-none-any.whl
Algorithm Hash digest
SHA256 5afbfb9117567c589ec3667596984d3bf0518e62dabc8ac41c76aa9f2711e712
MD5 f2a6c35e28e924b11771fef15b1429a8
BLAKE2b-256 1d51364eab382bbacc40153096b132129249c0f0b3e81896b1c14b462650d19e

See more details on using hashes here.

Provenance

The following attestation bundles were made for rocelib-0.2.3-py3-none-any.whl:

Publisher: publish-to-pypi.yml on JStadl/RoCELib

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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