dianna


Namedianna JSON
Version 1.5.0 PyPI version JSON
download
home_pagehttps://github.com/dianna-ai/dianna
SummaryDeep Insight And Neural Network Analysis
upload_time2024-04-10 15:49:22
maintainerNone
docs_urlNone
authorDIANNA Team
requires_python<3.12,>=3.8
licenseApache License 2.0
keywords xai machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!--
title: 'DIANNA: Deep Insight And Neural Network Analysis'
tags:
  - Python
  - explainable AI
  - deep neural networks
  - ONNX
  - benchmark sets
authors:
  - name: Elena Ranguelova^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-9834-1756
    affiliation: 1
  - name: Patrick Bos^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-6033-960X
    affiliation: 1
  - name: Yang Liu^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-1966-8460
    affiliation: 1
  - name: Christiaan Meijer^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-5529-5761
    affiliation: 1
  - name: Leon Oostrum^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0001-8724-8372
    affiliation: 1
  - name: Giulia Crocioni^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-0823-0121
    affiliation: 1
  - name: Laura Ootes^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-2800-8309
    affiliation: 1  
  - name: Pranav Chandramouli^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-7896-2969
    affiliation: 1  
  - name: Aron Jansen^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-4764-9347
    affiliation: 1  
  - name: Stef Smeets^[co-first author] # note this makes a footnote saying 'co-first author'
    orcid: 0000-0002-5413-9038
    affiliation: 1  
affiliations:
 - name: Netherlands eScience Center, Amsterdam, the Netherlands
   index: 1
-->

