File size: 8,116 Bytes
1622cb5
 
 
 
 
 
7fba1c0
1622cb5
7fba1c0
 
 
 
 
1622cb5
 
 
 
 
 
 
 
7fba1c0
 
1622cb5
 
7fba1c0
 
 
 
 
 
 
1622cb5
 
 
 
 
 
7fba1c0
1622cb5
 
 
7fba1c0
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1622cb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
7fba1c0
 
 
 
1622cb5
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
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
---
license: mit
language:
- en
pretty_name: CGM-JEPA Downstream Evaluation Splits
task_categories:
- tabular-classification
- feature-extraction
task_ids:
- binary-classification
modalities:
- Time Series
- Tabular
tags:
- continuous-glucose-monitor
- cgm
- insulin-resistance
- beta-cell-dysfunction
- metabolic-subphenotype
- ogtt
- healthcare
- time-series
- subject-level-classification
size_categories:
- n<1K
configs:
- config_name: default
  data_files:
  - split: train
    path: train.parquet
  - split: validation
    path: validation.parquet
---

# CGM-JEPA Downstream Evaluation Splits

Labeled cohort splits used to evaluate CGM encoders on two binary metabolic outcomes — **insulin resistance** and **β-cell dysfunction** — in the paper *CGM-JEPA: Learning Consistent Continuous Glucose Monitor Representations via Predictive Self-Supervised Pretraining*.

