File size: 10,128 Bytes
0ec2459
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b20104d
0ec2459
 
 
 
 
 
 
 
 
 
 
 
b20104d
 
 
 
0ec2459
 
 
 
 
 
b20104d
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
---
license: mit
tags:
  - medical-imaging
  - chest-x-ray
  - insurance-prediction
  - fairness
  - bias-detection
  - mimic-cxr
datasets:
  - mimic-cxr
---

# Insurance Paper β€” Pretrained Weights

Pretrained checkpoints for **"The Unawareness of AI Looking for Health Insurance Type from Normal Chest X-ray Images"**.

All models were trained with seed=123 on the MedGemma-refined subset of [MIMIC-CXR-JPG v2.0.0](https://physionet.org/content/mimic-cxr-jpg/2.0.0/) (`mimic-cxr-gemma`), which contains only normal CXRs filtered by MedGemma. Some baseline and subgroup experiments also include CheXpert checkpoints.

## Models

| Model | Tag in file/folder names | Architecture | File size |
|-------|--------------------------|--------------|-----------|
| DenseNet121 | `densenet` | DenseNetWithDoubleLinear / _addDemothen2 | ~59 MB |
| MedMamba | `mamba` | VSSM_DoubleLinear / VSSM_Double_addDemothen2 | ~115 MB |
| MedMamba-S (pretrained) | `mamba_pretrained`, `*_s_fix` folders | VSSM (small), initialised from `MedMamba_pretrained_weight/MedMamba_S_PneumoniaMNIST.pth` | ~146 MB |
| Swin Transformer V2 | `swinTF` | SwinTDoubleLinear / _addDemothen2 | ~218 MB |
| Swin Transformer (pretrained, Base) | `swinTFB`, `PretrainedB`, `pretrainedB` | SwinTDoubleLinear / _addDemothen2 | ~690 MB |

## Repository Structure

```
insurance_paper_weights/
β”œβ”€β”€ MedMamba_pretrained_weight/          # MedMamba initialisation weights
β”‚   └── MedMamba_PneumoniaMNIST.pth, MedMamba_S_PneumoniaMNIST.pth
β”‚
β”œβ”€β”€ exp0_medgemma/                       # Baselines (CheXpert / MIMIC)
β”‚   β”œβ”€β”€ MedGemma_CheXpert_{densenet,mamba,mamba_pretrained,swinTF,swinTF_pretrainedB}.pt
β”‚   └── MedGemma_MIMIC_{densenet_0228,mamba_0228,mamba_pretrained,swinTF_0228,swinTF_pretrainedB}.pt
β”‚
β”œβ”€β”€ exp0-2_medgemma/                     # Random init / perturbed labels
β”‚   β”œβ”€β”€ {densenet,mamba,mamba_pretrained,swinTF,swinTF_pretrained}_random.pt
β”‚   β”œβ”€β”€ {densenet,mamba_pretrained,swinTF_pretrained}_perturbed[_chexpert].pt
β”‚   └── {densenet,mamba_pretrained,swinTF_pretrained}_patientlevelperturbed[_chexpert].pt
β”‚
β”œβ”€β”€ exp1_medgemma/                       # Patch keep/remove β€” DenseNet
β”‚   β”œβ”€β”€ densenet_keep/    └── patch1.pt ... patch9.pt
β”‚   └── densenet_remove/  └── patch1.pt ... patch9.pt
β”‚
β”œβ”€β”€ exp1-1_medgemma_s_fix/               # Patch keep/remove β€” MedMamba-S (pretrained)
β”‚   β”œβ”€β”€ mamba_keep/       └── patch1.pt ... patch9.pt
β”‚   └── mamba_remove/     └── patch1.pt ... patch9.pt
β”‚
β”œβ”€β”€ exp1-2_medgemma/                     # Patch keep/remove β€” Swin Transformer
β”‚   β”œβ”€β”€ swinTF_keep/      └── patch1.pt ... patch9.pt
β”‚   β”œβ”€β”€ swinTF_remove/    └── patch1.pt ... patch9.pt
β”‚   β”œβ”€β”€ swinTFB_keep/     └── SwinTFB_patch1.pt ... SwinTFB_patch9.pt
β”‚   └── swinTFB_remove/   └── SwinTFB_patch1.pt ... SwinTFB_patch9.pt
β”‚
β”œβ”€β”€ exp2_medgemma_s_fix/                 # Resolution β€” MedMamba-S (pretrained)
β”‚   └── mamba_2.pt ... mamba_224.pt (8 files)
β”‚
β”œβ”€β”€ exp2-1_medgemma/                     # Resolution β€” DenseNet
β”‚   └── densenet_2.pt ... densenet_224.pt (8 files)
β”‚
β”œβ”€β”€ exp2-2_medgemma/                     # Resolution β€” Swin Transformer (pretrained Base)
β”‚   └── PretrainedSwinTFB_2.pt ... PretrainedSwinTFB_224.pt (8 files)
β”‚
β”œβ”€β”€ exp3_medgemma_s_fix/                 # Demographics β€” MedMamba-S (pretrained)
β”‚   └── sex.pt, age.pt, race.pt, sexage.pt, sexrace.pt, agerace.pt, sexagerace.pt
β”‚
β”œβ”€β”€ exp3-1_medgemma/                     # Demographics β€” DenseNet
β”‚   └── (same 7 files)
β”‚
β”œβ”€β”€ exp3-2_medgemma/                     # Demographics β€” Swin Transformer
β”‚   β”œβ”€β”€ {combo}.pt                       (7 files)
β”‚   └── {combo}_PretrainedB_swinTF.pt    (7 files)
β”‚
β”œβ”€β”€ exp4_medgemma_s_fix/                 # Frequency filtering β€” MedMamba-S (pretrained)
β”‚   β”œβ”€β”€ highpass/  └── 1Hz.pt ... 400Hz.pt
β”‚   └── lowpass/   └── 1Hz.pt ... 400Hz.pt
β”‚
β”œβ”€β”€ exp4-1_medgemma/                     # Frequency filtering β€” Swin Transformer
β”‚   β”œβ”€β”€ highpass/  └── {F}Hz.pt, {F}HighPass_PretrainedB_swinTF.pt
β”‚   └── lowpass/   └── {F}Hz.pt, {F}LowPass_PretrainedB_swinTF.pt
β”‚
β”œβ”€β”€ exp4-2_medgemma/                     # Frequency filtering β€” DenseNet
β”‚   β”œβ”€β”€ highpass/  └── 1Hz.pt ... 400Hz.pt
β”‚   └── lowpass/   └── 1Hz.pt ... 400Hz.pt
β”‚
└── exp5_medgemma/                       # Single-subgroup training
    └── Only{Female,Male,Old,White}_{model}[_CheXpert]/Only{...}_{model}[_CheXpert].pt
```

## Checkpoint Table

| Experiment | Description | Model(s) | Config | # Checkpoints | Path |
|------------|-------------|----------|--------|---------------|------|
| **exp0** | Baselines | DenseNet, MedMamba, MedMamba-S, SwinT, SwinT-B | 5 models x 2 datasets | 10 | `exp0_medgemma/MedGemma_{CheXpert,MIMIC}_{model}.pt` |
| **exp0-2** | Random init / perturbed labels | DenseNet, MedMamba, MedMamba-S, SwinT, SwinT-B | random, perturbed, patient-level perturbed (MIMIC + CheXpert) | 17 | `exp0-2_medgemma/{model}_{setting}.pt` |
| **exp1** | Patch keep/remove | DenseNet | 9 patches x 2 | 18 | `exp1_medgemma/densenet_{keep,remove}/patch{N}.pt` |
| **exp1-1** | Patch keep/remove | MedMamba-S | 9 patches x 2 | 18 | `exp1-1_medgemma_s_fix/mamba_{keep,remove}/patch{N}.pt` |
| **exp1-2** | Patch keep/remove | SwinT, SwinT-B | 9 patches x 2 x 2 models | 36 | `exp1-2_medgemma/{swinTF,swinTFB}_{keep,remove}/...` |
| **exp2** | Resolution | MedMamba-S | 8 resolutions | 8 | `exp2_medgemma_s_fix/mamba_{N}.pt` |
| **exp2-1** | Resolution | DenseNet | 8 resolutions | 8 | `exp2-1_medgemma/densenet_{N}.pt` |
| **exp2-2** | Resolution | SwinT-B | 8 resolutions | 8 | `exp2-2_medgemma/PretrainedSwinTFB_{N}.pt` |
| **exp3** | Demographics (addDemo) | MedMamba-S | 7 demo combos | 7 | `exp3_medgemma_s_fix/{combo}.pt` |
| **exp3-1** | Demographics (addDemo) | DenseNet | 7 demo combos | 7 | `exp3-1_medgemma/{combo}.pt` |
| **exp3-2** | Demographics (addDemo) | SwinT, SwinT-B | 7 demo combos x 2 | 14 | `exp3-2_medgemma/{combo}[_PretrainedB_swinTF].pt` |
| **exp4** | Freq filtering (HP+LP) | MedMamba-S | 8 freq x 2 | 16 | `exp4_medgemma_s_fix/{highpass,lowpass}/{F}Hz.pt` |
| **exp4-1** | Freq filtering (HP+LP) | SwinT, SwinT-B | 8 freq x 2 x 2 | 32 | `exp4-1_medgemma/{highpass,lowpass}/...` |
| **exp4-2** | Freq filtering (HP+LP) | DenseNet | 8 freq x 2 | 16 | `exp4-2_medgemma/{highpass,lowpass}/{F}Hz.pt` |
| **exp5** | Single-subgroup training | DenseNet, MedMamba, MedMamba-S, SwinT, SwinT-B | 4 subgroups x 5 models x 2 datasets | 40 | `exp5_medgemma/Only{Group}_{model}[_CheXpert]/...` |

**Total: 255 checkpoints** (+ 2 MedMamba initialisation weights in `MedMamba_pretrained_weight/`)

- **Demo combos** (exp3): `sex`, `age`, `race`, `sexage`, `sexrace`, `agerace`, `sexagerace`
- **Frequencies** (exp4): 1, 5, 10, 25, 50, 100, 200, 400 Hz
- **Resolutions** (exp2): 2, 4, 7, 14, 28, 56, 112, 224
- **Patches** (exp1): 1-9, corresponding to a 3x3 grid on 448x448 images (left-to-right, top-to-bottom)
- **Subgroups** (exp5): `OnlyFemale`, `OnlyMale`, `OnlyOld`, `OnlyWhite`

## Usage

### Download all weights

```bash
git lfs install
git clone https://huggingface.co/InsurancePrediction/insurance_paper_weights
```

### Download a single experiment

```python
from huggingface_hub import snapshot_download
snapshot_download(
    repo_id="InsurancePrediction/insurance_paper_weights",
    allow_patterns="exp3-1_medgemma/*",
    local_dir="./weights"
)
```

### Load a checkpoint

```python
import torch

# Base model (exp1, exp2, exp4)
from model import DenseNetWithDoubleLinear
model = DenseNetWithDoubleLinear(num_classes=2, dropout_prob=0)
ckpt = torch.load("exp1_medgemma/densenet_keep/patch1.pt", map_location="cpu")
model.load_state_dict(ckpt["model_state_dict"])

# Demographics model (exp3)
from model import DenseNetWithDoubleLinear_addDemothen2
model = DenseNetWithDoubleLinear_addDemothen2(num_classes=2, demo_size=5)  # e.g. sexage -> 2+3=5
ckpt = torch.load("exp3-1_medgemma/sexage.pt", map_location="cpu")
model.load_state_dict(ckpt["model_state_dict"])
```

### Mapping from HF paths to original training paths

| HF path | Original training path |
|---------|----------------------|
| `exp2-1_medgemma/densenet_{N}.pt` | `JAMA_codes_medgemma/{N}_mg_exp2/densenet/Rand123/...` |
| `exp3-1_medgemma/{combo}.pt` | `JAMA_codes_medgemma/{combo}_mg_exp3-1/densenet/Rand123/...` |
| `exp3-2_medgemma/{combo}.pt` | `JAMA_codes_medgemma/{combo}_mg_exp3-2/swinTF/Rand123/...` |
| `exp4-1_medgemma/{highpass,lowpass}/{F}Hz.pt` | `JAMA_codes_medgemma/{F}{HighPass,LowPass}_mg_exp4-1/swinTF/Rand123/...` |
| `exp4-2_medgemma/{highpass,lowpass}/{F}Hz.pt` | `JAMA_codes_medgemma/{F}{HighPass,LowPass}_mg_exp4-2/densenet/Rand123/...` |

Bootstrap evaluation results: `bootstrap_results/` in the [code repository](https://github.com/altis5526/Insurance-Prediction-from-Normal-CXRs-Public-Version).

## Training Details

- **Dataset**: mimic-cxr-gemma (MedGemma-refined normal frontal CXRs from MIMIC-CXR-JPG v2.0.0); CheXpert for `*_CheXpert` / `*_chexpert` checkpoints
- **Task**: Binary classification β€” Private vs. Public/Government insurance
- **Image size**: 448 x 448
- **Seed**: 123
- **Selection**: Best validation AUC checkpoint

## Citation

```bibtex
@article{chen2025algorithms,
  title={Algorithms Trained on Normal Chest X-rays Can Predict Health Insurance Types},
  author={Chen, Chi-Yu and Abulibdeh, Rawan and Asgari, Arash and Ord{\'o}{\~n}ez, Sebasti{\'a}n Andr{\'e}s Cajas and Celi, Leo Anthony and Goode, Deirdre and Hamidi, Hassan and Seyyed-Kalantari, Laleh and McCague, Ned and Sounack, Thomas and others},
  journal={arXiv preprint arXiv:2511.11030},
  year={2025}
}
```

## Code

[Code Repository](https://github.com/altis5526/Insurance-Prediction-from-Normal-CXRs-Public-Version)