Add model card for ShapPFN
#1
by nielsr HF Staff - opened
README.md
CHANGED
|
@@ -1 +1,32 @@
|
|
| 1 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
pipeline_tag: other
|
| 3 |
+
---
|
| 4 |
+
|
| 5 |
+
# ShapPFN
|
| 6 |
+
|
| 7 |
+
ShapPFN is a foundation model for tabular data that integrates Shapley value regression directly into its architecture, producing both predictions and explanations in a single forward pass. On standard benchmarks, ShapPFN achieves competitive performance while producing high-fidelity explanations ($R^2 \approx 0.96$, cosine $\approx 0.99$) over 1000x faster than KernelSHAP.
|
| 8 |
+
|
| 9 |
+
- **Paper:** [Real-Time Explanations for Tabular Foundation Models](https://huggingface.co/papers/2603.29946)
|
| 10 |
+
- **GitHub Repository:** [kunumi/ShapPFN](https://github.com/kunumi/ShapPFN)
|
| 11 |
+
|
| 12 |
+
## Architecture
|
| 13 |
+
|
| 14 |
+
ShapPFN combines several key components:
|
| 15 |
+
- **PFN-style tabular transformers:** Uses alternating attention over rows and features (similar to TabPFN / nanoTabPFN).
|
| 16 |
+
- **Additive decomposition:** Separate decoder heads for `base` and per-feature contributions.
|
| 17 |
+
- **Shapley value regression:** Training explanations as part of the model output (ViaSHAP-style) rather than as a post-hoc procedure.
|
| 18 |
+
|
| 19 |
+
## Setup
|
| 20 |
+
|
| 21 |
+
To use the code and the model from the official repository, you can install it via:
|
| 22 |
+
|
| 23 |
+
```bash
|
| 24 |
+
pip install -e .
|
| 25 |
+
```
|
| 26 |
+
|
| 27 |
+
## Quickstart
|
| 28 |
+
|
| 29 |
+
The official repository provides scripts for various tasks:
|
| 30 |
+
- **Data Generation:** `bash scripts/generate_data.sh`
|
| 31 |
+
- **Training:** `bash scripts/train_shappfn.sh`
|
| 32 |
+
- **Evaluation:** `bash scripts/eval_openml.sh` (OpenML suite) and `bash scripts/eval_shap.sh` (KernelExplainer comparison)
|