https://github.com/mauroluzzatto/algorithmic-explanations
This project uses algorithms from Machine Learning Explainability to generate automated text explanations – Work in Progress
https://github.com/mauroluzzatto/algorithmic-explanations
explainy machine-learning-explainability
Last synced: 10 months ago
JSON representation
This project uses algorithms from Machine Learning Explainability to generate automated text explanations – Work in Progress
- Host: GitHub
- URL: https://github.com/mauroluzzatto/algorithmic-explanations
- Owner: MauroLuzzatto
- License: apache-2.0
- Created: 2021-06-21T19:46:32.000Z (almost 5 years ago)
- Default Branch: main
- Last Pushed: 2021-09-09T20:39:20.000Z (over 4 years ago)
- Last Synced: 2025-01-08T19:50:16.034Z (about 1 year ago)
- Topics: explainy, machine-learning-explainability
- Language: Python
- Homepage:
- Size: 394 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Algorithmic Explanations (WIP)
This project generates explanations of the trained machine learning model. The following steps are included:
- cleaning of data and encoding of the features
- training and tuning a machine learning model (XGBoost)
- generating explanations from four machine learning explainability algorithms with a unified API
- generating different textual and visual explanations for the trained model
## Getting Started
Download the github repository:
```bash
git clone https://github.com/MauroLuzzatto/algorithmic-explanations
```
create a local environement and install the python requirements:
```bash
pip install -r requirements.txt
```
## Machine Learning explanability methods
Method | Implemenation |Type | Scope | Option|
--- | --- | --- | --- | --- |
Permutation Feature Importance |`PermutationExplanation.py` | Non-contrastive | global | sparse and dense |
Shapley Values | `ShapleyExplanation.py` | Non-contrastive | local | sparse and dense |
Global Surrogate Model| `SurrogateModelExplanation.py`| Contrastive | global | sparse and dense |
Counterfactual Example| `CounterfactualExplanation.py`| Contrastive | local | sparse and dense |
## Explanations
### Permutation Feature Importance
Method:
> To help you understand this decision, here are the six features which were most important for how the mechanism made its decision in your specific case:
Features:
> In your case, the six features which contributed most to the mechanism’s decision were the features 'Number of extracurricular activities' with an average contribution of 0.41,
> 'Essay score' with an average contribution of 0.17, 'GPA' with an average contribution of 0.08, 'SAT' with an average contribution of 0.05, 'State of residence' with an average
> contribution of 0.04 and 'Number of activities with leadership experience' with an average contribution of 0.03.

### Shapley Values
Method:
> To help you understand this decision, here are the six features which were most important for how the mechanism made its decision in your specific case:
Features:
> In your case, the six features which contributed most to the mechanism’s decision were the features 'Number of extracurricular activities' with an average contribution of 0.53,
> 'Essay score' with an average contribution of -0.09, 'GPA' with an average contribution of 0.07, 'State of residence' with an average contribution of 0.06, 'SAT' with an average
> contribution of -0.05 and 'College rank - unknown' with an average contribution of -0.04.

### Counterfactual Example
Method:
> To help you understand this decision, here is an example of another, similar applicant where the mechanism would have decided differently:
Features:
> In your case, the mechanism would have awarded you the scholarship, if your 'Grade' was High School Senior (12), if your 'Favorite subjects' was not 'Physical Education (P.E.)',
> if your 'College rank' was not 'unknown', if your 'Favorite subjects' was Chemistry, if your 'Favorite subjects' was Literature and if your 'Favorite subjects' was History.

### Global Surrogate Model (Decision Tree)
Method:
> To help you understand this decision, here is a decision tree showing you how the mechanism made its decision:
Features:
> Applicants received an average score of 2.36 if the value of 'Number of extracurricular activities' is smaller or equal to 3.50 and > 'Number of extracurricular activities' is smaller or equal to 1.50.
> Applicants received an average score of 2.92 if the value of 'Number of extracurricular activities' is smaller or equal to 3.50 and > 'Number of extracurricular activities' is larger than 1.50.
> Applicants received an average score of 3.56 if the value of 'Number of extracurricular activities' is larger than 3.50 and 'SAT' is > smaller or equal to 1210.00.
> Applicants received an average score of 4.29 if the value of 'Number of extracurricular activities' is larger than 3.50 and 'SAT' is > larger than 1210.00.

## Authors
* **Mauro Luzzatto** - [Maurol](https://github.com/MauroLuzzatto)