Skip to main content

DebiAI python module

Project description

DebiAI Python module

Online documentation License PyPI Build Test Downloads

Code style: black Code style: flake8

The DebiAI Python module is an interface with DebiAI, you can use directly it in your Python project workflow to provide DebiAI with data.

Web documentation

DebiAI Python module

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:

Installation

With Pypi

pip install --upgrade debiai

Manual installation

# Build
./build_package.sh

# Install
pip install build_package/*.tar.gz

Quick start

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 analyzed 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

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.


Developed by : Integrated in :


Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

debiai-0.29.0.tar.gz (23.5 kB view details)

Uploaded Source

File details

Details for the file debiai-0.29.0.tar.gz.

File metadata

  • Download URL: debiai-0.29.0.tar.gz
  • Upload date:
  • Size: 23.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.19

File hashes

Hashes for debiai-0.29.0.tar.gz
Algorithm Hash digest
SHA256 bf19df6180eea704c5a3081b3ed64ebfdfb32f758c0628e4185c08790fdbff9c
MD5 7106eb02e34a82780587b1b7c2ad6a7b
BLAKE2b-256 2ae81e43b3313665f847c94f7888c52eb5f01ba80f073b44e0b8c00a59c6f46a

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page