Finalized example and slight fixes#1129
Open
guanedwa wants to merge 3 commits intosunlabuiuc:masterfrom
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I don't have your name or NetID — fill those in where indicated, then this is ready to submit.
[Dataset + Task] UCI Daily and Sports Activities (DSA) — DPAM Replication
Contributor:
<Edward Guan (edwardg2)> — <edwardg2@illinois.edu>Type: Dataset + Task (reproducibility contribution)
Paper: Zhang et al. "Daily Physical Activity Monitoring — Adaptive Learning from Multi-source Motion Sensor Data." CHIL 2024, PMLR 248:39-54. https://proceedings.mlr.press/v248/zhang24a.html
Description
This PR adds PyHealth support for the UCI Daily and Sports Activities (DSA) dataset and implements the Inter-domain Pairwise Distance (IPD) transfer learning framework from Zhang et al. (CHIL 2024). The dataset contains motion sensor recordings of 19 activities from 8 subjects across 5 simultaneously worn body-part sensors (torso, right arm, left arm, right leg, left leg), each producing 9-channel time series at 25 Hz in 5-second windows.
The implementation provides two classification tasks — binary one-vs-rest (replicating the paper's protocol) and 19-class multiclass (our extension) — along with the full IPD computation pipeline for cross-domain transfer weighting. The contribution replicates the author's released code rather than the paper description where the two diverge; all discrepancies are documented in module-level docstrings.
An ablation study in the example notebook investigates how target domain selection, input scaling, and activity difficulty each affect LSTM classification performance, finding that the paper's transfer gains are sensitive to the balanced evaluation protocol and do not generalise to natural class distributions or the multiclass setting.
File Guide
Core Implementation
pyhealth/datasets/dsa.py—DSADatasetclass: download, verification, indexing, time series loading, subject-split utilitiespyhealth/tasks/dsa.py— both task classes + full IPD pipeline +ExperimentConfig/ExperimentResultpyhealth/datasets/configs/dsa.yaml— BaseDataset YAML configTests
tests/core/test_dsa_dataset.py— synthetic-data tests: metadata indexing, patient/event structure, time series loading, scaling, subject splits, error handlingtests/core/test_dsa_tasks.py— synthetic-data tests: both task classes, full IPD pipeline, config/result dataclassesDocumentation
docs/api/datasets/pyhealth.datasets.DSADataset.rstdocs/api/tasks/pyhealth.tasks.DSAActivityClassification.rstdocs/api/tasks/pyhealth.tasks.DSABinaryActivityClassification.rstdocs/api/datasets.rst— updated table of contentsdocs/api/tasks.rst— updated table of contentsExample / Ablation
examples/dsa_activity_classification.ipynb— end-to-end replication of No Transfer / Naive Transfer / Weighted Transfer conditions with ablations across distance metrics and epoch-weighting strategiesDependency
pyproject.toml— added optional[dsa]dependency group forpyts>=0.12.0