Update README.md
Browse files
README.md
CHANGED
|
@@ -1,8 +1,85 @@
|
|
| 1 |
---
|
| 2 |
-
license:
|
| 3 |
-
language:
|
| 4 |
-
- en
|
| 5 |
tags:
|
| 6 |
- Causal-Inference
|
| 7 |
- CausalPFN
|
| 8 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
+
license: other
|
|
|
|
|
|
|
| 3 |
tags:
|
| 4 |
- Causal-Inference
|
| 5 |
- CausalPFN
|
| 6 |
+
library_name: causalpfn
|
| 7 |
+
---
|
| 8 |
+
# CausalPFN Model
|
| 9 |
+
|
| 10 |
+
This repository contains the model weights for CausalPFN, a transformer-based in-context learning model for causal effect estimation.
|
| 11 |
+
|
| 12 |
+
## Model Description
|
| 13 |
+
|
| 14 |
+
CausalPFN is a pre-trained model for amortized causal effect estimation via in-context learning. It allows for accurate estimation of conditional average treatment effects (CATE) and average treatment effects (ATE) without requiring model retraining for each new dataset.
|
| 15 |
+
|
| 16 |
+
The model is based on a transformer architecture with:
|
| 17 |
+
- Long-context in-context learning
|
| 18 |
+
- Uncertainty quantification and calibration
|
| 19 |
+
|
| 20 |
+
## Requirements
|
| 21 |
+
|
| 22 |
+
- Python ≥ 3.10
|
| 23 |
+
- torch ≥ 2.5.1
|
| 24 |
+
- numpy ≥ 1.26.4
|
| 25 |
+
- tqdm ≥ 4.67.1
|
| 26 |
+
- faiss-cpu ≥ 1.9.0
|
| 27 |
+
- scikit-learn ≥ 1.5.2
|
| 28 |
+
|
| 29 |
+
## Installation
|
| 30 |
+
|
| 31 |
+
To use this model, install the CausalPFN library:
|
| 32 |
+
|
| 33 |
+
```bash
|
| 34 |
+
pip install causalpfn
|
| 35 |
+
```
|
| 36 |
+
|
| 37 |
+
## Usage
|
| 38 |
+
|
| 39 |
+
You can use this model with the CausalPFN library:
|
| 40 |
+
|
| 41 |
+
```python
|
| 42 |
+
import torch
|
| 43 |
+
from causalpfn import CATEEstimator, ATEEstimator
|
| 44 |
+
|
| 45 |
+
|
| 46 |
+
# Create a CATE estimator
|
| 47 |
+
causalpfn_cate = CATEEstimator(
|
| 48 |
+
device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
|
| 49 |
+
verbose=True,
|
| 50 |
+
)
|
| 51 |
+
|
| 52 |
+
# Fit the model on your data
|
| 53 |
+
# X_train: covariates, T_train: binary treatment, Y_train: observed outcome — from observational data
|
| 54 |
+
causalpfn_cate.fit(X_train, T_train, Y_train)
|
| 55 |
+
|
| 56 |
+
# Estimate CATE
|
| 57 |
+
cate_hat = causalpfn_cate.estimate_cate(X_test)
|
| 58 |
+
|
| 59 |
+
# Create an ATE estimator
|
| 60 |
+
causalpfn_ate = ATEEstimator(
|
| 61 |
+
device=torch.device("cuda" if torch.cuda.is_available() else "cpu"),
|
| 62 |
+
verbose=True,
|
| 63 |
+
)
|
| 64 |
+
|
| 65 |
+
# Fit and estimate ATE
|
| 66 |
+
causalpfn_ate.fit(X, T, Y)
|
| 67 |
+
ate_hat = causalpfn_ate.estimate_ate()
|
| 68 |
+
```
|
| 69 |
+
|
| 70 |
+
## Citations
|
| 71 |
+
|
| 72 |
+
If you use this model in your research, please cite:
|
| 73 |
+
|
| 74 |
+
```
|
| 75 |
+
@misc{causalpfn2025,
|
| 76 |
+
title={CausalPFN: Amortized Causal Effect Estimation via In-Context Learning},
|
| 77 |
+
author={Vahid Balazadeh and Hamidreza Kamkari and Valentin Thomas and Benson Li and Junwei Ma and Jesse C. Cresswell and Rahul G. Krishnan},
|
| 78 |
+
year={2025},
|
| 79 |
+
primaryClass={cs.LG},
|
| 80 |
+
}
|
| 81 |
+
```
|
| 82 |
+
|
| 83 |
+
## License
|
| 84 |
+
|
| 85 |
+
This model is licensed under a custom license. See the [LICENSE](https://github.com/vdblm/CausalPFN/blob/main/LICENSE) file for details.
|