Implementations of SHAP and LRP for AI model (tabular & classifier, respectively) explainability.
- Python 3.14.2
- See
requirements.txtfor full dependencies
# Create virtual environment
python -m venv xai_env
# Activate environment
# Windows:
xai_env\Scripts\activate
# macOS/Linux:
source xai_env/bin/activate
# Install dependencies
pip install -r requirements.txtReal estate price prediction with feature explanations.
Data Source: Unzip california Housing dataset included at SHAP/CaliforniaHousing.zip
folder structure should look like:
├── SHAP/
│ ├── real_estate_price_prediction_shap.py
│ └── CaliforniaHousing.zip
| └── CaliforniaHousing/
│ ├── cal_housing.data
│ ├── cal_housing.domain
cd SHAP
python real_estate_price_prediction_shap.pyBrain MRI tumor classification with pixel-level explanations.
Data Source: Download and Unzip training data from https://www.kaggle.com/datasets/sartajbhuvaji/brain-tumor-classification-mri
folder structure should look like:
├── LRP/
│ ├── buildmodel.py
│ ├── lrp_analysis.py
│ └── data/
│ └── brain_mri/
│ ├── Training/
│ │ ├── glioma_tumor/
│ │ ├── meningioma_tumor/
│ │ ├── no_tumor/
│ │ └── pituitary_tumor/
│ └── Testing/
│ ├── glioma_tumor/
│ ├── meningioma_tumor/
│ ├── no_tumor/
│ └── pituitary_tumor/
cd LRP
# Train model first
python buildmodel.py
# brain_mri_vgg16_finetuned.pth will be created
# Run analysis
python lrp_analysis.py "brain_mri/Testing/meningioma_tumor/image(43).jpg"