Skip to main content

A comprehensive package for Explainable AI and model interpretation

Project description

ExplainableAI

ExplainableAI is a Python package that provides tools for creating interpretable machine learning models. It combines various explainable AI techniques with LLM-powered explanations to make model predictions more understandable for both technical and non-technical users.

Features

  • Automated Exploratory Data Analysis (EDA)
  • Model performance evaluation
  • Feature importance calculation
  • Feature interaction analysis
  • SHAP (SHapley Additive exPlanations) value calculation
  • Visualization of model insights
  • LLM-powered explanations of model results and individual predictions
  • Cross-validation
  • Easy-to-use interface for model fitting, analysis, and prediction

Installation

You can install explainableai using pip:

  pip install explainableai

Environment Variables

To run this project, you will need to add the following environment variables to your .env file

GEMINI_API_KEY

Usage/Examples

Here's a basic example of how to use ExplainableAI:

from explainableai import XAIWrapper
from sklearn.ensemble import RandomForestClassifier
import pandas as pd

# Load your dataset
df = pd.read_csv('your_dataset.csv')
X = df.drop(columns=['target_column'])
y = df['target_column']

# Perform EDA
XAIWrapper.perform_eda(df)

# Create and initialize your model
model = RandomForestClassifier(n_estimators=100, random_state=42)

# Create XAIWrapper instance
xai = XAIWrapper()

# Fit the model and run XAI analysis
xai.fit(model, X, y, feature_names=X.columns.tolist())
results = xai.analyze()

# Print LLM explanation of results
print(results['llm_explanation'])

# Make a prediction with explanation
new_data = {...}  # Dictionary of feature values
prediction, probabilities, explanation = xai.explain_prediction(new_data)
print(f"Prediction: {prediction}")
print(f"Probabilities: {probabilities}")
print(f"Explanation: {explanation}")

Contributing

Contributions are always welcome!

See contributing.md for ways to get started.

Please adhere to this project's code of conduct.

Run Locally

Clone the project

  git clone https://github.com/ombhojane/explainableai

Go to the project directory

  cd explainableai

Install dependencies

  pip install -r requirements.txt

Get Started with data.csv dataset or you can have any dataset

  python main.py [dataset] [Target_column]

Acknowledgements

  • This package uses various open-source libraries including scikit-learn, shap, and matplotlib.

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

explainableai-0.1.5.tar.gz (16.3 kB view details)

Uploaded Source

Built Distribution

explainableai-0.1.5-py3-none-any.whl (28.3 kB view details)

Uploaded Python 3

File details

Details for the file explainableai-0.1.5.tar.gz.

File metadata

  • Download URL: explainableai-0.1.5.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.11.6

File hashes

Hashes for explainableai-0.1.5.tar.gz
Algorithm Hash digest
SHA256 ff84cf95f6c398f52a1a8e540b0045a0ef81dcea87284d6250e9fc4a9602b755
MD5 1dc28bfdf5c6d8a414785aa5330ead52
BLAKE2b-256 1c168b0d7b78598d24bae1e4c8b91eb0ccd963e947edef6d5a4ac6a3aa945d30

See more details on using hashes here.

Provenance

File details

Details for the file explainableai-0.1.5-py3-none-any.whl.

File metadata

File hashes

Hashes for explainableai-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 a0b75bd24eaa6b461a2948627abce59b71f2fea724007b0ffe1a98153c538425
MD5 fc4763467799c8e369c39fdd9d6b2451
BLAKE2b-256 033d9c57513e4a09b72538ce791a67885ae80484a18d67b701794cd50bc8dfa4

See more details on using hashes here.

Provenance

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