NeurIPS 2026Coming to NeurIPS?Explore papers, orals & directions

Neighborhood Contrastive Learning Applied to Online Patient Monitoring

Hugo Yèche, Gideon Dresdner, Francesco Locatello, Matthias Hüser, Gunnar Rätsch

Introduction

Monitoring critically ill patients in the Intensive Care Unit (ICU) is a high-stakes task where machine learning can provide life-saving early warnings. However, most current methods rely on supervised learning, which requires massive amounts of expert-labeled data—a resource that is both expensive and scarce in medicine.

While self-supervised "contrastive learning" (CL) has revolutionized computer vision by learning from unlabeled data, it struggles with medical time-series for two main reasons:

  1. Augmentation Difficulty: In images, you can flip or crop a picture of a cat, and it remains a cat. In medical signals, small temporal shifts can completely change the clinical meaning (e.g., the onset of organ failure).
  2. Patient Heterogeneity: Data from the same patient is often more similar to itself than to data from other patients, even if those other patients share the same clinical outcome. This "patient-induced heterogeneity" confuses standard models, making it hard to distinguish between a patient's baseline state and a life-threatening event.

To address these challenges, researchers have introduced Neighborhood Contrastive Learning (NCL), a framework designed to explicitly model temporal and patient-specific relationships.

The NCL Approach

Instead of just pulling "similar" augmented views together and pushing "different" ones apart, NCL defines a specific "neighborhood" for each data point.

The NCL objective balances alignment within neighborhoods and discrimination between views.

The core of NCL is a weighted loss function that combines two objectives:

  • Neighbors Alignment (NA): Encourages representations of samples within the same neighborhood to be close together in the latent space.
  • Neighbor Discriminative (ND): Prevents the model from collapsing all neighbors into a single point, preserving the diversity needed to distinguish between different clinical states.

The authors propose two types of neighborhoods:

  • Time-preserving ($n_w$): Neighbors are segments from the same patient stay that occur within a specific time window ($w$). This leverages temporal proximity as a natural prior, as samples close in time for a single patient share underlying physiology.
  • Label-preserving ($n_Y$): Neighbors are samples that share the same clinical label (used in a supervised setting).

To ensure the model focuses on the patient's current state, NCL also introduces specialized augmentations like "history cutout" and "history crop" that preserve the most recent time step while altering the historical context.

Key Insights

  • Avoiding Representation Collapse: Standard Supervised Contrastive Loss often forces all samples with the same label to look identical. NCL’s discriminative term acts as a regularizer, maintaining a hierarchy that allows for better generalization and transfer learning.
  • The $\alpha$ Trade-off: The authors found a "sweet spot" for the trade-off parameter $\alpha$, which balances how much the model focuses on aligning neighbors versus discriminating between them.
  • Linear Probes are Limiting: The paper shows that the common practice of evaluating representations with a simple linear classifier might be misleading. Using a non-linear MLP head revealed that NCL learns far richer features than previously thought.

Key Results

The researchers evaluated NCL on two major open-source Electronic Health Record (EHR) benchmarks: MIMIC-III (Decompensation and Length-of-stay) and Physionet 2019 (Sepsis detection).

Detailed results on the MIMIC-III benchmark show NCL consistently performing at the top of the pack.
  • Beating the Supervised Baseline: In the unsupervised setting, NCL($n_w$) was the only method to outperform a fully supervised "End-to-End" model on the MIMIC-III Decompensation task.
  • Superiority in Low-Label Regimes: When only 1% of labels were available, NCL achieved an AUPRC of 19.8, compared to just 13.1 for the standard supervised model—a massive relative improvement.
  • Sepsis Detection: On the Physionet 2019 dataset, NCL($n_Y$) significantly outperformed all baselines, achieving a Utility score of 32.6 compared to the End-to-End score of 27.9.

Future Directions

The authors acknowledge that their current neighborhood definition is binary—a sample is either in the neighborhood or it isn't. Moving toward categorical or continuous neighborhood definitions (where similarity is a spectrum) could make the framework even more expressive. Furthermore, while NCL was designed for ICU data, its principles could likely benefit other domains with high subject-specific heterogeneity, such as speech recognition or wearable sensor data.

Summary updated

BibTeX
@inproceedings{yeche2021neighborhood,
  author = {Hugo Yèche and Gideon Dresdner and Francesco Locatello and Matthias Hüser and Gunnar Rätsch},
  title = {{Neighborhood Contrastive Learning Applied to Online Patient Monitoring}},
  booktitle = {International Conference on Machine Learning},
  year = {2021},
  url = {https://openreview.net/forum?id=rCxP4jvecqG},
}
Figure