Skip to main content

Explore/examine/explain/expose your model with the explabox!

Project description

explabox logo

"{Explore | Examine | Expose | Explain} your model with the explabox!"


The explabox aims to support data scientists and machine learning (ML) engineers in explaining, testing and documenting AI/ML models, developed in-house or acquired externally. The explabox turns your ingestibles (AI/ML model and/or dataset) into digestibles (statistics, explanations or sensitivity insights)!

figure: ingestibles to digestibles

The explabox can be used to:

  • Explore: describe aspects of the model and data.
  • Examine: calculate quantitative metrics on how the model performs
  • Expose: see model sensitivity to random inputs (robustness), test model generalizability (robustness), and see the effect of adjustments of attributes in the inputs (e.g. swapping male pronouns for female pronouns; fairness), for the dataset as a whole (global) as well as for individual instances (local).
  • Explain: use XAI methods for explaining the whole dataset (global), model behavior on the dataset (global), and specific predictions/decisions (local).

A number of experiments in the explabox can also be used to provide transparency and explanations to stakeholders, such as end-users or clients.

:information_source: The explabox currently only supports natural language text as a modality. In the future, we intend to extend to other modalities.

© National Police Lab AI (NPAI), 2022

Quick tour

The explabox is distributed on PyPI. To use the package with Python, install it (pip install explabox), import your data and model and wrap them in the Explabox:

>>> from explabox import import_data, import_model
>>> data = import_data('./drugsCom.zip', data_cols='review', label_cols='rating')
>>> model = import_model('model.onnx', label_map={0: 'negative', 1: 'neutral', 2: 'positive'})

>>> from explabox import Explabox
>>> box = Explabox(data=data,
...                model=model,
...                splits={'train': 'drugsComTrain.tsv', 'test': 'drugsComTest.tsv'})

Then .explore, .examine, .expose and .explain your model:

>>> # Explore the descriptive statistics for each split
>>> box.explore()
drugscom_explore
>>> # Show wrongly classified instances
>>> box.examine.wrongly_classified()
drugscom_examine
>>> # Compare the performance on the test split before and after transforming all tokens to uppercase
>>> box.expose.compare_metrics(split='test', perturbation='upper')
drugscom_expose
>>> # Get a local explanation (uses LIME by default)
>>> box.explain.local_explanation('Hate this medicine so much!')
drugscom_explain

For more information, visit the explabox documentation.

Contents

Installation

The easiest way to install the latest release of the explabox is through pip:

user@terminal:~$ pip install explabox
Collecting explabox
...
Installing collected packages: explabox
Successfully installed explabox

:information_source: The explabox requires Python 3.8 or above.

See the full installation guide for troubleshooting the installation and other installation methods.

Documentation

Documentation for the explabox is hosted externally on explabox.rtfd.io.

Example usage

...

Releases

The explabox is officially released through PyPI. The changelog includes a full overview of the changes for each version.

Contributing

The explabox is an open-source project developed and maintained primarily by the Netherlands National Police Lab AI (NPAI). However, your contributions and improvements are still required! See contributing for a full contribution guide.

Citation

...

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

explabox-0.9b2.tar.gz (572.2 kB view details)

Uploaded Source

Built Distribution

explabox-0.9b2-py3-none-any.whl (25.6 kB view details)

Uploaded Python 3

File details

Details for the file explabox-0.9b2.tar.gz.

File metadata

  • Download URL: explabox-0.9b2.tar.gz
  • Upload date:
  • Size: 572.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for explabox-0.9b2.tar.gz
Algorithm Hash digest
SHA256 6f75e07d1c8f975f631ed425f8900e89d2b41ad467a01b9dee576e26030c1768
MD5 c76604fc86e7aa41a93fdde3d6f2c639
BLAKE2b-256 942eb691f97128021444816a0624c61744ac2212a2d4fa0115e8cb7c8c300a2b

See more details on using hashes here.

File details

Details for the file explabox-0.9b2-py3-none-any.whl.

File metadata

  • Download URL: explabox-0.9b2-py3-none-any.whl
  • Upload date:
  • Size: 25.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.1 importlib_metadata/4.3.0 pkginfo/1.7.0 requests/2.27.1 requests-toolbelt/0.9.1 tqdm/4.62.3 CPython/3.9.9

File hashes

Hashes for explabox-0.9b2-py3-none-any.whl
Algorithm Hash digest
SHA256 7a2fc714785b676ac6dbe7561f326512d4963add01401c799a19564ac1fc3921
MD5 1cb35b398aa40acc32c330dfa601a4de
BLAKE2b-256 030f8a2be8d7af780a65e8a6ab010499dc94dfb9c3c6c02961d77ce2d0d7e3f2

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