[![build](https://github.com/dianna-ai/dianna/actions/workflows/build.yml/badge.svg)](https://github.com/dianna-ai/dianna/actions/workflows/build.yml)
[![Documentation Status](https://readthedocs.org/projects/dianna/badge/?version=latest)](https://dianna.readthedocs.io/en/latest/?badge=latest)
[![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project=dianna-ai_dianna&metric=coverage)](https://sonarcloud.io/dashboard?id=dianna-ai_dianna)
[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5542/badge)](https://bestpractices.coreinfrastructure.org/projects/5542)
[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu)
[![DOI](https://joss.theoj.org/papers/10.21105/joss.04493/status.svg)](https://doi.org/10.21105/joss.04493)

<img width="300" alt="Logo_ER10" src="https://user-images.githubusercontent.com/3244249/151994514-b584b984-a148-4ade-80ee-0f88b0aefa45.png">

<img align="left" src="https://user-images.githubusercontent.com/55382553/153408200-36c4de2e-7865-4934-956d-09eefd893e6a.png">

# 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 researchers 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: one of the very few XAI library supporting the [Open Neural Network Exchange (ONNX)](https://onnx.ai/) format.

After studying the vast XAI landscape we have made choices in the parts of the [XAI Taxonomy](https://doi.org/10.3390/make3030032) on which methods, data modalities and problems types to focus. Our choices, based on the largest usage in scientific literature, are shown graphically in the XAI taxonomy below:

<img src="https://github.com/dianna-ai/dianna/assets/3244249/9b864980-86f4-4d0e-8a83-af7d6be606f7" alt="XAI_taxonomy" width="80%"/>

The key points of DIANNA:

* 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 scikit-learn to ONNX.
* Supports images, text and time series data modalities. 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 strengths of DIANNA with comparison to other tools, please see the [context landscape](https://dianna.readthedocs.io/en/latest/CONTEXT.html).

## Installation

[![workflow pypi badge](https://img.shields.io/pypi/v/dianna.svg?colorB=blue)](https://pypi.python.org/project/dianna/)
[![supported python versions](https://img.shields.io/pypi/pyversions/dianna)](https://pypi.python.org/project/dianna/)

DIANNA can be installed from PyPI using [pip](https://pip.pypa.io/en/stable/installation/) on any of the supported Python versions (see badge):

```console
python3 -m pip install dianna
```

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

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

If you get an error related to OpenMP when importing dianna, have a look at [this issue](https://github.com/dianna-ai/dianna/issues/376) for possible workarounds.

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

- To install TensorFlow you can follow this [tutorial](https://betterdatascience.com/install-tensorflow-2-7-on-macbook-pro-m1-pro/).
- To install TensorFlow Addons you can follow these [steps](https://github.com/tensorflow/addons/pull/2504). For further reading see this [issue](https://github.com/tensorflow/addons/issues/2503). Note that this temporary solution works only for macOS versions >= 12.0. Note that this step may have changed already, see https://github.com/dianna-ai/dianna/issues/245.
- Before installing DIANNA, comment `tensorflow` requirement in `setup.cfg` file (tensorflow package for M1 is called `tensorflow-macos`).

## Getting started

You need:

- your trained ONNX model ([convert my pytorch/tensorflow/keras/scikit-learn model to ONNX](https://github.com/dianna-ai/dianna#onnx-models))
- 1 data item to be explained

 You get:

- a relevance map overlayed over the data item

In the library's documentation, the general usage is explained in [How to use DIANNA](https://dianna.readthedocs.io/en/latest/usage.html)

### Demo movie

[![Watch the video on YouTube](https://img.youtube.com/vi/u9_c5DJewLU/default.jpg)](https://youtu.be/u9_c5DJewLU)

### Text example:

```python
model_path = 'your_model.onnx'  # model trained on text
text = 'The movie started great but the ending is boring and unoriginal.'
```

Which of your model's classes do you want an explanation for?

```python
labels = [positive_class, negative_class]
```

Run using the XAI method of your choice, for example LIME:

```python
explanation = dianna.explain_text(model_path, text, 'LIME')
dianna.visualization.highlight_text(explanation[labels.index(positive_class)], text)
```

![image](https://user-images.githubusercontent.com/6087314/155532504-6f90f032-cbb4-4e71-9b99-aa9c0de4e86a.png)

### Image example:

```python
model_path = 'your_model.onnx'  # model trained on images
image = PIL.Image.open('your_image.jpeg')
```

Tell us what label refers to the channels, or colors, in the image.

```python
axis_labels = {0: 'channels'}
```

Which of your model's classes do you want an explanation for?

```python
labels = [class_a, class_b]
```

Run using the XAI method of your choice, for example RISE:

```python
explanation = dianna.explain_image(model_path, image, 'RISE', axis_labels=axis_labels, labels=labels)
dianna.visualization.plot_image(explanation[labels.index(class_a)], original_data=image)
```

![image](https://user-images.githubusercontent.com/6087314/155557077-e2052094-d8ac-49d3-a840-0160256d53a6.png)

### Time-series example:

```python
model_path = 'your_model.onnx'  # model trained on images
timeseries_instance = pd.read_csv('your_data_instance.csv').astype(float)

num_features = len(timeseries_instance)  # The number of features to include in the explanation.
num_samples = 500  # The number of samples to generate for the LIME explainer.
```

Which of your model's classes do you want an explanation for?

```python
class_names= [class_a, class_b] # String representation of the different classes of interest
labels = np.argsort(class_names) # Numerical representation of the different classes of interest for the model
```

Run using the XAI method of your choice, for example LIME with the following additional arguments:

```python
explanation = dianna.explain_timeseries(model_path, timeseries_data=timeseries_instance , method='LIME', 
					labels=labels, class_names=class_names, num_features=num_features,
                                	num_samples=num_samples, distance_method='cosine')

```

For visualization of the heatmap please refer to the [tutorial](https://github.com/dianna-ai/dianna/blob/main/tutorials/explainers/LIME/lime_timeseries_coffee.ipynb)

### Tabular example:

```python
model_path = 'your_model.onnx'  # model trained on tabular data
tabular_instance = pd.read_csv('your_data_instance.csv')
```

Run using the XAI method of your choice. Note that you need to specify the mode, either regression or classification. This case, for instance a regression task using KernelSHAP with the following additional arguments:

```python
explanation = dianna.explain_tabular(run_model, input_tabular=data_instance, method='kernelshap',
                                     mode ='regression', training_data = X_train,
                                     training_data_kmeans = 5, feature_names=input_features.columns)
plot_tabular(explanation, X_test.columns, num_features=10)  # display 10 most salient features
```

![image](https://github.com/dianna-ai/dianna/assets/25911757/ce0b76b8-f00c-468a-9732-c21704e289f6)

### IMPORTANT: Sensitivity to hyperparameters
The XAI methods (explainers) are sensitive to the choice of their hyperparameters! In this [work](https://staff.fnwi.uva.nl/a.s.z.belloum/MSctheses/MScthesis_Willem_van_der_Spec.pdf), this sensitivity to hyperparameters is researched and useful conclusions are drawn.
The default hyperparameters used in DIANNA for each explainer as well as the values for our tutorial examples are given in the Tutorials [README](./tutorials/README.md#important-hyperparameters).

## Dashboard

Explore the explanations of your trained model using the DIANNA dashboard (for now images, text and time series classification is supported). 
[Click here](https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard) for more information.

<a href="https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard" target="_blank">
  <img width="1000" align="center" alt="Dianna dashboard screenshot" src="https://raw.githubusercontent.com/dianna-ai/dianna/main/dianna/dashboard/dashboard-screenshot.png">
</a>

## 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 <img width="25" alt="mnist_zero_and_one_half_size" src="https://user-images.githubusercontent.com/3244249/152354583-d7b68902-d402-4098-922b-b1a33b07e3e1.png">                                                             | Greyscale images of the digits "1" and "0" - a 2-class subset from the famous[MNIST dataset](http://yann.lecun.com/exdb/mnist/) for handwritten digit classification.          | <img width="120" alt="BinaryMNIST" src="https://user-images.githubusercontent.com/3244249/150808267-3d27eae0-78f2-45f8-8569-cb2561f2c2e9.png">     | [Binary MNIST dataset generation](https://github.com/dianna-ai/dianna-exploration/tree/main/example_data/dataset_preparation/MNIST)                       |
| [Simple Geometric (circles and triangles)](https://doi.org/10.5281/zenodo.5012824) <img width="20" alt="Simple Geometric Logo" src="https://user-images.githubusercontent.com/3244249/150808842-d35d741e-294a-4ede-bbe9-58e859483589.png"> | 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. | <img width="130" alt="SimpleGeometric" src="https://user-images.githubusercontent.com/3244249/150808125-e1576237-47fa-4e51-b01e-180904b7c7f6.png"> | [Simple geometric shapes dataset generation](https://github.com/dianna-ai/dianna-exploration/tree/main/example_data/dataset_preparation/geometric_shapes) |
| [Simple Scientific (LeafSnap30)](https://zenodo.org/record/5061353/) <img width="20" alt="LeafSnap30 Logo" src="https://user-images.githubusercontent.com/3244249/150815639-2da560d4-8b26-4eeb-9ab4-dabf221a264a.png">                      | Color images of tree leaves - a 30-class post-processed subset from the LeafSnap dataset for automatic identification of North American tree species.                       | <img width="600" alt="LeafSnap" src="https://user-images.githubusercontent.com/3244249/150804246-f714e517-641d-48b2-af26-2f04166870d6.png">        | [LeafSnap30 dataset generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/dataset_preparation/LeafSnap/)                     |

### Text

| Dataset                                                                                                                                                                                                                            | Description                                                                   | Examples                                                         | Generation                                                          |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | :--------------------------------------------------------------- | :------------------------------------------------------------------ |
| [Stanford sentiment treebank](https://nlp.stanford.edu/sentiment/index.html) <img width="20" alt="nlp-logo_half_size" src="https://user-images.githubusercontent.com/3244249/152355020-908c04f3-aa99-489d-b87a-7e6b1f586118.png"> | Dataset for predicting the sentiment, positive or negative, of movie reviews. | _This movie was actually neither that funny, nor super witty._ | [Sentiment treebank](https://nlp.stanford.edu/sentiment/treebank.html) |

### Time series

| Dataset                                                                                                                                                                                                                | Description                                                                                                                                                    | Examples                                                                                                                                 | Generation                                                                |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |
| [Coffee dataset](https://timeseriesclassification.com/description.php?Dataset=Coffee) <img width="25" alt="Coffe Logo" src="https://github.com/dianna-ai/dianna/assets/3244249/9ab50a0f-5da3-41d2-80e9-70d2c8769162"> | Food spectographs time series dataset for a two class problem to distinguish between Robusta and Arabica coffee beans.                                         | <img width="500" alt="example image" src="https://github.com/dianna-ai/dianna/assets/3244249/763002c5-40ad-48cc-9de0-ea43d7fa8a75)"> | [data source](https://github.com/QIBChemometrics/Benchtop-NMR-Coffee-Survey) |
| [Weather dataset](https://zenodo.org/record/7525955) <img width="25" alt="Weather Logo" src="https://github.com/dianna-ai/dianna/assets/3244249/3ff3d639-ed2f-4a38-b7ac-957c984bce9f">                                | The light version of the weather prediciton dataset, which contains daily observations (89 features) for 11 European locations through the years 2000 to 2010. | <img width="500" alt="example image" src="https://github.com/dianna-ai/dianna/assets/3244249/b0a505ac-8a6c-4e1c-b6ad-35e31e52f46d)"> | [data source](https://github.com/florian-huber/weather_prediction_dataset)   |

### Tabular 

| Dataset                                                                                                                                                                                                                | Description                                                                                                                                                    | Examples                                                                                                                                 | Generation                                                                |
| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |
| [Pengiun dataset](https://www.kaggle.com/code/parulpandey/penguin-dataset-the-new-iris) <img width="75" alt="Penguins Logo" src="https://github.com/dianna-ai/dianna/assets/3244249/c7716ad3-f992-4557-80d9-1d8178c7ed57)"> | Palmer Archipelago (Antarctica) penguin dataset is a great intro dataset for data exploration & visualization similar to the famous Iris dataset.                                         | <img width="500" alt="example image" src="https://github.com/allisonhorst/palmerpenguins/blob/main/man/figures/README-mass-flipper-1.png"> | [data source](https://github.com/allisonhorst/palmerpenguins) |
| [Weather dataset](https://zenodo.org/record/7525955) <img width="25" alt="Weather Logo" src="https://github.com/dianna-ai/dianna/assets/3244249/3ff3d639-ed2f-4a38-b7ac-957c984bce9f">                                | The light version of the weather prediciton dataset, which contains daily observations (89 features) for 11 European locations through the years 2000 to 2010. | <img width="500" alt="example image" src="https://github.com/dianna-ai/dianna/assets/3244249/b0a505ac-8a6c-4e1c-b6ad-35e31e52f46d)"> | [data source](https://github.com/florian-huber/weather_prediction_dataset)   |

## ONNX models

<!-- TODO: Add all links, see issue https://github.com/dianna-ai/dianna/issues/135 -->

**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:

* [pytorch and pytorch-lightning](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/pytorch2onnx.ipynb) - use the built-in [`torch.onnx.export`](https://pytorch.org/docs/stable/onnx.html) function to convert pytorch models to onnx, or call the built-in [`to_onnx`](https://pytorch-lightning.readthedocs.io/en/latest/deploy/production_advanced.html) function on your [`LightningModule`](https://lightning.ai/docs/pytorch/latest/api/lightning.pytorch.core.LightningModule.html#lightning.pytorch.core.LightningModule) to export pytorch-lightning models to onnx.
* [tensorflow](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/tensorflow2onnx.ipynb) - use the [`tf2onnx`](https://github.com/onnx/tensorflow-onnx) package to convert tensorflow models to onnx.
* [keras](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/keras2onnx.ipynb) - same as the conversion from tensorflow to onnx, the [`tf2onnx`](https://github.com/onnx/tensorflow-onnx) package also supports keras.
* [scikit-learn](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/skl2onnx.ipynb) - use the [`skl2onnx`](https://github.com/onnx/sklearn-onnx) package to scikit-learn models to onnx.

More converters with examples and tutorials can be found on the [ONNX tutorial page](https://github.com/onnx/tutorials).

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

### Images

| Models                                                    | Generation                                                                                                                                                             |
| :-------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Binary MNIST model](https://zenodo.org/record/5907177)      | [Binary MNIST model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/MNIST/generate_model_binary.ipynb)                |
| [Simple Geometric model](https://zenodo.org/deposit/5907059) | [Simple geometric shapes model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/geometric_shapes/generate_model.ipynb) |
| [Simple Scientific model](https://zenodo.org/record/5907196) | [LeafSnap30 model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/LeafSnap/generate_model.ipynb)                      |

### Text

| Models                                                | Generation                                                                                                                                                              |
| :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Movie reviews model](https://zenodo.org/record/5910598) | [Stanford sentiment treebank model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/movie_reviews/generate_model.ipynb) |

### Time series

| Models                                                    | Generation                                                                                                                                                        |
| :-------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Coffee model](https://zenodo.org/records/10579458)                          | [Coffee model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/coffee/generate_model.ipynb)                       |
| [Season prediction model](https://zenodo.org/record/7543883)                 | [Season prediction model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/season_prediction/generate_model.ipynb) |
| [Fast Radio Burst classification model](https://zenodo.org/records/10656614) | [Fast Radio Burst classification model generation](https://doi.org/10.3847/1538-3881/aae649) |

### Tabular

| Models                                                    | Generation                                                                                                                                                        |
| :-------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| [Penguin model    (classification)](https://zenodo.org/records/10580743)                         | [Penguin model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/penguin_species/generate_model.ipynb)                       |
| [Sunshine hours prediction model (regression)](https://zenodo.org/records/10580833) | [Sunshine hours prediction model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/sunshine_prediction/generate_model.ipynb) |


**_We envision the birth of the ONNX Scientific models zoo soon..._**

## Tutorials

DIANNA supports different data modalities and XAI methods (explainers). We have evaluated many explainers using objective criteria (see the [How to find your AI explainer](https://blog.esciencecenter.nl/how-to-find-your-artificial-intelligence-explainer-dbb1ac608009) blog-post). The table below contains links to the relevant XAI method's papers (for some explanatory videos on the methods, please see [tutorials](./tutorials)). The DIANNA [tutorials](./tutorials) cover each supported method and data modality on a least one dataset using the default or tuned [hyperparameters](./tutorials/README.md#important-hyperparameters). Our plans to expand DIANNA with more data modalities and explainers are given in the [ROADMAP](https://dianna.readthedocs.io/en/latest/ROADMAP.html).

<!-- see issue: https://github.com/dianna-ai/dianna/issues/142, also related issue: https://github.com/dianna-ai/dianna/issues/148 -->

| Data \ XAI | [RISE](http://bmvc2018.org/contents/papers/1064.pdf) | [LIME](https://www.kdd.org/kdd2016/papers/files/rfp0573-ribeiroA.pdf) | [KernelSHAP](https://proceedings.neurips.cc/paper/2017/file/8a20a8621978632d76c43dfd28b67767-Paper.pdf) |
| :--------- | :------------------------------------------------ | :----------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |
| Images     | ✅                                                | ✅                                                                 | ✅                                                                                                   |
| Text       | ✅                                                | ✅                                                                 |                                                                                                      |
| Timeseries | ✅                                                | ✅                                                                 |                                                                                                                                                                       |
| Tabular    | planned                                           | ✅                                                            | ✅                                                                                              |
| Embedding  | planned                                           | planned                                                            | planned   
| Graphs*    | work in progress                                  | work in progress                                                   | work in progress                                                                                     |

[LRP](https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0130140&type=printable) and [PatternAttribution](https://arxiv.org/pdf/1705.05598.pdf) also feature in the top 5 of our thoroughly evaluated explainers. **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](https://dianna.readthedocs.io/en/latest).

## Contributing

If you want to contribute to the development of DIANNA,
have a look at the [contribution guidelines](https://dianna.readthedocs.io/en/latest/CONTRIBUTING.html).
See our [developer documentation](docs/developer_info.rst) for information on developer installation, running tests, generating documentation, versioning and making a release.

## How to cite us

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5592606.svg)](https://zenodo.org/record/5592606)
[![RSD](https://img.shields.io/badge/rsd-dianna-00a3e3.svg)](https://www.research-software.nl/software/dianna)

If you use this package for your scientific work, please consider citing directly the software as:

    Ranguelova, E., Bos, P., Liu, Y., Meijer, C., Oostrum, L., Crocioni, G., Ootes, L., Chandramouli, P., Jansen, A., Smeets, S. (2023). dianna (*[VERSION YOU USED]*). Zenodo. https://zenodo.org/record/5592606

or the JOSS paper as:

    Ranguelova et al., (2022). DIANNA: Deep Insight And Neural Network Analysis. Journal of Open Source Software, 7(80), 4493, https://doi.org/10.21105/joss.04493

See also the [Zenodo page](https://zenodo.org/record/5592606) or the [JOSS page](https://joss.theoj.org/papers/10.21105/joss.04493) for exporting the software citation to BibTteX and other formats.

## Credits

This package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [NLeSC/python-template](https://github.com/NLeSC/python-template).

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dianna-ai/dianna",
    "name": "dianna",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.12,>=3.8",
    "maintainer_email": null,
    "keywords": "XAI, machine learning",
    "author": "DIANNA Team",
    "author_email": "dianna-ai@esciencecenter.nl",
    "download_url": "https://files.pythonhosted.org/packages/ef/73/3842a77b98fa39ea19c1ba90696ab73e760753bd918f1d2cd81981106127/dianna-1.5.0.tar.gz",
    "platform": null,
    "description": "<!--\ntitle: 'DIANNA: Deep Insight And Neural Network Analysis'\ntags:\n  - Python\n  - explainable AI\n  - deep neural networks\n  - ONNX\n  - benchmark sets\nauthors:\n  - name: Elena Ranguelova^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-9834-1756\n    affiliation: 1\n  - name: Patrick Bos^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-6033-960X\n    affiliation: 1\n  - name: Yang Liu^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-1966-8460\n    affiliation: 1\n  - name: Christiaan Meijer^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-5529-5761\n    affiliation: 1\n  - name: Leon Oostrum^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0001-8724-8372\n    affiliation: 1\n  - name: Giulia Crocioni^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-0823-0121\n    affiliation: 1\n  - name: Laura Ootes^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-2800-8309\n    affiliation: 1  \n  - name: Pranav Chandramouli^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-7896-2969\n    affiliation: 1  \n  - name: Aron Jansen^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-4764-9347\n    affiliation: 1  \n  - name: Stef Smeets^[co-first author] # note this makes a footnote saying 'co-first author'\n    orcid: 0000-0002-5413-9038\n    affiliation: 1  \naffiliations:\n - name: Netherlands eScience Center, Amsterdam, the Netherlands\n   index: 1\n-->\n\n[![build](https://github.com/dianna-ai/dianna/actions/workflows/build.yml/badge.svg)](https://github.com/dianna-ai/dianna/actions/workflows/build.yml)\n[![Documentation Status](https://readthedocs.org/projects/dianna/badge/?version=latest)](https://dianna.readthedocs.io/en/latest/?badge=latest)\n[![workflow scc badge](https://sonarcloud.io/api/project_badges/measure?project=dianna-ai_dianna&metric=coverage)](https://sonarcloud.io/dashboard?id=dianna-ai_dianna)\n[![CII Best Practices](https://bestpractices.coreinfrastructure.org/projects/5542/badge)](https://bestpractices.coreinfrastructure.org/projects/5542)\n[![fair-software.eu](https://img.shields.io/badge/fair--software.eu-%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F%20%20%E2%97%8F-green)](https://fair-software.eu)\n[![DOI](https://joss.theoj.org/papers/10.21105/joss.04493/status.svg)](https://doi.org/10.21105/joss.04493)\n\n<img width=\"300\" alt=\"Logo_ER10\" src=\"https://user-images.githubusercontent.com/3244249/151994514-b584b984-a148-4ade-80ee-0f88b0aefa45.png\">\n\n<img align=\"left\" src=\"https://user-images.githubusercontent.com/55382553/153408200-36c4de2e-7865-4934-956d-09eefd893e6a.png\">\n\n# Deep Insight And Neural Network Analysis\n\nDIANNA is a Python package that brings explainable AI (XAI) to your research project. It wraps carefully selected XAI methods in a simple, uniform interface.\nIt's built by, with and for (academic) researchers and research software engineers working on machine learning projects.\n\n## Why DIANNA?\n\nDIANNA software is addressing needs of both (X)AI researchers 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: one of the very few XAI library supporting the [Open Neural Network Exchange (ONNX)](https://onnx.ai/) format.\n\nAfter studying the vast XAI landscape we have made choices in the parts of the [XAI Taxonomy](https://doi.org/10.3390/make3030032) on which methods, data modalities and problems types to focus. Our choices, based on the largest usage in scientific literature, are shown graphically in the XAI taxonomy below:\n\n<img src=\"https://github.com/dianna-ai/dianna/assets/3244249/9b864980-86f4-4d0e-8a83-af7d6be606f7\" alt=\"XAI_taxonomy\" width=\"80%\"/>\n\nThe key points of DIANNA:\n\n* Provides an easy-to-use interface for non (X)AI experts\n* Implements well-known XAI methods (LIME, RISE and Kernal SHAP) chosen by systematic and objective evaluation criteria\n* Supports the de-facto standard format for neural network models - ONNX.\n* Includes clear instructions for export/conversions from Tensorflow, Pytorch, Keras and scikit-learn to ONNX.\n* Supports images, text and time series data modalities. Tabular data and even embeddings support is planned.\n* Comes with simple intuitive image and text benchmarks\n* Easily extendable to other XAI methods\n\nFor more information on the unique strengths of DIANNA with comparison to other tools, please see the [context landscape](https://dianna.readthedocs.io/en/latest/CONTEXT.html).\n\n## Installation\n\n[![workflow pypi badge](https://img.shields.io/pypi/v/dianna.svg?colorB=blue)](https://pypi.python.org/project/dianna/)\n[![supported python versions](https://img.shields.io/pypi/pyversions/dianna)](https://pypi.python.org/project/dianna/)\n\nDIANNA can be installed from PyPI using [pip](https://pip.pypa.io/en/stable/installation/) on any of the supported Python versions (see badge):\n\n```console\npython3 -m pip install dianna\n```\n\nTo install the most recent development version directly from the GitHub repository run:\n\n```console\npython3 -m pip install git+https://github.com/dianna-ai/dianna.git\n```\n\nIf you get an error related to OpenMP when importing dianna, have a look at [this issue](https://github.com/dianna-ai/dianna/issues/376) for possible workarounds.\n\n### Pre-requisites only for Macbook Pro with M1 Pro chip users\n\n- To install TensorFlow you can follow this [tutorial](https://betterdatascience.com/install-tensorflow-2-7-on-macbook-pro-m1-pro/).\n- To install TensorFlow Addons you can follow these [steps](https://github.com/tensorflow/addons/pull/2504). For further reading see this [issue](https://github.com/tensorflow/addons/issues/2503). Note that this temporary solution works only for macOS versions >= 12.0. Note that this step may have changed already, see https://github.com/dianna-ai/dianna/issues/245.\n- Before installing DIANNA, comment `tensorflow` requirement in `setup.cfg` file (tensorflow package for M1 is called `tensorflow-macos`).\n\n## Getting started\n\nYou need:\n\n- your trained ONNX model ([convert my pytorch/tensorflow/keras/scikit-learn model to ONNX](https://github.com/dianna-ai/dianna#onnx-models))\n- 1 data item to be explained\n\n You get:\n\n- a relevance map overlayed over the data item\n\nIn the library's documentation, the general usage is explained in [How to use DIANNA](https://dianna.readthedocs.io/en/latest/usage.html)\n\n### Demo movie\n\n[![Watch the video on YouTube](https://img.youtube.com/vi/u9_c5DJewLU/default.jpg)](https://youtu.be/u9_c5DJewLU)\n\n### Text example:\n\n```python\nmodel_path = 'your_model.onnx'  # model trained on text\ntext = 'The movie started great but the ending is boring and unoriginal.'\n```\n\nWhich of your model's classes do you want an explanation for?\n\n```python\nlabels = [positive_class, negative_class]\n```\n\nRun using the XAI method of your choice, for example LIME:\n\n```python\nexplanation = dianna.explain_text(model_path, text, 'LIME')\ndianna.visualization.highlight_text(explanation[labels.index(positive_class)], text)\n```\n\n![image](https://user-images.githubusercontent.com/6087314/155532504-6f90f032-cbb4-4e71-9b99-aa9c0de4e86a.png)\n\n### Image example:\n\n```python\nmodel_path = 'your_model.onnx'  # model trained on images\nimage = PIL.Image.open('your_image.jpeg')\n```\n\nTell us what label refers to the channels, or colors, in the image.\n\n```python\naxis_labels = {0: 'channels'}\n```\n\nWhich of your model's classes do you want an explanation for?\n\n```python\nlabels = [class_a, class_b]\n```\n\nRun using the XAI method of your choice, for example RISE:\n\n```python\nexplanation = dianna.explain_image(model_path, image, 'RISE', axis_labels=axis_labels, labels=labels)\ndianna.visualization.plot_image(explanation[labels.index(class_a)], original_data=image)\n```\n\n![image](https://user-images.githubusercontent.com/6087314/155557077-e2052094-d8ac-49d3-a840-0160256d53a6.png)\n\n### Time-series example:\n\n```python\nmodel_path = 'your_model.onnx'  # model trained on images\ntimeseries_instance = pd.read_csv('your_data_instance.csv').astype(float)\n\nnum_features = len(timeseries_instance)  # The number of features to include in the explanation.\nnum_samples = 500  # The number of samples to generate for the LIME explainer.\n```\n\nWhich of your model's classes do you want an explanation for?\n\n```python\nclass_names= [class_a, class_b] # String representation of the different classes of interest\nlabels = np.argsort(class_names) # Numerical representation of the different classes of interest for the model\n```\n\nRun using the XAI method of your choice, for example LIME with the following additional arguments:\n\n```python\nexplanation = dianna.explain_timeseries(model_path, timeseries_data=timeseries_instance , method='LIME', \n\t\t\t\t\tlabels=labels, class_names=class_names, num_features=num_features,\n                                \tnum_samples=num_samples, distance_method='cosine')\n\n```\n\nFor visualization of the heatmap please refer to the [tutorial](https://github.com/dianna-ai/dianna/blob/main/tutorials/explainers/LIME/lime_timeseries_coffee.ipynb)\n\n### Tabular example:\n\n```python\nmodel_path = 'your_model.onnx'  # model trained on tabular data\ntabular_instance = pd.read_csv('your_data_instance.csv')\n```\n\nRun using the XAI method of your choice. Note that you need to specify the mode, either regression or classification. This case, for instance a regression task using KernelSHAP with the following additional arguments:\n\n```python\nexplanation = dianna.explain_tabular(run_model, input_tabular=data_instance, method='kernelshap',\n                                     mode ='regression', training_data = X_train,\n                                     training_data_kmeans = 5, feature_names=input_features.columns)\nplot_tabular(explanation, X_test.columns, num_features=10)  # display 10 most salient features\n```\n\n![image](https://github.com/dianna-ai/dianna/assets/25911757/ce0b76b8-f00c-468a-9732-c21704e289f6)\n\n### IMPORTANT: Sensitivity to hyperparameters\nThe XAI methods (explainers) are sensitive to the choice of their hyperparameters! In this [work](https://staff.fnwi.uva.nl/a.s.z.belloum/MSctheses/MScthesis_Willem_van_der_Spec.pdf), this sensitivity to hyperparameters is researched and useful conclusions are drawn.\nThe default hyperparameters used in DIANNA for each explainer as well as the values for our tutorial examples are given in the Tutorials [README](./tutorials/README.md#important-hyperparameters).\n\n## Dashboard\n\nExplore the explanations of your trained model using the DIANNA dashboard (for now images, text and time series classification is supported). \n[Click here](https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard) for more information.\n\n<a href=\"https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard\" target=\"_blank\">\n  <img width=\"1000\" align=\"center\" alt=\"Dianna dashboard screenshot\" src=\"https://raw.githubusercontent.com/dianna-ai/dianna/main/dianna/dashboard/dashboard-screenshot.png\">\n</a>\n\n## Datasets\n\nDIANNA 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.\n\n### Images\n\n| Dataset                                                                                                                                                                                                                                     | Description                                                                                                                                                                 | Examples                                                                                                                                               | Generation                                                                                                                                             |\n| :------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- | :----------------------------------------------------------------------------------------------------------------------------------------------------- |\n| Binary MNIST <img width=\"25\" alt=\"mnist_zero_and_one_half_size\" src=\"https://user-images.githubusercontent.com/3244249/152354583-d7b68902-d402-4098-922b-b1a33b07e3e1.png\">                                                             | Greyscale images of the digits \"1\" and \"0\" - a 2-class subset from the famous[MNIST dataset](http://yann.lecun.com/exdb/mnist/) for handwritten digit classification.          | <img width=\"120\" alt=\"BinaryMNIST\" src=\"https://user-images.githubusercontent.com/3244249/150808267-3d27eae0-78f2-45f8-8569-cb2561f2c2e9.png\">     | [Binary MNIST dataset generation](https://github.com/dianna-ai/dianna-exploration/tree/main/example_data/dataset_preparation/MNIST)                       |\n| [Simple Geometric (circles and triangles)](https://doi.org/10.5281/zenodo.5012824) <img width=\"20\" alt=\"Simple Geometric Logo\" src=\"https://user-images.githubusercontent.com/3244249/150808842-d35d741e-294a-4ede-bbe9-58e859483589.png\"> | 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. | <img width=\"130\" alt=\"SimpleGeometric\" src=\"https://user-images.githubusercontent.com/3244249/150808125-e1576237-47fa-4e51-b01e-180904b7c7f6.png\"> | [Simple geometric shapes dataset generation](https://github.com/dianna-ai/dianna-exploration/tree/main/example_data/dataset_preparation/geometric_shapes) |\n| [Simple Scientific (LeafSnap30)](https://zenodo.org/record/5061353/) <img width=\"20\" alt=\"LeafSnap30 Logo\" src=\"https://user-images.githubusercontent.com/3244249/150815639-2da560d4-8b26-4eeb-9ab4-dabf221a264a.png\">                      | Color images of tree leaves - a 30-class post-processed subset from the LeafSnap dataset for automatic identification of North American tree species.                       | <img width=\"600\" alt=\"LeafSnap\" src=\"https://user-images.githubusercontent.com/3244249/150804246-f714e517-641d-48b2-af26-2f04166870d6.png\">        | [LeafSnap30 dataset generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/dataset_preparation/LeafSnap/)                     |\n\n### Text\n\n| Dataset                                                                                                                                                                                                                            | Description                                                                   | Examples                                                         | Generation                                                          |\n| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :---------------------------------------------------------------------------- | :--------------------------------------------------------------- | :------------------------------------------------------------------ |\n| [Stanford sentiment treebank](https://nlp.stanford.edu/sentiment/index.html) <img width=\"20\" alt=\"nlp-logo_half_size\" src=\"https://user-images.githubusercontent.com/3244249/152355020-908c04f3-aa99-489d-b87a-7e6b1f586118.png\"> | Dataset for predicting the sentiment, positive or negative, of movie reviews. | _This movie was actually neither that funny, nor super witty._ | [Sentiment treebank](https://nlp.stanford.edu/sentiment/treebank.html) |\n\n### Time series\n\n| Dataset                                                                                                                                                                                                                | Description                                                                                                                                                    | Examples                                                                                                                                 | Generation                                                                |\n| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |\n| [Coffee dataset](https://timeseriesclassification.com/description.php?Dataset=Coffee) <img width=\"25\" alt=\"Coffe Logo\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/9ab50a0f-5da3-41d2-80e9-70d2c8769162\"> | Food spectographs time series dataset for a two class problem to distinguish between Robusta and Arabica coffee beans.                                         | <img width=\"500\" alt=\"example image\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/763002c5-40ad-48cc-9de0-ea43d7fa8a75)\"> | [data source](https://github.com/QIBChemometrics/Benchtop-NMR-Coffee-Survey) |\n| [Weather dataset](https://zenodo.org/record/7525955) <img width=\"25\" alt=\"Weather Logo\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/3ff3d639-ed2f-4a38-b7ac-957c984bce9f\">                                | The light version of the weather prediciton dataset, which contains daily observations (89 features) for 11 European locations through the years 2000 to 2010. | <img width=\"500\" alt=\"example image\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/b0a505ac-8a6c-4e1c-b6ad-35e31e52f46d)\"> | [data source](https://github.com/florian-huber/weather_prediction_dataset)   |\n\n### Tabular \n\n| Dataset                                                                                                                                                                                                                | Description                                                                                                                                                    | Examples                                                                                                                                 | Generation                                                                |\n| :--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------------------------------------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------- | :------------------------------------------------------------------------ |\n| [Pengiun dataset](https://www.kaggle.com/code/parulpandey/penguin-dataset-the-new-iris) <img width=\"75\" alt=\"Penguins Logo\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/c7716ad3-f992-4557-80d9-1d8178c7ed57)\"> | Palmer Archipelago (Antarctica) penguin dataset is a great intro dataset for data exploration & visualization similar to the famous Iris dataset.                                         | <img width=\"500\" alt=\"example image\" src=\"https://github.com/allisonhorst/palmerpenguins/blob/main/man/figures/README-mass-flipper-1.png\"> | [data source](https://github.com/allisonhorst/palmerpenguins) |\n| [Weather dataset](https://zenodo.org/record/7525955) <img width=\"25\" alt=\"Weather Logo\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/3ff3d639-ed2f-4a38-b7ac-957c984bce9f\">                                | The light version of the weather prediciton dataset, which contains daily observations (89 features) for 11 European locations through the years 2000 to 2010. | <img width=\"500\" alt=\"example image\" src=\"https://github.com/dianna-ai/dianna/assets/3244249/b0a505ac-8a6c-4e1c-b6ad-35e31e52f46d)\"> | [data source](https://github.com/florian-huber/weather_prediction_dataset)   |\n\n## ONNX models\n\n<!-- TODO: Add all links, see issue https://github.com/dianna-ai/dianna/issues/135 -->\n\n**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:\n\n* [pytorch and pytorch-lightning](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/pytorch2onnx.ipynb) - use the built-in [`torch.onnx.export`](https://pytorch.org/docs/stable/onnx.html) function to convert pytorch models to onnx, or call the built-in [`to_onnx`](https://pytorch-lightning.readthedocs.io/en/latest/deploy/production_advanced.html) function on your [`LightningModule`](https://lightning.ai/docs/pytorch/latest/api/lightning.pytorch.core.LightningModule.html#lightning.pytorch.core.LightningModule) to export pytorch-lightning models to onnx.\n* [tensorflow](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/tensorflow2onnx.ipynb) - use the [`tf2onnx`](https://github.com/onnx/tensorflow-onnx) package to convert tensorflow models to onnx.\n* [keras](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/keras2onnx.ipynb) - same as the conversion from tensorflow to onnx, the [`tf2onnx`](https://github.com/onnx/tensorflow-onnx) package also supports keras.\n* [scikit-learn](https://github.com/dianna-ai/dianna/blob/main/tutorials/conversion_onnx/skl2onnx.ipynb) - use the [`skl2onnx`](https://github.com/onnx/sklearn-onnx) package to scikit-learn models to onnx.\n\nMore converters with examples and tutorials can be found on the [ONNX tutorial page](https://github.com/onnx/tutorials).\n\nAnd here are links to notebooks showing how we created our models on the benchmark datasets:\n\n### Images\n\n| Models                                                    | Generation                                                                                                                                                             |\n| :-------------------------------------------------------- | :--------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Binary MNIST model](https://zenodo.org/record/5907177)      | [Binary MNIST model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/MNIST/generate_model_binary.ipynb)                |\n| [Simple Geometric model](https://zenodo.org/deposit/5907059) | [Simple geometric shapes model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/geometric_shapes/generate_model.ipynb) |\n| [Simple Scientific model](https://zenodo.org/record/5907196) | [LeafSnap30 model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/LeafSnap/generate_model.ipynb)                      |\n\n### Text\n\n| Models                                                | Generation                                                                                                                                                              |\n| :---------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Movie reviews model](https://zenodo.org/record/5910598) | [Stanford sentiment treebank model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/movie_reviews/generate_model.ipynb) |\n\n### Time series\n\n| Models                                                    | Generation                                                                                                                                                        |\n| :-------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Coffee model](https://zenodo.org/records/10579458)                          | [Coffee model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/coffee/generate_model.ipynb)                       |\n| [Season prediction model](https://zenodo.org/record/7543883)                 | [Season prediction model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/season_prediction/generate_model.ipynb) |\n| [Fast Radio Burst classification model](https://zenodo.org/records/10656614) | [Fast Radio Burst classification model generation](https://doi.org/10.3847/1538-3881/aae649) |\n\n### Tabular\n\n| Models                                                    | Generation                                                                                                                                                        |\n| :-------------------------------------------------------- | :---------------------------------------------------------------------------------------------------------------------------------------------------------------- |\n| [Penguin model    (classification)](https://zenodo.org/records/10580743)                         | [Penguin model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/penguin_species/generate_model.ipynb)                       |\n| [Sunshine hours prediction model (regression)](https://zenodo.org/records/10580833) | [Sunshine hours prediction model generation](https://github.com/dianna-ai/dianna-exploration/blob/main/example_data/model_generation/sunshine_prediction/generate_model.ipynb) |\n\n\n**_We envision the birth of the ONNX Scientific models zoo soon..._**\n\n## Tutorials\n\nDIANNA supports different data modalities and XAI methods (explainers). We have evaluated many explainers using objective criteria (see the [How to find your AI explainer](https://blog.esciencecenter.nl/how-to-find-your-artificial-intelligence-explainer-dbb1ac608009) blog-post). The table below contains links to the relevant XAI method's papers (for some explanatory videos on the methods, please see [tutorials](./tutorials)). The DIANNA [tutorials](./tutorials) cover each supported method and data modality on a least one dataset using the default or tuned [hyperparameters](./tutorials/README.md#important-hyperparameters). Our plans to expand DIANNA with more data modalities and explainers are given in the [ROADMAP](https://dianna.readthedocs.io/en/latest/ROADMAP.html).\n\n<!-- see issue: https://github.com/dianna-ai/dianna/issues/142, also related issue: https://github.com/dianna-ai/dianna/issues/148 -->\n\n| Data \\ XAI | [RISE](http://bmvc2018.org/contents/papers/1064.pdf) | [LIME](https://www.kdd.org/kdd2016/papers/files/rfp0573-ribeiroA.pdf) | [KernelSHAP](https://proceedings.neurips.cc/paper/2017/file/8a20a8621978632d76c43dfd28b67767-Paper.pdf) |\n| :--------- | :------------------------------------------------ | :----------------------------------------------------------------- | :--------------------------------------------------------------------------------------------------- |\n| Images     | \u2705                                                | \u2705                                                                 | \u2705                                                                                                   |\n| Text       | \u2705                                                | \u2705                                                                 |                                                                                                      |\n| Timeseries | \u2705                                                | \u2705                                                                 |                                                                                                                                                                       |\n| Tabular    | planned                                           | \u2705                                                            | \u2705                                                                                              |\n| Embedding  | planned                                           | planned                                                            | planned   \n| Graphs*    | work in progress                                  | work in progress                                                   | work in progress                                                                                     |\n\n[LRP](https://journals.plos.org/plosone/article/file?id=10.1371/journal.pone.0130140&type=printable) and [PatternAttribution](https://arxiv.org/pdf/1705.05598.pdf) also feature in the top 5 of our thoroughly evaluated explainers. **Contributing by adding these and more (new) post-hoc explainability methods on ONNX models is very welcome!**\n\n## Reference documentation\n\nFor detailed information on using specific DIANNA functions, please visit the [documentation page hosted at Readthedocs](https://dianna.readthedocs.io/en/latest).\n\n## Contributing\n\nIf you want to contribute to the development of DIANNA,\nhave a look at the [contribution guidelines](https://dianna.readthedocs.io/en/latest/CONTRIBUTING.html).\nSee our [developer documentation](docs/developer_info.rst) for information on developer installation, running tests, generating documentation, versioning and making a release.\n\n## How to cite us\n\n[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5592606.svg)](https://zenodo.org/record/5592606)\n[![RSD](https://img.shields.io/badge/rsd-dianna-00a3e3.svg)](https://www.research-software.nl/software/dianna)\n\nIf you use this package for your scientific work, please consider citing directly the software as:\n\n    Ranguelova, E., Bos, P., Liu, Y., Meijer, C., Oostrum, L., Crocioni, G., Ootes, L., Chandramouli, P., Jansen, A., Smeets, S. (2023). dianna (*[VERSION YOU USED]*). Zenodo. https://zenodo.org/record/5592606\n\nor the JOSS paper as:\n\n    Ranguelova et al., (2022). DIANNA: Deep Insight And Neural Network Analysis. Journal of Open Source Software, 7(80), 4493, https://doi.org/10.21105/joss.04493\n\nSee also the [Zenodo page](https://zenodo.org/record/5592606) or the [JOSS page](https://joss.theoj.org/papers/10.21105/joss.04493) for exporting the software citation to BibTteX and other formats.\n\n## Credits\n\nThis package was created with [Cookiecutter](https://github.com/audreyr/cookiecutter) and the [NLeSC/python-template](https://github.com/NLeSC/python-template).\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Deep Insight And Neural Network Analysis",
    "version": "1.5.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/dianna-ai/dianna/issues",
        "Homepage": "https://github.com/dianna-ai/dianna"
    },
    "split_keywords": [
        "xai",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "9282cf38f186ff5c151a5cdbaec36434fe2fdffbe2e61d36f81fc680ba330bcc",
                "md5": "14506483e99c3b31b94ce7fbcb968f32",
                "sha256": "58e76832a5b04022e6b1fd808e63133db37a4e67ef7f6ac316eafccdea01f59e"
            },
            "downloads": -1,
            "filename": "dianna-1.5.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "14506483e99c3b31b94ce7fbcb968f32",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.12,>=3.8",
            "size": 15980695,
            "upload_time": "2024-04-10T15:49:18",
            "upload_time_iso_8601": "2024-04-10T15:49:18.603735Z",
            "url": "https://files.pythonhosted.org/packages/92/82/cf38f186ff5c151a5cdbaec36434fe2fdffbe2e61d36f81fc680ba330bcc/dianna-1.5.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ef733842a77b98fa39ea19c1ba90696ab73e760753bd918f1d2cd81981106127",
                "md5": "c36cfa008e97c9d1e57a99e33a6ed530",
                "sha256": "e7937e6239f294a6947c8fcebea6d452598abab80080ab5e86422f3c326fe15d"
            },
            "downloads": -1,
            "filename": "dianna-1.5.0.tar.gz",
            "has_sig": false,
            "md5_digest": "c36cfa008e97c9d1e57a99e33a6ed530",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<3.12,>=3.8",
            "size": 15984215,
            "upload_time": "2024-04-10T15:49:22",
            "upload_time_iso_8601": "2024-04-10T15:49:22.072813Z",
            "url": "https://files.pythonhosted.org/packages/ef/73/3842a77b98fa39ea19c1ba90696ab73e760753bd918f1d2cd81981106127/dianna-1.5.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-04-10 15:49:22",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "dianna-ai",
    "github_project": "dianna",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "dianna"
}
        
Elapsed time: 0.22813s