> Downstream-only. For the unlabeled pretraining corpus (Stanford + Colas), see [`CRUISEResearchGroup/CGM-JEPA-Pretraining`](https://huggingface.co/datasets/CRUISEResearchGroup/CGM-JEPA-Pretraining). For pretrained encoder weights, see [`CRUISEResearchGroup/CGM-JEPA`](https://huggingface.co/CRUISEResearchGroup/CGM-JEPA).

## Quick start

### Option 1 — `datasets` library (recommended for analysis / fine-tuning)

```python
from datasets import load_dataset
ds = load_dataset("CRUISEResearchGroup/CGM-JEPA-Downstream")
# DatasetDict({
#   train:      Dataset({features: ['subject', 'ctru_venous', 'ctru_cgm', ...,
#                                   'ir_class', 'ir_regression',
#                                   'beta_class', 'beta_regression'],
#                       num_rows: 27}),
#   validation: Dataset({..., num_rows: 17})
# })
```

The two splits share a canonical 11-column schema (subject + 6 modality `Sequence(Value('float64'))` + 4 label fields). Modalities the train cohort doesn't have are `None` rather than empty — only `ctru_venous` is populated in the train split.

### Option 2 — original nested JSON (used by the code repo's eval pipeline)

```bash
huggingface-cli download CRUISEResearchGroup/CGM-JEPA-Downstream \
  --repo-type dataset --local-dir Dataset_Open
```

Then from the [code repository](https://github.com/cruiseresearchgroup/CGM-JEPA):

```bash
# Reproduce all 3 evaluation regimes × 2 endpoints (Tables 1–6)
python scripts/run_all_eval.py
```

## Files

| File | Subjects | Size | Role |
|---|---|---|---|
| `train.parquet` | 27 | ~30 KB | **Initial cohort** in `datasets`-friendly tabular form (one row per subject). |
| `validation.parquet` | 17 | ~110 KB | **Validation cohort** in `datasets`-friendly tabular form. |
| `train_split.json` | 27 | ~45 KB | Same data as `train.parquet`, in the nested JSON layout the code repo's `data_loaders/` expects. |
| `validation_split.json` | 17 | ~146 KB | Same data as `validation.parquet`, nested JSON layout. |

The two cohorts are **subject-disjoint by construction**: subjects appearing in both upstream groups were removed from the validation cohort during preprocessing.

## Schema

Both files use the same nested-JSON structure:

```jsonc
{
  "S01": {                                  // subject identifier
    "x": {
      "ctru_venous":  [<float>, …],         // sequence of glucose values (mg/dL)
      "ctru_cgm":     [<float>, …],         //   (validation cohort only)
      "home_cgm_1":   [<float>, …],         //   "
      "home_cgm_2":   [<float>, …],         //   "
      "cgm_home_mean":[<float>, …],         //   mean of home_cgm_1 & home_cgm_2
      "cgm_all_mean": [<float>, …]          //   mean of ctru_cgm, home_cgm_1, home_cgm_2
    },
    "y": {
      "ir":   {"class": 0|1, "regression": <float>},   // SSPG-derived
      "beta": {"class": 0|1, "regression": <float>}    // DI-derived
    }
  },
  "S02": { ... },
  ...
}
```

### Extract methods (`x` sub-keys)

| Key | Availability | Description |
|---|---|---|
| `ctru_venous` | train + validation | In-clinic venous OGTT glucose trajectory |
| `ctru_cgm` | validation only | In-clinic CGM trajectory recorded during the same OGTT |
| `home_cgm_1` | validation only | First free-living home-CGM window |
| `home_cgm_2` | validation only | Second free-living home-CGM window |
| `cgm_home_mean` | validation only | Subject-level mean of `home_cgm_1` and `home_cgm_2` |
| `cgm_all_mean` | validation only | Subject-level mean of all three CGM modalities |

The initial cohort was defined to have OGTT venous data only (no matching CGM), so `train_split.json` contains a single `ctru_venous` field per subject.

### Labels (`y` sub-keys)

| Field | Type | Source | Threshold |
|---|---|---|---|
| `ir.class` | binary {0, 1} | SSPG (Steady-State Plasma Glucose) | 1 = insulin-resistant, 0 = insulin-sensitive |
| `ir.regression` | float | SSPG numeric value | mg/dL |
| `beta.class` | binary {0, 1} | DI (Disposition Index) | 1 = β-cell dysfunction, 0 = normal β-cell function |
| `beta.regression` | float | DI numeric value | dimensionless |

A class value of `-1` indicates a missing or unannotated label. Threshold definitions follow Metwally et al. (2025).

### Class distribution

| Cohort | n | IR=1 (resistant) | IR=0 (sensitive) | β=1 (dysfunction) | β=0 (normal) |
|---|---:|---:|---:|---:|---:|
| Initial (train_split) | 27 | 14 | 13 | 16 | 11 |
| Validation (validation_split) | 17 | 7 | 10 | 6 | 11 |

Both labels are reasonably balanced; the paper reports stratified 2-fold cross-validation over 20 random iterations (40 paired evaluations per cell).

## Evaluation regimes (paper Tables 1–6)

The two splits support all three deployment regimes evaluated in the paper:

| Regime | Train on | Test on |
|---|---|---|
| Cohort generalization (venous) | `train_split` × `ctru_venous` | `validation_split` × `ctru_venous` |
| Venous → home-CGM transfer | `validation_split` × `ctru_venous` | `validation_split` × `cgm_home_mean` |
| In-domain home CGM | `validation_split` × `cgm_home_mean` | `validation_split` × `cgm_home_mean` |

All regimes are orchestrated by [`scripts/run_all_eval.py`](https://github.com/cruiseresearchgroup/CGM-JEPA/blob/main/scripts/run_all_eval.py).

## How this corpus was built

The splits were assembled by [`scripts/preprocess_dataset.py`](https://github.com/cruiseresearchgroup/CGM-JEPA/blob/main/scripts/preprocess_dataset.py) in the code repository, from a single upstream source:

- **Stanford CGM Study** (Metwally et al. 2025, *Nature Biomedical Engineering*) — data distributed through the [`Metabolic_Subphenotype_Predictor`](https://github.com/aametwally/Metabolic_Subphenotype_Predictor) repository under the MIT license.

Cohort assignment is based on the `exp_type` column in `filtered_metabolic_tests.csv`:

- Subjects with `exp_type = venous_without_matching_cgm_and_without_planned_athome_cgm` → **initial cohort**.
- Subjects with `exp_type = venous_with_matching_cgm_and_with_planned_athome_cgm` → **validation cohort**.
- Subjects appearing in both groups are removed from the validation cohort to keep them subject-disjoint.

All glucose trajectories were smoothed onto a 5-min grid via cubic smoothing splines (`scipy.interpolate.make_smoothing_spline(lam=0.35)`); sensor `"Low"`/`"High"` strings were replaced with the empirical numeric min/max.

## Intended use

- Linear-probe / fine-tuning evaluation of CGM encoders on metabolic-subphenotype prediction.
- Cross-cohort generalization and cross-modality transfer experiments.
- Method comparison on a small but clinically labeled CGM corpus.

## License & attribution

Released under the **MIT license**, inherited from the upstream [`Metabolic_Subphenotype_Predictor`](https://github.com/aametwally/Metabolic_Subphenotype_Predictor) repository (Metwally et al. 2025, *Nature Biomedical Engineering*). Please cite both the original Stanford study and our CGM-JEPA paper when using these splits.

## Citation

> _Citation block to be filled once the CGM-JEPA paper has a stable venue / arXiv link._

## Code repository

[`https://github.com/cruiseresearchgroup/CGM-JEPA`](https://github.com/cruiseresearchgroup/CGM-JEPA)