Skip to content

Multi View Contrastive learning#1093

Open
coderookie1994 wants to merge 30 commits intosunlabuiuc:masterfrom
coderookie1994:contrastive_learning
Open

Multi View Contrastive learning#1093
coderookie1994 wants to merge 30 commits intosunlabuiuc:masterfrom
coderookie1994:contrastive_learning

Conversation

@coderookie1994
Copy link
Copy Markdown

@coderookie1994 coderookie1994 commented Apr 22, 2026

Authors: Heyan Gao (heyan3@illinois.edu), Sharthak Ghosh(sghos52@illinois.edu)
Paper: https://arxiv.org/pdf/2506.22393

Overview

This PR adds the following: -

  1. SleepEEG multi view contrastive learning task
  2. Multi view contrastive learning based on time series (paper implementation)
  3. Generic n-view multi view contrastive learning (extension)

Task

  1. The MVCLTrainingSleepEEG task returns sleep windows per patient based on the openly available SleepEDF dataset.
  2. The key properties returned are xt, xd, xf. These are the Time, Derivative and Frequency tensors respectively.

Examples

The example is here examples\mvcl_training_sleepedf.ipynb.

  1. A valid SleepEDF dataset path is necessary
  2. It runs the task associated with it and runs the generic multi-view model

Models

There are two models, MultiViewContrastiveModel which is the generic model that can work with n number of views and MultiViewContrastiveTimeSeriesModel that specifically implments the paper as mentioned above.

Associated Unit-Tests

Task tests here tests\core\test_mvcl_training_sleepedf_task.py
Model tests here tests\core\test_mvcl.py

Dataset sources

https://physionet.org/content/sleep-edfx/1.0.0/

Complete List of files added/modified

  1. docs/api/models/pyhealth.models.MVCL.rst
  2. docs/api/tasks/pyhealth.tasks.MVCLTrainingSleepEEG.rst
  3. docs/api/models.rst
  4. docs/api/tasks.rst
  5. examples/mvcl_training_sleepedf.ipynb
  6. pyhealth/datasets/sleepedf.py
  7. pyhealth/models/__init__.py
  8. pyhealth/models/multi_view_contrastive_time_series_model.py
  9. pyhealth/models/mvcl_model.py
  10. pyhealth/tasks/__init__.py
  11. pyhealth/tasks/mvcl_training_sleepedf_task.py
  12. tests/core/test_mvcl.py
  13. tests/core/test_mvcl_training_sleepedf_task.py

Bug Fix

In pyhealth/datasets/sleepedf.py the dev flag wasn't being propagated to the base class.

heyan3 and others added 26 commits April 5, 2026 16:29
…amend pooling to include residuals; 4. add MHA to finetune
small updated in task; plus unit test/exmaples/api docs
@coderookie1994 coderookie1994 changed the title Contrastive learning Multi View Contrastive learning Apr 22, 2026
@coderookie1994 coderookie1994 marked this pull request as draft April 22, 2026 09:52
@coderookie1994 coderookie1994 marked this pull request as ready for review April 22, 2026 14:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants