This repository contains code for evaluating concept locality in Concept Bottleneck Models (CBMs) applied to medical imaging. The goal is to assess whether learned concepts are faithfully grounded in the correct spatial regions of an image.
Concept locality is evaluated by analyzing whether model explanations rely on medically relevant regions or on spurious correlations. Failure to respect locality undermines the interpretability and trustworthiness of CBMs in clinical settings.
Python 3.10.18conda create -n conc python=3.10
conda activate conc
pip install -r requirements.txtuv pip install -r requirements.txt.
├── ConceptBottleneck/ # Concept Bottleneck implementation
├── datasets/ # Dataset Directory
├── models/ # Model Data Saved
├── src/ # Core implementation
├── scripts/ # Shell scripts to run experiments
├── misc/ # Miscellaneous utilities
├── results/ # Experiment results
├── requirements.txt # Python dependencies
├── LICENSE # License information
└── README.md # This file
All .sh files inside scripts/ directly invoke the corresponding Python experiments.
After cloning the repository:
pip install -e .This installs the package in editable mode using setup.py.
Datasets are not included in this repository, please refer to this link for more info
Set the dataset root directory in the code or scripts:
data_dir = "/DATA/arnav"Update this path to match your local setup before running experiments.
Activate the environment and run any script from the scripts/ directory:
bash scripts/<script_name>.shEach script executes a complete experiment pipeline using predefined configurations.
- All dependencies are pinned in
requirements.txt - Scripts are self-contained and reproducible given correct dataset paths
- Results depend only on configuration files and dataset location
- Experiment outputs are saved to
results/
This project is intended for academic and research use. See LICENSE for details.