debiai


Namedebiai JSON
Version 0.24.1 PyPI version JSON
download
home_pagehttps://github.com/debiai/py-debiai
SummaryDebiAI python module
upload_time2023-07-10 16:11:06
maintainer
docs_urlNone
authorIRT-SystemX
requires_python>=3.6
licenseApache 2.0
keywords debiai data vis ai bias
VCS
bugtrack_url
requirements numpy pandas requests
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # DebiAI Python module
[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)
[![PyPI](https://badge.fury.io/py/debiai.svg)](https://badge.fury.io/py/debiai)
![Build](https://github.com/debiai/py-debiai/actions/workflows/python-publish.yml/badge.svg)
![Test](https://github.com/debiai/py-debiai/actions/workflows/python-test.yml/badge.svg)
[![Downloads](https://static.pepy.tech/badge/debiai)](https://pepy.tech/project/debiai)
![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)

The DebiAI Python module is an interface with [DebiAI](https://debiai.irt-systemx.fr), you can use directly it in your Python project workflow to provide DebiAI with data.

## Web documentation
[DebiAI Python module](https://debiai.irt-systemx.fr/dataInsertion/pythonModule)

## Features :
- Basic:
  - Project creation
  - Project data insertion
  - Model metadata and model results insertion
- Advanced:
  - Selection made with the dashboard samples recovery
  - tf.dataset creation from the project selections (beta)

## Requirements:
* [A running DebiAI instance](https://debiai.irt-systemx.fr/debiai/gettingStarted/installation/)
* Numpy
* Pandas
* Eventually Tensorflow

## Installation

### With Pypi
```bash
pip install --upgrade debiai
```
### Manual installation
```bash
# Build
./build_package.sh

# Install
pip install build_package/*.tar.gz
```

## Quick start

```python
from debiai import debiai
import pandas as pd
import numpy as np

DEBIAI_URL = "http://localhost:3000/"
DEBIAI_PROJECT_NAME = "Hello DebiAI"

# Initialization
my_debiai = debiai.Debiai(DEBIAI_URL)

# Creating a project
debiai_project = my_debiai.create_project(DEBIAI_PROJECT_NAME)

# Creating the project block structure
block_structure = [
    {
        # The sample: an image with contexts, GDT and an ID
        "name": "Image ID",
        "contexts": [
            {"name": "My context 1",     "type": "text"},
            {"name": "My context 2",     "type": "number"}
        ],
        "groundTruth": [
            {"name": "My groundtruth 1", "type": "number"}
        ]
    }
]

# Each columns belongs to a category, but you can algo group with a optional "group" key
# The columns with the same group will be grouped in the dashboard

debiai_project.set_blockstructure(block_structure)


# ======== Adding the project samples ========
# Adding samples with a dataframe
samples_df = pd.DataFrame({
    "Image ID":         ["image-1", "image-2", "image-3"],
    "My context 1":     ["A", "B", "C"],
    "My context 2":     [0.28, 0.388, 0.5],
    "My groundtruth 1": [8, 7, 19],
})

debiai_project.add_samples_pd(samples_df)

# The project samples are ready to be analysed with the dashboard


# ===== Adding the project model results =====
# Setting the project models expected results
expected_results = [
    {"name": "Model result",     "type": "number"},
    {"name": "Model confidence", "type": "number"},
    {"name": "Model error",      "type": "text"},
]

debiai_project.set_expected_results(expected_results)

# Create the models
debiai_model_1 = debiai_project.create_model("Model 1")
debiai_model_2 = debiai_project.create_model("Model 2")

# Adding results with a numpy Array
results_np = np.array(
    [["Image ID", "Model result", "Model confidence", "Model error"],
     ["image-1", 3,  0.98, "yes"],
     ["image-2", 7,  0.97, "no"],
     ["image-3", 10, 0.8, "yes"]]
)

debiai_model_1.add_results_np(results_np)

# Adding results with a dataframe
results_df = pd.DataFrame({
    "Image ID": ["image-1", "image-2", "image-3"],
    "Model result": [5, 7, 19],
    "Model confidence": [0.22, 0.8, 0.9],
    "Model error": ["yes", "no", "no"],
})

debiai_model_2.add_results_df(results_df)

# The model results are ready to be analyzed with the Debiai dashboard
```
<img src="./images/quickstart_results.png">

## Limitations
- Nan or empty values are not supported at the moment.
- `/`, `.`, `:`, `?`, `*`, `\`, and `|`, are not supported in the project name and in the data/blocks ids.

> :warning: **If the data don't upload or don't load**: check that there is only string, number or boolean values (no Nan, objects or array values) in the data that you are uploading, and that there is no special character in the project name and the data ids.

---

<p align="center" style="display:flex; align-items:center; justify-content:space-around" >
  Developed by :
  <a href="https://www.irt-systemx.fr/" title="IRT SystemX">
   <img src="https://www.irt-systemx.fr/wp-content/uploads/2013/03/system-x-logo.jpeg"  height="70">
  </a>
  Integrated in :
  <a href="https://www.confiance.ai/" title="Conf AI">
   <img src="https://pbs.twimg.com/profile_images/1443838558549258264/EvWlv1Vq_400x400.jpg"  height="70">
  </a>
</p>

---

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/debiai/py-debiai",
    "name": "debiai",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.6",
    "maintainer_email": "",
    "keywords": "DebiAI,Data vis,AI,Bias",
    "author": "IRT-SystemX",
    "author_email": "debiai@irt-systemx.fr",
    "download_url": "https://files.pythonhosted.org/packages/b5/4e/b52af06d4e412e06ae00c1c2d8cc5037b8930f39e926156e06b1e70b9cea/debiai-0.24.1.tar.gz",
    "platform": null,
    "description": "# DebiAI Python module\n[![License](https://img.shields.io/badge/License-Apache_2.0-blue.svg)](https://opensource.org/licenses/Apache-2.0)\n[![PyPI](https://badge.fury.io/py/debiai.svg)](https://badge.fury.io/py/debiai)\n![Build](https://github.com/debiai/py-debiai/actions/workflows/python-publish.yml/badge.svg)\n![Test](https://github.com/debiai/py-debiai/actions/workflows/python-test.yml/badge.svg)\n[![Downloads](https://static.pepy.tech/badge/debiai)](https://pepy.tech/project/debiai)\n![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)\n\nThe DebiAI Python module is an interface with [DebiAI](https://debiai.irt-systemx.fr), you can use directly it in your Python project workflow to provide DebiAI with data.\n\n## Web documentation\n[DebiAI Python module](https://debiai.irt-systemx.fr/dataInsertion/pythonModule)\n\n## Features :\n- Basic:\n  - Project creation\n  - Project data insertion\n  - Model metadata and model results insertion\n- Advanced:\n  - Selection made with the dashboard samples recovery\n  - tf.dataset creation from the project selections (beta)\n\n## Requirements:\n* [A running DebiAI instance](https://debiai.irt-systemx.fr/debiai/gettingStarted/installation/)\n* Numpy\n* Pandas\n* Eventually Tensorflow\n\n## Installation\n\n### With Pypi\n```bash\npip install --upgrade debiai\n```\n### Manual installation\n```bash\n# Build\n./build_package.sh\n\n# Install\npip install build_package/*.tar.gz\n```\n\n## Quick start\n\n```python\nfrom debiai import debiai\nimport pandas as pd\nimport numpy as np\n\nDEBIAI_URL = \"http://localhost:3000/\"\nDEBIAI_PROJECT_NAME = \"Hello DebiAI\"\n\n# Initialization\nmy_debiai = debiai.Debiai(DEBIAI_URL)\n\n# Creating a project\ndebiai_project = my_debiai.create_project(DEBIAI_PROJECT_NAME)\n\n# Creating the project block structure\nblock_structure = [\n    {\n        # The sample: an image with contexts, GDT and an ID\n        \"name\": \"Image ID\",\n        \"contexts\": [\n            {\"name\": \"My context 1\",     \"type\": \"text\"},\n            {\"name\": \"My context 2\",     \"type\": \"number\"}\n        ],\n        \"groundTruth\": [\n            {\"name\": \"My groundtruth 1\", \"type\": \"number\"}\n        ]\n    }\n]\n\n# Each columns belongs to a category, but you can algo group with a optional \"group\" key\n# The columns with the same group will be grouped in the dashboard\n\ndebiai_project.set_blockstructure(block_structure)\n\n\n#\u00a0======== Adding the project samples ========\n#\u00a0Adding samples with a dataframe\nsamples_df = pd.DataFrame({\n    \"Image ID\":         [\"image-1\", \"image-2\", \"image-3\"],\n    \"My context 1\":     [\"A\", \"B\", \"C\"],\n    \"My context 2\":     [0.28, 0.388, 0.5],\n    \"My groundtruth 1\": [8, 7, 19],\n})\n\ndebiai_project.add_samples_pd(samples_df)\n\n# The project samples are ready to be analysed with the dashboard\n\n\n#\u00a0===== Adding the project model results =====\n#\u00a0Setting the project models expected results\nexpected_results = [\n    {\"name\": \"Model result\",     \"type\": \"number\"},\n    {\"name\": \"Model confidence\", \"type\": \"number\"},\n    {\"name\": \"Model error\",      \"type\": \"text\"},\n]\n\ndebiai_project.set_expected_results(expected_results)\n\n# Create the models\ndebiai_model_1 = debiai_project.create_model(\"Model 1\")\ndebiai_model_2 = debiai_project.create_model(\"Model 2\")\n\n# Adding results with a numpy Array\nresults_np = np.array(\n    [[\"Image ID\", \"Model result\", \"Model confidence\", \"Model error\"],\n     [\"image-1\", 3,  0.98, \"yes\"],\n     [\"image-2\", 7,  0.97, \"no\"],\n     [\"image-3\", 10, 0.8, \"yes\"]]\n)\n\ndebiai_model_1.add_results_np(results_np)\n\n# Adding results with a dataframe\nresults_df = pd.DataFrame({\n    \"Image ID\": [\"image-1\", \"image-2\", \"image-3\"],\n    \"Model result\": [5, 7, 19],\n    \"Model confidence\": [0.22, 0.8, 0.9],\n    \"Model error\": [\"yes\", \"no\", \"no\"],\n})\n\ndebiai_model_2.add_results_df(results_df)\n\n# The model results are ready to be analyzed with the Debiai dashboard\n```\n<img src=\"./images/quickstart_results.png\">\n\n## Limitations\n- Nan or empty values are not supported at the moment.\n- `/`, `.`, `:`, `?`, `*`, `\\`, and `|`, are not supported in the project name and in the data/blocks ids.\n\n> :warning: **If the data don't upload or don't load**: check that there is only string, number or boolean values (no Nan, objects or array values) in the data that you are uploading, and that there is no special character in the project name and the data ids.\n\n---\n\n<p align=\"center\" style=\"display:flex; align-items:center; justify-content:space-around\" >\n  Developed by :\n  <a href=\"https://www.irt-systemx.fr/\" title=\"IRT SystemX\">\n   <img src=\"https://www.irt-systemx.fr/wp-content/uploads/2013/03/system-x-logo.jpeg\"  height=\"70\">\n  </a>\n  Integrated in :\n  <a href=\"https://www.confiance.ai/\" title=\"Conf AI\">\n   <img src=\"https://pbs.twimg.com/profile_images/1443838558549258264/EvWlv1Vq_400x400.jpg\"  height=\"70\">\n  </a>\n</p>\n\n---\n",
    "bugtrack_url": null,
    "license": "Apache 2.0",
    "summary": "DebiAI python module",
    "version": "0.24.1",
    "project_urls": {
        "Homepage": "https://github.com/debiai/py-debiai"
    },
    "split_keywords": [
        "debiai",
        "data vis",
        "ai",
        "bias"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b54eb52af06d4e412e06ae00c1c2d8cc5037b8930f39e926156e06b1e70b9cea",
                "md5": "697d595eb4d129c9d74d40c203e7d5b7",
                "sha256": "c0ea7173bc3a7a2ba0119650805814be9ac04363747101595c072497fb17b7d8"
            },
            "downloads": -1,
            "filename": "debiai-0.24.1.tar.gz",
            "has_sig": false,
            "md5_digest": "697d595eb4d129c9d74d40c203e7d5b7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.6",
            "size": 23377,
            "upload_time": "2023-07-10T16:11:06",
            "upload_time_iso_8601": "2023-07-10T16:11:06.123320Z",
            "url": "https://files.pythonhosted.org/packages/b5/4e/b52af06d4e412e06ae00c1c2d8cc5037b8930f39e926156e06b1e70b9cea/debiai-0.24.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-07-10 16:11:06",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "debiai",
    "github_project": "py-debiai",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "pandas",
            "specs": []
        },
        {
            "name": "requests",
            "specs": []
        }
    ],
    "lcname": "debiai"
}
        
Elapsed time: 0.08488s