Skip to content

Harrypatria/ExplainableAI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

19 Commits
 
 
 
 
 
 

Repository files navigation

🧠 Explainable AI with SHAP

GitHub stars GitHub forks Python Version License: MIT

🌟 Overview

Explainable AI (XAI) is a vital subfield of artificial intelligence that aims to make the inner workings of machine learning models understandable. This repository offers a beginner-friendly yet insightful introduction to SHAP (SHapley Additive exPlanations), one of the most powerful tools in the XAI toolbox.

We demonstrate how SHAP can be applied to interpret model predictions on an income prediction problem using Python, scikit-learn, and shap.


🚀 Quick Start

💻 Local Setup

# Clone the repository
git clone https://github.com/Harrypatria/ExplainableAI.git
cd ExplainableAI

# (Optional) Create and activate a virtual environment
python -m venv venv
source venv/bin/activate  # On Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

# Run the Jupyter notebook
jupyter notebook

✨ Key Features

  • 🔍 Intuitive XAI Breakdown: Covers model-specific, model-agnostic, and hybrid interpretability approaches.
  • 📈 Real Dataset: Demonstrates SHAP on an income prediction model with real-world features.
  • 🧮 SHAP Visualisations: Gain insights into local and global feature importance.
  • 🧠 Model Transparency: Learn how to build trust with stakeholders using interpretable ML.
  • 📚 Educational Focus: Suitable for both industry professionals and students.

📖 Table of Contents

  1. Introduction
  2. XAI Terminology and Classification
  3. SHAP Overview
  4. Income Prediction Example
  5. Installation and Dependencies
  6. Usage Instructions
  7. License
  8. Acknowledgements

📘 Summary

🔹 Introduction

As machine learning becomes more pervasive, understanding its predictions is critical. XAI allows data scientists to ensure transparency, fairness, and accountability. SHAP is especially useful for quantifying the contribution of each feature to individual predictions.

🔹 Terminology & Classification

  • Model-Specific Methods: Tailored to specific algorithms (e.g., decision trees).
  • Model-Agnostic Methods: Work with any model post-training (e.g., SHAP, LIME).
  • Hybrid Methods: Combine strengths of both approaches.

🔹 SHAP Overview

SHAP applies game theory (Shapley values) to explain predictions. It ensures consistency and local accuracy, making it a gold standard in interpretability. You’ll learn:

  • Feature importance
  • SHAP summary plots
  • Force plots for individual predictions

📊 Real-world Example: Income Prediction

Given features like age, education, and occupation, we train a model to predict individual income. SHAP is then used to:

  • Visualise global and local feature contributions
  • Explore individual predictions
  • Understand model behaviour

📦 Dependencies

  • Python 3.8+
  • scikit-learn
  • shap
  • pandas, numpy
  • matplotlib, seaborn, jupyter

📜 License

This project is licensed under the MIT License. See the LICENSE file for details.


🙏 Acknowledgements

  • SHAP by Scott Lundberg et al.
  • UCI Adult Income Dataset
  • Open-source contributors in XAI research

🌟 Support This Project

Follow me on GitHub: GitHub Follow Star this repository: GitHub Star Connect on LinkedIn: LinkedIn Follow

Click the buttons above to show your support!

About

Explainable AI

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors