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-0.0.13.tar.gz (14.2 kB view details)

Uploaded Source

Built Distribution

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: dscontexai-0.0.13.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-0.0.13.tar.gz
Algorithm Hash digest
SHA256 cb9b5f9c8dffa2b3578a0cd1ac658d2be4b501e2d6e3356d3fdda1033ef4e430
MD5 1342b4f766bccb3c236439b8d87c9ad1
BLAKE2b-256 e21bc9ac49942c8183d104144ac805a318d93334eeeb7ce81611744384072870

See more details on using hashes here.

File details

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

File metadata

  • Download URL: dscontexai-0.0.13-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-0.0.13-py3-none-any.whl
Algorithm Hash digest
SHA256 1e67f1d1cb228fdaa7451dd67a50a2552ccd6cefbb68afe2cef1ff7ea6d78a3e
MD5 213a5178451f5031b71dcdb296f03414
BLAKE2b-256 c6e5044db582e4f5c5a47bb09c8fb5a4b6215ee45b8c377673f19b8831ce0eb2

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