SYNTOLOGY HomeExplorerAtlasCodeMethodologyAboutDevelopersFeedPricing
Paper · 2109.07839 · 2021

Self-supervised Contrastive Learning for EEG-based Sleep Staging

arXiv · PDF · Open in the Atlas

Code that ran

3 of 7 samples (functions and classes) lifted from this paper's linked repositories executed on a synthesized input in Syntology's jail (0 of them constructed an object rather than computing a result; 1 honoured the contract we drafted, 0 violated it and 2 have no contract verdict; 0 failures of our instrument; 4 no recorded run), measured 2026-11-22; repository links from the Papers with Code archive attributed under CC BY-SA, no affiliation; bodies inline only under a permissive licence as GitHub detects it. Not a reproduction of the paper's results.

"Ran" means the function executed on a synthesized input and returned a value. It is not a reproduction of the paper's results. This record, dated, as JSON: /api/ran/2109.07839.json · badge: /api/ran/2109.07839.svg

Each repository's role is a label: a classifier's output recorded on the link, or, where no role is recorded, what the Papers with Code archive marked. The line under it names its basis. Neither says who wrote the code.

RepositoryRoleRan
xuejiang16/ssl-torch canonical (classifier label)
classifier basis: census
3 ran · 4 no recorded run
FunctionStatusWhere it lives
adjust_learning_rate Ran
ran, honoured the contract we drafted
xuejiang16/ssl-torch/mit_utils.py
code served (permissive licence) · get_code("14ebf34e2f003912")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

class DummyModel(nn.Module):
    def __init__(self):
        super(DummyModel, self).__init__()
        self.fc = nn.Linear(4, 3)

model = DummyModel()
optimizer = torch.optim.SGD(model.parameters(), lr=0.01)
lr = 0.001

