xaiographs


Namexaiographs JSON
Version 1.2.0 PyPI version JSON
download
home_pagehttps://github.com/Telefonica/XAIoGraphs
SummaryPython library providing Explainability & Fairness AI functionalities
upload_time2024-10-09 10:32:34
maintainerNone
docs_urlNone
authorTelefonica I+D
requires_python<3.10,>=3.7
licenseAGPL-3.0 license
keywords explainability fairness ia machine learning
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage
            # <img src="https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/icon.png?raw=True" align="left"/>  XAIoGraphs

![python versions](https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9-blue.svg)
[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)

XAIoGraphs (e**X**plainability **A**rticicial **I**ntelligence **o**ver **Graphs**) is an Explicability and Fairness 
Python library for classification problems with tabulated and discretized data.

The explainability methods in this library don't make any hypotheses about the data, so it does not require the AI model.
Simply need data and predictions (or decisions), being able to explain AI models, rule models, and reality.

<p align="center">
    <img src="https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/XAIoGraphs_schema.png?raw=True" width="800px" />
</p>

This library includes the following functionalities:

+ **Global Explainability**: Explains predictions or decisions as a whole, focusing on the variables that have the most influence.
+ **Local Explainability**: Explains the prediction of a single element.
+ **Reliability Measure** of local explainability.
+ **Reason Why:** *explanation in natural language* of the classification of each element.
+ **Fairness Scoring**: highlights potential discriminations in classifications based on sensitive features.

To understand or ***interpret the explanations*** uses ***XAIoWeb***, a ***web interface*** running in local mode (127.0.0.1:8080). 
It displays the explanations' outcomes in three sections: Global, Local and Fairness.

<p align="center">
    <img src="https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/XAIoWeb.png?raw=True" width="800px" />
</p>


# 🚀 Quickstart 

## 🔨 Installation XAIoGraphs

Create a virtual environment using conda for easier management of dependencies and packages. 
For installing conda, follow the instructions on the [official conda website](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)

```python
>> conda create --name xaio_env python=3.7
>> conda activate xaio_env
```

```{warning} 
Use a python version 3.7 or higher
```


**From PyPI repository** 
```python
>> pip install xaiographs
```


## 📝 Start with your first example

Use the following entry point to view an example run with the virtual environment enabled:

```python
>> titanic_example
```

Alternatively, you may run the code below to view a full implementation of all XAIoGraphs functionalities:

```python
from xaiographs import Explainer
from xaiographs import Why
from xaiographs import Fairness
from xaiographs.datasets import load_titanic_discretized, load_titanic_why

LANG = 'en'

# LOAD DATASETS & SEMANTICS
df_titanic, feature_cols, target_cols, y_true, y_predict = load_titanic_discretized()
df_values_semantics, df_target_values_semantics = load_titanic_why(language=LANG)

# EXPLAINER
explainer = Explainer(importance_engine='LIDE', verbose=1)
explainer.fit(df=df_titanic, feature_cols=feature_cols, target_cols=target_cols)

# WHY
why = Why(language=LANG,
          explainer=explainer,
          why_values_semantics=df_values_semantics,
          why_target_values_semantics=df_target_values_semantics,
          verbose=1)
why.fit()

# FAIRNESS
f = Fairness(verbose=1)
f.fit(df=df_titanic[feature_cols + [y_true] + [y_predict]],
      sensitive_cols=['gender', 'class', 'age'],
      target_col=y_true,
      predict_col=y_predict)
```

Following execution, a folder called "xaioweb files" is created, which contains a set of '.json' files that will 
be used to present the results in the XAIoWeb graphical interface.

## 📊 Launching XAIoWeb

XAIoWeb is a local web interface that displays the outcomes of the explanations in three sections: Global, Local, 
and Fairness. To launch the web (with the virtual environment enabled), run the following entry point:

```python
>> xaioweb -d xaioweb_files -o
```

This entry point takes the following parameters:

- `-d` o `--data` [REQUIRED]: JSON files path
- `-p` o `--port` [OPTIONAL]: Web server port. 8080 by default
- `-o` o `--open` [OPTIONAL]: Open web in browser
- `-f` o `--force` [OPTIONAL]: Force building the web from scratch, overwriting the existing one




# 🤝 Contributors

XAIoGraphs has been developed by ***Applied AI & Privacy*** team (Telefónica Innovación Digital - Chief Data Officer)

