hadamelino commited on
Commit
a2c0004
·
verified ·
1 Parent(s): c01f7f4

Initial release: 228-subject CGM pretraining corpus

Browse files
Files changed (3) hide show
  1. .gitattributes +1 -0
  2. README.md +114 -3
  3. cgm_initial_cohort.csv +3 -0
.gitattributes CHANGED
@@ -58,3 +58,4 @@ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
 
 
58
  # Video files - compressed
59
  *.mp4 filter=lfs diff=lfs merge=lfs -text
60
  *.webm filter=lfs diff=lfs merge=lfs -text
61
+ cgm_initial_cohort.csv filter=lfs diff=lfs merge=lfs -text
README.md CHANGED
@@ -1,3 +1,114 @@
1
- ---
2
- license: mit
3
- ---
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-4.0
3
+ language:
4
+ - en
5
+ pretty_name: CGM-JEPA Pretraining Corpus
6
+ task_categories:
7
+ - time-series-forecasting
8
+ - feature-extraction
9
+ task_ids:
10
+ - multivariate-time-series-forecasting
11
+ tags:
12
+ - continuous-glucose-monitor
13
+ - cgm
14
+ - self-supervised-learning
15
+ - biosignal
16
+ - healthcare
17
+ - time-series
18
+ - pretraining
19
+ - jepa
20
+ size_categories:
21
+ - 100K<n<1M
22
+ ---
23
+
24
+ # CGM-JEPA Pretraining Corpus
25
+
26
+ Continuous glucose monitor (CGM) time-series corpus used for self-supervised pretraining of **CGM-JEPA**, **X-CGM-JEPA**, **GluFormer**, and **TS2Vec** encoders in the paper *CGM-JEPA: Learning Consistent Continuous Glucose Monitor Representations via Predictive Self-Supervised Pretraining*.
27
+
28
+ > Pretraining-only corpus. For the labeled downstream-evaluation cohorts (insulin resistance and β-cell dysfunction classification), see [`CRUISEResearchGroup/CGM-JEPA-Downstream`](https://huggingface.co/datasets/CRUISEResearchGroup/CGM-JEPA-Downstream). For pretrained model weights, see [`CRUISEResearchGroup/CGM-JEPA-Weights`](https://huggingface.co/CRUISEResearchGroup/CGM-JEPA-Weights).
29
+
30
+ ## Quick start
31
+
32
+ ```bash
33
+ huggingface-cli download CRUISEResearchGroup/CGM-JEPA-Pretraining \
34
+ --repo-type dataset --local-dir Dataset_Open
35
+ ```
36
+
37
+ Then from the [code repository](https://github.com/cruiseresearchgroup/CGM-JEPA):
38
+
39
+ ```bash
40
+ # (Optional, only for X-CGM-JEPA) Precompute the Glucodensity cache once.
41
+ python -m utils.precompute_glucodensity \
42
+ --data_path Dataset_Open/cgm_initial_cohort.csv \
43
+ --output_path Dataset_Open/gluco_cache_stride144.pkl \
44
+ --stride 144
45
+
46
+ # Pretrain
47
+ python -m pretrain.pretrain_x_cgm_jepa # X-CGM-JEPA (cross-view)
48
+ python -m pretrain.pretrain_cgm_jepa # CGM-JEPA (temporal only)
49
+ python -m pretrain.pretrain_gluformer # GluFormer baseline
50
+ python -m pretrain.pretrain_ts2vec # TS2Vec baseline
51
+ ```
52
+
53
+ ## Files
54
+
55
+ | File | Size | Purpose |
56
+ |---|---|---|
57
+ | `cgm_initial_cohort.csv` | ~12 MB | Raw CGM readings (5-min sampling) — primary pretraining input |
58
+
59
+ X-CGM-JEPA additionally needs a **Glucodensity cache** (~54 MB) which is *not* shipped here; it's derived deterministically from the CSV by [`utils/precompute_glucodensity.py`](https://github.com/cruiseresearchgroup/CGM-JEPA/blob/main/utils/precompute_glucodensity.py) in the code repository (one-time, ~few minutes on CPU).
60
+
61
+ ## Schema
62
+
63
+ ### `cgm_initial_cohort.csv`
64
+
65
+ | Column | Type | Description |
66
+ |---|---|---|
67
+ | `timestamp` | datetime | Reading time at 5-min resolution |
68
+ | `glucose_value` | float | Glucose value in mg/dL |
69
+ | `subject` | str | Subject identifier (`S01..S22` for Stanford; `colas_<subject>_<day>` for Colas subject-days) |
70
+
71
+ - **413 unique subject identifiers** (22 Stanford + 391 Colas subject-days = 206 unique Colas subjects across multiple days).
72
+ - **389,365 total readings**.
73
+ - Median 288 readings per subject (= one 24-hour window at 5-min sampling); max 18,527 readings for the longest Stanford continuous-CGM record.
74
+
75
+ ## Cohort composition
76
+
77
+ | Source | Subjects | Rows | Share | Use |
78
+ |---|---|---|---|---|
79
+ | Stanford CGM Study | 22 | 276,757 | 71.1 % | CGM-JEPA / X-CGM-JEPA pretraining |
80
+ | Colas et al. (2019) | 206 (391 subject-days) | 112,608 | 28.9 % | CGM-JEPA / X-CGM-JEPA pretraining |
81
+ | **Total** | **228 unique subjects** | **389,365** | 100 % | |
82
+
83
+ This matches the paper's stated pretraining corpus of "~389k readings from 228 subjects (22 Stanford + 206 Colas)".
84
+
85
+ ## How this corpus was built
86
+
87
+ The corpus was assembled by [`scripts/preprocess_dataset.py`](https://github.com/cruiseresearchgroup/CGM-JEPA/blob/main/scripts/preprocess_dataset.py) in the code repository, from two upstream sources:
88
+
89
+ 1. **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 MIT license (files `filtered_cgm_03222026.csv`, `filtered_ogtt_…csv`, `filtered_metabolic_tests.csv`).
90
+ 2. **Colas et al. (2019)** — Open-access CGM time series from *Detrended Fluctuation Analysis in the prediction of type 2 diabetes mellitus in patients at risk*, PLOS ONE 14(12):e0225817, distributed in the paper's Supporting Information files under [CC BY 4.0](https://creativecommons.org/licenses/by/4.0/).
91
+
92
+ Stanford rows were smoothed onto a 5-min grid via cubic smoothing splines (`scipy.interpolate.make_smoothing_spline(lam=0.35)`). Sensor `"Low"`/`"High"` markers were replaced with the empirical numeric min/max. Colas daily windows were concatenated with prefixed subject IDs (`colas_<subject>_<day>`) to disambiguate them from Stanford subjects.
93
+
94
+ ## Intended use
95
+
96
+ - Self-supervised pretraining of CGM encoders (masked-patch prediction, contrastive, autoencoding objectives).
97
+ - Comparison of CGM representation learning methods.
98
+
99
+ ## License & attribution
100
+
101
+ This corpus is released under **[CC BY 4.0](https://creativecommons.org/licenses/by/4.0/)** to match the licenses of its two upstream sources:
102
+
103
+ - **Stanford CGM Study data** — released through [`Metabolic_Subphenotype_Predictor`](https://github.com/aametwally/Metabolic_Subphenotype_Predictor) under the MIT license, accompanying Metwally et al. 2025 (*Nature Biomedical Engineering*).
104
+ - **Colas et al. (2019)** — CGM time series from the PLOS ONE Supporting Information files, licensed under CC BY 4.0.
105
+
106
+ When using this dataset, please cite **all three sources**: the Stanford CGM Study (via `Metabolic_Subphenotype_Predictor`), Colas et al. 2019, and our CGM-JEPA paper.
107
+
108
+ ## Citation
109
+
110
+ > _Citation block to be filled once the CGM-JEPA paper has a stable venue / arXiv link._
111
+
112
+ ## Code repository
113
+
114
+ [`https://github.com/cruiseresearchgroup/CGM-JEPA`](https://github.com/cruiseresearchgroup/CGM-JEPA)
cgm_initial_cohort.csv ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:bfdf42d91bb0fef5ff8d080305fb9575a8d9df0f1b13ebfdbf7c9145b5e511e6
3
+ size 12336941