Skip to main content

Deep Insight And Neural Network Analysis

Project description

build Documentation Status workflow scc badge CII Best Practices fair-software.eu

Logo_ER10

Deep Insight And Neural Network Analysis

DIANNA is a Python package that brings explainable AI (XAI) to your research project. It wraps carefully selected XAI methods in a simple, uniform interface. It's built by, with and for (academic) researchers and research software engineers working on machine learning projects.

Why DIANNA?

DIANNA software is addressing needs of both (X)AI reseachers and mostly the various domains scientists who are using or will use AI models for their research without being experts in (X)AI. DIANNA is future-proof: the only XAI library supporting the Open Neural Network Exchange (ONNX) format.

  • Provides an easy-to-use interface for non (X)AI experts
  • Implements well-known XAI methods (LIME, RISE and Kernal SHAP) chosen by systematic and objective evaluation criteria
  • Supports the de-facto standard format for neural network models - ONNX.
  • Includes clear instructions for export/conversions from Tensorflow, Pytorch, Keras and skikit-learn to ONNX.
  • Supports both images and text data modalities. Time series, tabular data and even embeddings support is planned.
  • Comes with simple intuitive image and text benchmarks
  • Easily extendable to other XAI methods

For more information on the unique stengths of DIANNA with comparision to other tools, please see the context landscape.

Installation

workflow pypi badge supported python versions

DIANNA can be installed from PyPI using pip on any of the supported Python versions (see badge):

python3 -m pip install dianna

To install the most recent development version directly from the GitHub repository run:

python3 -m pip install git+https://github.com/dianna-ai/dianna.git

Pre-requisites only for Macbook Pro with M1 Pro chip users

  • To install TensorFlow you can follow this tutorial.

  • To install TensorFlow Addons you can follow these steps. For further reading see this issue. Note that this temporary solution works only for macOS versions >= 12.0.

  • Before installing DIANNA, comment tensorflow requirement in setup.cfg file (tensorflow package for M1 is called tensorflow-macos).

How to use DIANNA

To use DIANNA you need a trained AI model (in ONNX format) and a data item (e.g. an image or text, etc.) for which you would like to explain the output of the model. DIANNA calls an explainable AI method to produce the relevance scores of each data pont (e.g. pixel, word) to a given model's decision overlaid on the data item.

For example usage see the DIANNA tutorials. For creating or converting a trained model to ONNX see the ONNX models and for example datasets- the Datasets sections below.

Architecture_high_level_resized

Datasets

DIANNA comes with simple datasets. Their main goal is to provide intuitive insight into the working of the XAI methods. They can be used as benchmarks for evaluation and comparison of existing and new XAI methods.

Images

Dataset Description Examples Generation
Binary MNIST mnist_zero_and_one_half_size Greyscale images of the digits "1" and "0" - a 2-class subset from the famous MNIST dataset for handwritten digit classification. BinaryMNIST Binary MNIST dataset generation
Simple Geometric (circles and triangles) Simple Geometric Logo Images of circles and triangles for 2-class geometric shape classificaiton. The shapes of varying size and orientation and the background have varying uniform gray levels. SimpleGeometric Simple geometric shapes dataset generation
Simple Scientific (LeafSnap30)LeafSnap30 Logo Color images of tree leaves - a 30-class post-processed subset from the LeafSnap dataset for automatic identification of North American tree species. LeafSnap LeafSnap30 dataset generation

Text

Dataset Description Examples Generation
Stanford sentiment treebanknlp-logo_half_size Dataset for predicting the sentiment, positive or negative, of movie reviews. This movie was actually neither that funny, nor super witty. Sentiment treebank

ONNX models

We work with ONNX! ONNX is a great unified neural network standard which can be used to boost reproducible science. Using ONNX for your model also gives you a boost in performance! In case your models are still in another popular DNN (deep neural network) format, here are some simple recipes to convert them:

More converters with examples and tutorials can be found on the ONNX tutorial page.

And here are links to notebooks showing how we created our models on the benchmark datasets:

Images

Models Generation
Binary MNIST model Binary MNIST model generation
Simple Geometric model Simple geometric shapes model generation
Simple Scientific model LeafSnap30 model generation

Text

Models Generation
Movie reviews model Stanford sentiment treebank model generation

We envision the birth of the ONNX Scientific models zoo soon...

Tutorials

DIANNA supports different data modalities and XAI methods. The table contains links to the relevant XAI method's papers. There are DIANNA tutorials covering each supported method and data modality on a least one dataset. Our future plans to expand DIANNA with more data modalities and XAI methods are given in the ROADMAP.

Data \ XAI RISE LIME KernelSHAP
Images :white_check_mark: :white_check_mark: :white_check_mark:
Text :white_check_mark: :white_check_mark: planned
Embedding coming soon coming soon coming soon
Timeseries planned planned planned
Tabular planned planned planned
Graphs

LRP and PatternAttribution also feature in the top 5 of our thoroughly evaluated XAI methods using objective critera (details in coming blog-post). Contributing by adding these and more (new) post-hoc explainability methods on ONNX models is very welcome!

Reference documentation

For detailed information on using specific DIANNA functions, please visit the documentation page hosted at Readthedocs.

Contributing

If you want to contribute to the development of DIANNA, have a look at the contribution guidelines.

How to cite us

DOI RSD

If you use this package for your scientific work, please consider citing it as:

Ranguelova, Elena, Bos, Patrick, Liu, Yang, Meijer, Christiaan, & Oostrum, Leon. (2021). dianna (*[VERSION YOU USED]*). Zenodo. https://zenodo.org/record/5592607

See also the Zenodo page for exporting the citation to BibTteX and other formats.

Credits

This package was created with Cookiecutter and the NLeSC/python-template.

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

dianna-0.3.0.tar.gz (27.6 kB view details)

Uploaded Source

Built Distribution

dianna-0.3.0-py3-none-any.whl (26.0 kB view details)

Uploaded Python 3

File details

Details for the file dianna-0.3.0.tar.gz.

File metadata

  • Download URL: dianna-0.3.0.tar.gz
  • Upload date:
  • Size: 27.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for dianna-0.3.0.tar.gz
Algorithm Hash digest
SHA256 2f99755143e374825024e7ad9c3ec9db85dd66ed58a00b2ae581782ecd6fa772
MD5 8a828f2f74a863801b7735e38f4e293b
BLAKE2b-256 787ec5d9e048185e779f0aed91f84b22f45abb5a130a6e683385794624dd4f15

See more details on using hashes here.

File details

Details for the file dianna-0.3.0-py3-none-any.whl.

File metadata

  • Download URL: dianna-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 26.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.0 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.10

File hashes

Hashes for dianna-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fca5adf91419600b1fc560898b9114d6811763befe4f96b82a7cd4f935aa53b0
MD5 8f1609d7b1093e42b27aba5e3b1f715b
BLAKE2b-256 53d6fdf2dfe75a998d6beb72fbd18d1d9219614c5fcb6f2938e85ceee92b9ce0

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