Skip to main content

Contextualizing model's decisions with natural language explanations.

Project description

Project description

DSConteXAI is a Python package developed as part of the Data Science Project Competition 2024.

It links local explainability methods with natural language explanations, allowing users to gain detailed insights into model predictions. By incorporating additional domain knowledge, users can obtain even more detailed insights into the model's predictions.

Install

DSConteXAI can be installed using pip:

pip install dscontexai

Generate XAI reports

Using this package, you can fully automatically develop your XAI reports. Currently, it supports SHAP values, which is a local feature importance measure, to which we added textual explanations and domain-related context.

SHAP values can be calculated for a variety of models, including the most popular ensemble models: XGBoost, CatBoost, and Random Forest. To use this tool with your dataset, you need to provide a configuration JSON file for a dataset, structured like the one below.

{
  # domain-based context
  "optimal_values": [
  ...
    [0, 6.5],               # HbA1c level optimal range is from 0 to 6.5
    [100, 140]              # Glucose level optimal range is from 100 to 140 
  ],
  "descriptions": {
    "below_optimal": [
      # Context for feature values falling below the optimal range
    ],
    "optimal": [
      # Context for feature values falling within the optimal range
    ],
    "above_optimal": [
      # Context for feature values falling above the optimal range
    ]
  },
  # Data transformations for feature mapping
  "transformation": {
    "0": ["Man", "Woman"],  # Transformation for Gender
    "1": [],                # No transformation for Age (numeric)
    "2": ["No", "Yes"],     # Transformation for Hypertension
    ...
  },
  "feature_names": [
    "Gender",
    "Age",
    "Hypertension",
    "Heart_disease",
    "Smoking_history",
    "BMI",
    "HbA1c_level",
    "Blood_glucose_level"
  ],
  # variables needed for structuring the description
  "target1": "diabetes",    # Target variable the model is predicting
  "target2": "Person",      # The object representing a sample in a data
  "supporting": ["does", "have"]  # Supporting verbs used in descriptions
}

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

dscontexai-1.0.0.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

dscontexai-1.0.0-py3-none-any.whl (16.8 kB view details)

Uploaded Python 3

File details

Details for the file dscontexai-1.0.0.tar.gz.

File metadata

  • Download URL: dscontexai-1.0.0.tar.gz
  • Upload date:
  • Size: 14.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for dscontexai-1.0.0.tar.gz
Algorithm Hash digest
SHA256 d5abc8c61de1bb270c4bffd1e395ee4a5cac71db9ed3a556a844d4f047dc4cf4
MD5 e4abd6dbe76f03edf7628d0376fc1ae4
BLAKE2b-256 9b4988285c59df4233d65538202fd4e8d24dea10056337aee02aa5eb29058b91

See more details on using hashes here.

File details

Details for the file dscontexai-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: dscontexai-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 16.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.0 CPython/3.8.10

File hashes

Hashes for dscontexai-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 527d5ce68845f6aba98009f6870c5588a2496c980f1bb990eb7ce901fbc5aba1
MD5 5f758ed93912bd7325e28709ba4a87a1
BLAKE2b-256 3dddb55a015e047daae261d05a90c2340ec7c3e079afc5da16c4e045953d9fd4

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