ARGS = {
    'optimizer': optimizer,
    'lr': lr
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calculate_all_prediction Ran
ran on a synthesized input
xuejiang16/ssl-torch/contrast.py
code served (permissive licence) · get_code("2d08e212daa583e7")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned float, ndim 0, dtype family float, shape () as a later run recorded it. The image it ran in was not recorded. If your copy returns the same type, ndim and shape on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import numpy as np

# Create a small confusion matrix for testing
# A confusion matrix is a 2D numpy array where rows are true labels
# and columns are predicted labels
# For a 3-class classification problem:
confMatrix = np.array([
    [45, 5, 0],      # True class 0: 45 correct, 5 misclassified as 1, 0 as 2
    [3, 48, 4],      # True class 1: 3 misclassified as 0, 48 correct, 4 as 2
    [2, 1, 47]       # True class 2: 2 misclassified as 0, 1 as 1, 47 correct
])

ARGS = {
    "confMatrix": confMatrix
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
numpy — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type float, ndim 0, dtype family float, shape () — shape () as a later run recorded it
dtype family
int means an integer dtype; float means any other dtype the instrument saw, bool and complex included (fixture_check.py records only these two families)
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
conv3x3 Ran
ran on a synthesized input
xuejiang16/ssl-torch/net.py
code served (permissive licence) · get_code("b87ab6dcf412f29c")
How it ran

Ran in Syntology's sandbox on this synthesized input (drafted by a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API) and returned Conv1d. The image it ran in was not recorded. If your copy returns the same type on these inputs, it matched what we observed; nothing here checks that. It does NOT mean the output is correct: nothing has compared it to the paper.

import torch
import torch.nn as nn

torch.manual_seed(0)

ARGS = {
    "in_planes": 3,
    "out_planes": 64,
    "stride": 1,
}
Setup block drafted by
a language model, Claude Haiku 4.5, prompt python_fixture_v1, through the batch API
Imports
torch — import names as written, not package names to install; a name the repository itself provides is not a package
Returned
type Conv1d — a Conv1d output has no array shape of its own; none is stated — the instrument coerces any output to an array; for a Conv1d output the recorded ndim 0 and dtype family float describe that coercion, not the output, and are not stated
Environment
image not recorded; re-verify against syntology-harvest-sandbox:v5-deps; not recorded for this sample: the harness installs a cuda-to-cpu shim (cuda_shim.py) before every sample and no run records whether a sample needed it; seed: none by the harness; any seed is in the setup block
calc_f1 Not yet run
unverified (harvested, no recorded run)
xuejiang16/ssl-torch/mit_utils.py
code served (permissive licence) · get_code("55b92fba20e7d4dd")
How it ran

no invocation recorded.

print_time_cost Not yet run
unverified (harvested, no recorded run)
xuejiang16/ssl-torch/mit_utils.py
code served (permissive licence) · get_code("d2fe0012b2115133")
How it ran

no invocation recorded.

resnet18 Not yet run
unverified (harvested, no recorded run)
xuejiang16/ssl-torch/net.py
code served (permissive licence) · get_code("8cc1b8f32f5cb919")
How it ran

no invocation recorded.

resnet34 Not yet run
unverified (harvested, no recorded run)
xuejiang16/ssl-torch/net.py
code served (permissive licence) · get_code("6924cce113d956d1")
How it ran

no invocation recorded.

Also present in other papers' code

Of 7 samples lifted from this paper's linked repositories, 7 carry a function identity and 0 do not. Of the 7 distinct functions with an identity, 3 are also present in other papers whose code we hold (3 with at least one paper dated earlier, 0 the same month, 3 later) and 4 are only here among the 52,977 papers whose code Syntology holds (as of 2026-09-26).

Only here means: among the 52,977 papers whose code Syntology holds (51,887 with lifted samples, 1,090 through their assemblies only), as of 2026-09-26, no other paper's lifted samples or current assembly bricks contain an identical function body after normalisation.

FunctionAlso present inEarliest-datedOthers named
resnet18 89 other papers
37 dated earlier, 50 later, 2 same year, order not determinable
1705.09759 (2017-05)
CASENet: Deep Category-Aware Semantic Edge Detection
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
1803.00839 (2018-03)
Pose-Robust Face Recognition via Deep Residual Equivariant Mapping
and 86 more not named here
resnet34 53 other papers
30 dated earlier, 21 later, 2 same year, order not determinable
1705.09759 (2017-05)
CASENet: Deep Category-Aware Semantic Edge Detection
1801.07698 (2018-01)
ArcFace: Additive Angular Margin Loss for Deep Face Recognition
1803.00839 (2018-03)
Pose-Robust Face Recognition via Deep Residual Equivariant Mapping
and 50 more not named here
adjust_learning_rate 4 other papers
3 dated earlier, 1 later
1802.10026 (2018-02)
Loss Surfaces, Mode Connectivity, and Fast Ensembling of DNNs
1803.05407 (2018-03)
Averaging Weights Leads to Wider Optima and Better Generalization
1812.10366 (2018-12)
A Poisson-Gaussian Denoising Dataset with Real Fluorescence Microscopy Images
and 1 more not named here

Presence, not direction: an identical function body in two papers' repositories does not say who wrote it, which came from which, or that either paper's method rests on it. Matching is exact after normalisation, so a renamed or edited function is not matched. Dates are when papers appeared, not when code was written. Only .py files the harvester lifted are covered; notebooks are not read. A new-style arXiv id YYMM.NNNN dates a paper to the month 20YY-MM; otherwise Paper.year dates it to the year; otherwise it is undated. Dates are when the paper appeared, not when the code was written. Read 2026-11-22.

Repositories linked to this paper

Some links come from the archived Papers with Code dataset (CC BY-SA 4.0): attribution and licence.

Abstract

EEG signals are usually simple to obtain but expensive to label. Although supervised learning has been widely used in the field of EEG signal analysis, its generalization performance is limited by the amount of annotated data. Self-supervised learning (SSL), as a popular learning paradigm in computer vision (CV) and natural language processing (NLP), can employ unlabeled data to make up for the data shortage of supervised learning. In this paper, we propose a self-supervised contrastive learning method of EEG signals for sleep stage classification. During the training process, we set up a pretext task for the network in order to match the right transformation pairs generated from EEG signals. In this way, the network improves the representation ability by learning the general features of EEG signals. The robustness of the network also gets improved in dealing with diverse data, that is, extracting constant features from changing data. In detail, the network's performance depends on the choice of transformations and the amount of unlabeled data used in the training process of self-supervised learning. Empirical evaluations on the Sleep-edf dataset demonstrate the competitive performance of our method on sleep staging (88.16% accuracy and 81.96% F1 score) and verify the effectiveness of SSL strategy for EEG signal analysis in limited labeled data regimes. All codes are provided publicly online.

For agents

The same record, over MCP at https://syntology.ai/mcp:

get_harvested_code_for_paper("2109.07839")
get_code_for_paper("2109.07839")
have("2109.07839")

The run record, dated, one paper per request, free:

curl https://syntology.ai/api/ran/2109.07839.json

A badge for a README (the split and the date, never a ratio):

[![Syntology run record](https://syntology.ai/api/ran/2109.07839.svg)](https://syntology.ai/paper/2109.07839)

Connect an agent — have() is free.