From e3d548e5751c09035a72207a87f7aad88f80a3a5 Mon Sep 17 00:00:00 2001 From: Yang Date: Thu, 11 Jan 2024 11:00:47 +0100 Subject: [PATCH 1/3] Add tabular regression example to getting start in readme --- README.md | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d420ac2..2e032b91 100644 --- a/README.md +++ b/README.md @@ -176,7 +176,7 @@ dianna.visualization.plot_image(explanation[labels.index(class_a)], original_dat 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_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. ``` @@ -198,6 +198,22 @@ explanation = dianna.explain_timeseries(model_path, timeseries_data=timeseries_i For visualization of the heatmap please refer to the [tutorial](https://github.com/dianna-ai/dianna/blob/main/tutorials/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 +``` + ## Dashboard Explore your trained model explained using the DIANNA dashboard. [Click here](https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard) for more information. From be7c9d2aa4b7f82a49223a28b1e73790f50231c5 Mon Sep 17 00:00:00 2001 From: Yang Date: Thu, 11 Jan 2024 11:20:32 +0100 Subject: [PATCH 2/3] Add tabular saliency image --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index 2e032b91..a24c0701 100644 --- a/README.md +++ b/README.md @@ -214,6 +214,8 @@ explanation = dianna.explain_tabular(run_model, input_tabular=data_instance, met 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) + ## Dashboard Explore your trained model explained using the DIANNA dashboard. [Click here](https://github.com/dianna-ai/dianna/tree/main/dianna/dashboard) for more information. From 125eacd80759f8b3229551aba682046ecda35c21 Mon Sep 17 00:00:00 2001 From: Yang Date: Thu, 11 Jan 2024 12:11:30 +0100 Subject: [PATCH 3/3] fix broken badge for joss paper --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index a24c0701..728051f1 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ affiliations: [![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) - [![status](https://camo.githubusercontent.com/dcc6405df4084ef5aa1cdf0f13d7fc01e72c9e7c4ca907a68c95698cec85e75a/68747470733a2f2f6a6f73732e7468656f6a2e6f72672f7061706572732f66303539326331616563623337313165303638623538393730353838663138352f7374617475732e737667)](https://joss.theoj.org/papers/f0592c1aecb3711e068b58970588f185) +[![DOI](https://joss.theoj.org/papers/10.21105/joss.04493/status.svg)](https://doi.org/10.21105/joss.04493) Logo_ER10