Repository navigation
Commit a5bc1bf
[Dataset + Taks + Model] PMData stress detection; CLIPStress raw-text input and zero-shot (#1675)
* [Dataset + Task] PMData dataset and daily stress detection
Add PMDataDataset for the PMData sports-logging dataset (Fitbit, PMSYS,
Google Forms, participant overview and food-image paths as 11 tables) and
PMDataStressDetection, the binary daily stress task of Yang et al.,
"Contrastive Pretraining for Stress Detection with Multimodal Wearable
Sensor Data and Surveys" (CHIL 2025).
Includes synthetic-data tests, API docs, and an MLP example with task
ablations (feature groups, label threshold, day vs participant split).
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* [Model] CLSP contrastive language-sequence pretraining for PMData stress
Add CLSP, the model of Yang et al., "Contrastive Pretraining for Stress
Detection with Multimodal Wearable Sensor Data and Surveys" (CHIL 2025):
a Transformer + tabular residual MLP encoder pretrained with a CLIP loss
against frozen BERT embeddings of each day's text description, then
linear probing or fine-tuning. Stages switch with set_stage() so every
stage runs through Trainer; zero_shot() scores samples against class
texts.
PMDataStressDetection gains include_text / text_statistics, which add the
paper's text description of each day (channel statistics and feature
lines, never the label). Includes model tests with a fake text encoder,
task text tests, API docs, and a full-pipeline example with ablations
(soft vs one-to-one targets, text without statistics, zero-shot, 10%
labels, day vs participant split).
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* [Example] CLSP hyperparameter sweep, type hints
- examples/pmdata_stress_detection_clsp.py: one-at-a-time sweep of the
contrastive temperature (0.03, 0.2) and hidden/projection size (32, 128),
with real-data results and findings in the docstring.
- Annotate **kwargs and PMDataDataset.default_task's return type.
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* [Example] Comment each ablation in the PMData examples
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* Fix PR rule check: modern type hints, ClassVar schemas, narrow except
- Use built-in generics and X | None (ruff UP006/UP007/UP035/UP045).
- Annotate the task's class-level schemas with ClassVar (RUF012).
- Catch only the errors reading a photo's EXIF time can raise (BLE001).
- from torch import nn (PLR0402); same style applied to tests and examples.
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* Use the existing CLIPStress instead of a second model; add raw text and zero-shot
PyHealth already has CLIPStress (#1516) for the same paper, so CLSP is
removed and the PMData pipeline runs on CLIPStress, extended with:
- text_encoder: CLIPStress can take a task's raw text field directly,
embedded by a frozen encoder cached per text (FrozenTextEncoder in
clip_stress_utils) and kept out of the state dict. Cached text_embedding
tensors work exactly as before.
- zero_shot(): label-free prediction by similarity to class descriptions,
scored as in pretraining.
Tests in tests/core/test_clip_stress_text.py; the existing CLIPStress tests
pass unchanged. The full pipeline example is now
examples/pmdata_stress_detection_clip_stress.py.
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* Real-data CLIPStress results and findings in the PMData pipeline example
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
* Type hints for the CLIPStress extension test helpers
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>
---------
Co-authored-by: Wanting Mao <wmao8@illinois.edu>
Co-authored-by: Aditya Radhakrishnan <aditya63@illinois.edu>1 parent 35170a1 commit a5bc1bf
16 files changed
Lines changed: 3609 additions & 3 deletions
File tree
- docs/api
- datasets
- models
- tasks
- examples
- pyhealth
- datasets
- configs
- models
- tasks
- tests/core
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
410 | 410 | | |
411 | 411 | | |
412 | 412 | | |
| 413 | + | |
| 414 | + | |
| 415 | + | |
| 416 | + | |
| 417 | + | |
413 | 418 | | |
414 | 419 | | |
415 | 420 | | |
| |||
673 | 678 | | |
674 | 679 | | |
675 | 680 | | |
| 681 | + | |
676 | 682 | | |
677 | 683 | | |
678 | 684 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 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 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
84 | 84 | | |
85 | 85 | | |
86 | 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 | + | |
87 | 117 | | |
88 | 118 | | |
89 | 119 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
0 commit comments