* [Ricardo Moya](https://www.linkedin.com/in/phdricardomoya/)
* [Matteo Salvatori](https://github.com/matteo-salvatori)
* [Enrique Fernandez](https://github.com/QuiqueFdez)
* [Alejandro Manuel Arranz](https://github.com/cx02747)
* [Manuel Martín](https://github.com/mmarmar)
* [Mario Villaizan](https://github.com/mvvmvv)
* [Cesar García](https://github.com/cesarggtid)
* [David Cadenas](https://github.com/davidcadi)
* [Alejandra Maria Alonso](https://www.linkedin.com/in/alejandraalonsodiaz/)
* [Miguel Angel Martín](https://github.com/mamj-telefonica)
* [Oriol Arnau](https://github.com/oarnau)
* [Morganne De Witte](https://github.com/MorganneDeWitte)


# 📥  Contact

Contact with [@Ricardo Moya](https://www.linkedin.com/in/phdricardomoya/)

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/Telefonica/XAIoGraphs",
    "name": "xaiographs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<3.10,>=3.7",
    "maintainer_email": null,
    "keywords": "explainability, fairness, IA, Machine Learning",
    "author": "Telefonica I+D",
    "author_email": "ricardo.moyagarcia@telefonica.com",
    "download_url": null,
    "platform": null,
    "description": "# <img src=\"https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/icon.png?raw=True\" align=\"left\"/>  XAIoGraphs\n\n![python versions](https://img.shields.io/badge/python-3.7%2C%203.8%2C%203.9-blue.svg)\n[![License: AGPL v3](https://img.shields.io/badge/License-AGPL_v3-blue.svg)](https://www.gnu.org/licenses/agpl-3.0)\n\nXAIoGraphs (e**X**plainability **A**rticicial **I**ntelligence **o**ver **Graphs**) is an Explicability and Fairness \nPython library for classification problems with tabulated and discretized data.\n\nThe explainability methods in this library don't make any hypotheses about the data, so it does not require the AI model.\nSimply need data and predictions (or decisions), being able to explain AI models, rule models, and reality.\n\n<p align=\"center\">\n    <img src=\"https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/XAIoGraphs_schema.png?raw=True\" width=\"800px\" />\n</p>\n\nThis library includes the following functionalities:\n\n+ **Global Explainability**: Explains predictions or decisions as a whole, focusing on the variables that have the most influence.\n+ **Local Explainability**: Explains the prediction of a single element.\n+ **Reliability Measure** of local explainability.\n+ **Reason Why:** *explanation in natural language* of the classification of each element.\n+ **Fairness Scoring**: highlights potential discriminations in classifications based on sensitive features.\n\nTo understand or ***interpret the explanations*** uses ***XAIoWeb***, a ***web interface*** running in local mode (127.0.0.1:8080). \nIt displays the explanations' outcomes in three sections: Global, Local and Fairness.\n\n<p align=\"center\">\n    <img src=\"https://github.com/Telefonica/XAIoGraphs/blob/master/docs/imgs/XAIoWeb.png?raw=True\" width=\"800px\" />\n</p>\n\n\n# \ud83d\ude80 Quickstart \n\n## \ud83d\udd28 Installation XAIoGraphs\n\nCreate a virtual environment using conda for easier management of dependencies and packages. \nFor installing conda, follow the instructions on the [official conda website](https://docs.conda.io/projects/conda/en/latest/user-guide/install/)\n\n```python\n>> conda create --name xaio_env python=3.7\n>> conda activate xaio_env\n```\n\n```{warning} \nUse a python version 3.7 or higher\n```\n\n\n**From PyPI repository** \n```python\n>> pip install xaiographs\n```\n\n\n## \ud83d\udcdd Start with your first example\n\nUse the following entry point to view an example run with the virtual environment enabled:\n\n```python\n>> titanic_example\n```\n\nAlternatively, you may run the code below to view a full implementation of all XAIoGraphs functionalities:\n\n```python\nfrom xaiographs import Explainer\nfrom xaiographs import Why\nfrom xaiographs import Fairness\nfrom xaiographs.datasets import load_titanic_discretized, load_titanic_why\n\nLANG = 'en'\n\n# LOAD DATASETS & SEMANTICS\ndf_titanic, feature_cols, target_cols, y_true, y_predict = load_titanic_discretized()\ndf_values_semantics, df_target_values_semantics = load_titanic_why(language=LANG)\n\n# EXPLAINER\nexplainer = Explainer(importance_engine='LIDE', verbose=1)\nexplainer.fit(df=df_titanic, feature_cols=feature_cols, target_cols=target_cols)\n\n# WHY\nwhy = Why(language=LANG,\n          explainer=explainer,\n          why_values_semantics=df_values_semantics,\n          why_target_values_semantics=df_target_values_semantics,\n          verbose=1)\nwhy.fit()\n\n# FAIRNESS\nf = Fairness(verbose=1)\nf.fit(df=df_titanic[feature_cols + [y_true] + [y_predict]],\n      sensitive_cols=['gender', 'class', 'age'],\n      target_col=y_true,\n      predict_col=y_predict)\n```\n\nFollowing execution, a folder called \"xaioweb files\" is created, which contains a set of '.json' files that will \nbe used to present the results in the XAIoWeb graphical interface.\n\n## \ud83d\udcca Launching XAIoWeb\n\nXAIoWeb is a local web interface that displays the outcomes of the explanations in three sections: Global, Local, \nand Fairness. To launch the web (with the virtual environment enabled), run the following entry point:\n\n```python\n>> xaioweb -d xaioweb_files -o\n```\n\nThis entry point takes the following parameters:\n\n- `-d` o `--data` [REQUIRED]: JSON files path\n- `-p` o `--port` [OPTIONAL]: Web server port. 8080 by default\n- `-o` o `--open` [OPTIONAL]: Open web in browser\n- `-f` o `--force` [OPTIONAL]: Force building the web from scratch, overwriting the existing one\n\n\n\n\n# \ud83e\udd1d Contributors\n\nXAIoGraphs has been developed by ***Applied AI & Privacy*** team (Telef\u00f3nica Innovaci\u00f3n Digital - Chief Data Officer)\n\n* [Ricardo Moya](https://www.linkedin.com/in/phdricardomoya/)\n* [Matteo Salvatori](https://github.com/matteo-salvatori)\n* [Enrique Fernandez](https://github.com/QuiqueFdez)\n* [Alejandro Manuel Arranz](https://github.com/cx02747)\n* [Manuel Mart\u00edn](https://github.com/mmarmar)\n* [Mario Villaizan](https://github.com/mvvmvv)\n* [Cesar Garc\u00eda](https://github.com/cesarggtid)\n* [David Cadenas](https://github.com/davidcadi)\n* [Alejandra Maria Alonso](https://www.linkedin.com/in/alejandraalonsodiaz/)\n* [Miguel Angel Mart\u00edn](https://github.com/mamj-telefonica)\n* [Oriol Arnau](https://github.com/oarnau)\n* [Morganne De Witte](https://github.com/MorganneDeWitte)\n\n\n# \ud83d\udce5  Contact\n\nContact with [@Ricardo Moya](https://www.linkedin.com/in/phdricardomoya/)\n",
    "bugtrack_url": null,
    "license": "AGPL-3.0 license",
    "summary": "Python library providing Explainability & Fairness AI functionalities",
    "version": "1.2.0",
    "project_urls": {
        "Homepage": "https://github.com/Telefonica/XAIoGraphs"
    },
    "split_keywords": [
        "explainability",
        " fairness",
        " ia",
        " machine learning"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a0a1837036f84a6d27fb6adf4b6913c0162a505a44efc286a5245ddbef6b2fa7",
                "md5": "cc306f5be7a676f97ad04ae43be5ee6e",
                "sha256": "8dbffd436ec3669a336481c9a75a47ab799de4b0d1fde1e9a524285c96164bcc"
            },
            "downloads": -1,
            "filename": "xaiographs-1.2.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc306f5be7a676f97ad04ae43be5ee6e",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<3.10,>=3.7",
            "size": 3853418,
            "upload_time": "2024-10-09T10:32:34",
            "upload_time_iso_8601": "2024-10-09T10:32:34.548305Z",
            "url": "https://files.pythonhosted.org/packages/a0/a1/837036f84a6d27fb6adf4b6913c0162a505a44efc286a5245ddbef6b2fa7/xaiographs-1.2.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-10-09 10:32:34",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "Telefonica",
    "github_project": "XAIoGraphs",
    "travis_ci": false,
    "coveralls": true,
    "github_actions": true,
    "requirements": [],
    "lcname": "xaiographs"
}
        
Elapsed time: 4.67027s