OSCR

Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection.

Code ↔ Paper

5 matches between paragraphs of the paper and lines of its authors' code, computed by the harvester (lexical-v1). Click a colored paragraph or line to see its counterpart.

5 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.

The 5 matches · 1 of them tie a paragraph to a whole file without given lines: a weak match, whose lines are not tinted
  1. [1] § Materials and methods › Implementation and evaluation ↔ python/train/train_nal.py, lines 17 to 153 · score 0.63 · validation loss, PyTorch, finetuning, Adam, NAL, optimizer · block oscr:b:FSEZAWRHMF8NQ-A · Report a mismatch
  2. [2] § Materials and methods › Implementation and evaluation ↔ python/train/train_hvit.py, lines 19 to 134 · score 0.62 · validation loss, PyTorch, HViT, Adam, DUL, optimizer · block oscr:b:A8X2THCH317RV-C · Report a mismatch
  3. [3] § Materials and methods › EEG datasets › Simulated data. ↔ matlab/simulate/SEREEGA-master/pop/pop_sereega_plot_source_location.m, lines 40 to 131 · score 0.53 · source locations, lead field, SEREEGA, components, simulate · block oscr:b:6H9CSX03VJPST-D · Report a mismatch
  4. [4] § Materials and methods › BUNDL: Bayesian Uncertainty-aware Deep Learning › Approximating label mismatch with . ↔ python/train/BUNDL.py, lines 73 to 156 · score 0.52 · cross entropy loss, ensemble, TTA, MCD, uncertainty, predictions · block oscr:b:QDQSPKDGWPKE0-E · Report a mismatch
  5. [5] § Materials and methods › EEG datasets › Simulated data. ↔ matlab/simulate/get_signal.m, the whole file · a weak match · score 0.51 · sharp waves, polyspike, spikes, Seizure · block oscr:b:GPE5Q6TRHEERE-P · Report a mismatch

Paper

Loaded from Europe PMC by your browser; OSCR does not store it: doi.org · Europe PMC

The paper is loaded when this pane is shown.

The authors' code

Python · 153 lines · 6.2 KB · no license · 1 match

  1. from models_nal import *
  2. from utils import *
  3. #from dataloader import *
  4. import numpy as np
  5. import pandas as pd
  6. import json
  7. import os
  8. import scipy
  9. import scipy.special
  10. import torch
  11. import torch.nn as nn
  12. import sklearn.metrics as metrics
  13. #from pyt_enc import *
  14. import torch.nn.functional as F
  15. detloss = nn.CrossEntropyLoss(weight = torch.Tensor([0.2, 0.8]).double().to('cuda:0'))
  16. def nal_finetune(data_root, modelname, mn_fn, cvfold,
  17. hparams = {'lr':1e-04, 'maxiter':100, 'prior':0.8, 'beta':1.0},
  18. traintype='s_model',
  19. use_cuda=False):
  20. lr = hparams['lr']
  21. maxiter = hparams['maxiter']
  22. beta = hparams['beta']
  23. prior = hparams['prior']
  24. device = 'cuda:0' if use_cuda and torch.cuda.is_available() else 'cpu'
  25. if use_cuda:
  26. torch.cuda.empty_cache()
  27. print(traintype, modelname)
  28. #detloss = nn.CrossEntropyLoss(weight = torch.Tensor([0.2, 0.8]).double().to(device))
  29. manifest = read_manifest(data_root+mn_fn, ',')
  30. save_loc = data_root+'split'+str(cvfold)+'/models/'
  31. if not os.path.exists(save_loc):
  32. os.mkdir(save_loc)
  33. pt_list = np.load(data_root+'all_pts.npy')
  34. train_set = myDataSet(data_root,cvfold, manifest,
  35. normalize=True,train=True,
  36. maxSeiz = 10)
  37. val_set = myDataSet(data_root,cvfold, manifest,
  38. normalize=True,train=False,
  39. maxSeiz = 10)
  40. train_loader = DataLoader(train_set, batch_size=1, shuffle=True)
  41. val_loader = DataLoader(val_set, batch_size=1, shuffle=True)
  42. s_model = True if traintype=='s_model' else False
  43. cm_theta = torch.tensor(np.load(modelname.split('_')[0]+str(cvfold)+'_cmtheta_pretrain_unc.npy')).double()
  44. if modelname == 'txlstm_nal':
  45. model = transformer_lstm_nal(transformer_dropout=0.2, device=device, s_model=s_model, cm_theta = cm_theta)
  46. elif modelname == 'sztrack_nal':
  47. model = sztrack_nal( s_model=s_model, cm_theta = cm_theta)
  48. elif modelname == 'tgcn_nal':
  49. model = TGCN_nal(s_model=s_model, cm_theta = cm_theta, device=device)
  50. elif modelname == 'tx3lstm_nal':
  51. model = transformer_3lstm(transformer_dropout=0.1, device=device)
  52. else:
  53. model = CNN_BLSTM_nal(s_model=s_model, cm_theta = cm_theta, device=device)
  54. savename = modelname+'_'+traintype+'_cv'+str(cvfold)+'_'+str(lr)
  55. oldlr = {'txlstm':1e-05, 'tgcn': 1e-06, 'cnnlstm':0.01, 'cnnblstm':0.01}
  56. ########## initialize with pretrained model, confusion matrix of pretrained or s_model
  57. if s_model:
  58. oldsavename = modelname.split('_')[0]+'_pretrain_unc_cv'+str(cvfold)+'_'+str(oldlr[modelname.split('_')[0]])
  59. state_dict = torch.load(save_loc + oldsavename+'.pth.tar')
  60. with torch.no_grad():
  61. for n, p in model.named_parameters():
  62. try:
  63. p.data = state_dict[n].double()
  64. except:
  65. continue
  66. else: #c_model case
  67. oldsavename = modelname+'_s_model_cv'+str(cvfold)+'_'+str(oldlr[modelname.split('_')[0]])
  68. state_dict = torch.load(save_loc + oldsavename+'.pth.tar')
  69. #for n, p in state_dict.named_parameters():
  70. # model[n].copy_(p)
  71. model.load_state_dict(state_dict)
  72. #print(nothing)
  73. model.double()
  74. model.to(device)
  75. optimizer = torch.optim.Adam(model.parameters(), lr=lr)
  76. sigmoid = torch.nn.Sigmoid()
  77. train_loss_clean = []
  78. train_loss_corrupt = []
  79. val_losses = []
  80. train_losses = []
  81. update_labels = False
  82. for epoch in range(1, maxiter+1):
  83. epoch_loss = 0.0
  84. train_len = len(train_loader)
  85. val_len = len(val_loader)
  86. val_epoch_loss = 0.0
  87. for batch_idx, data in enumerate(train_loader):
  88. optimizer.zero_grad()
  89. inputs = data['buffers']
  90. det_labels = data['sz_labels'].long().to(device)
  91. b, Nsz, T, _, _ = inputs.shape
  92. inputs = inputs.to(torch.DoubleTensor()).to(device)
  93. k_pred, noise_pred, _ = model(inputs)
  94. y_samples = []
  95. loss = 0.5* detloss(k_pred.reshape(-1, 2), det_labels.reshape(-1)) + 0.5* detloss(noise_pred.reshape(-1, 2), det_labels.reshape(-1))
  96. loss.backward()
  97. optimizer.step()
  98. epoch_loss += loss.item()
  99. for batch_idx, data in enumerate(val_loader):
  100. with torch.no_grad():
  101. optimizer.zero_grad()
  102. inputs = data['buffers']
  103. det_labels = data['sz_labels'].long().to(device)
  104. b, Nsz, T, _, _ = inputs.shape
  105. inputs = inputs.to(torch.DoubleTensor()).to(device)
  106. k_pred, noise_pred, _ = model(inputs)
  107. y_samples = []
  108. loss = 0.5* detloss(k_pred.reshape(-1, 2), det_labels.reshape(-1)) + 0.5* detloss(noise_pred.reshape(-1, 2), det_labels.reshape(-1))
  109. val_epoch_loss += loss.item()
  110. epoch_loss = epoch_loss/train_len
  111. val_epoch_loss = val_epoch_loss/val_len
  112. torch.cuda.empty_cache()
  113. #schedule lr
  114. train_losses.append(epoch_loss)
  115. val_losses.append(val_epoch_loss)
  116. if len(val_losses) > 10 and val_losses[-1] > min(val_losses[-11:-1]):
  117. break
  118. #if epoch_loss <= train_losses[-1] and epoch_val_loss <= val_losses[-1]:
  119. #torch.save(model.state_dict(), '/home/deeksha/EEG_Sz/GenProc/results/lstmAE_'+pt+str(ch_id)+'.pth.tar')
  120. print('Epoch: {} \tTraining Loss: {:.6f} \tValidation Loss: {:.6f} '.format(epoch, epoch_loss, val_epoch_loss))
  121. torch.save(model.state_dict(), save_loc+savename+ '.pth.tar')
  122. np.save(save_loc+ savename+'_train.npy', train_losses)
  123. np.save(save_loc+savename+'_val.npy', val_losses)
  124. #del model, optimizer, train_loader, validation_loader
  125. return train_losses, val_losses

train_nal.py at commit 3029ac2, no license · at the source

Overview

Authors: Deeksha M Shama1,2, Archana Venkataraman1,2
ORCID iDs: Deeksha M Shama
  1. Department of Electrical and Computer Engineering, Johns Hopkins University, Baltimore, Maryland, United States of America
  2. Department of Electrical and Computer Engineering, Boston University, Boston, Massachusetts, United States of America
Institutions: Boston University (United States); Johns Hopkins University (United States)
Journal: PloS one, volume 21, issue 6, article e0352191
Dates: received 19 June 2025; accepted 5 June 2026; published online 23 June 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.1371/journal.pone.0352191 · PMID 42335163 · PMCID PMC13289946 · OpenAlex W4404313184
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: EEG (modality), human (organism), epilepsy (population), methods / tools (subfield)
Methods: Spectral & time-frequency, Connectivity, Statistics, Machine learning, Physiology & signal measures
MeSH: Deep Learning*, Electroencephalography*, Seizures*, Algorithms, Bayes Theorem, Humans, Neural Networks, Computer, Uncertainty (* major topic)
Topic: EEG and Brain-Computer Interfaces (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: National Science Foundation (CAREER, 1845430); National Institutes of Health (R21 CA263804, R01 EB029977, CA263804, R01-HD108790, EB029977)
Citations: not cited yet (Europe PMC); 77 references in the paper

Abstract

Deep learning is advancing EEG processing for automated epileptic seizure detection and onset zone localization, yet its performance relies heavily on high-quality annotated training data. However, scalp EEG is susceptible to high noise levels, which in turn leads to imprecise annotations of the seizure timing and characteristics. This “label noise” presents a significant challenge in model training and generalization. In this paper, we introduce Bayesian UncertaiNty-aware Deep Learning (BUNDL), a novel algorithm that informs a deep learning model of label ambiguities, thereby enhancing the robustness of seizure detection systems. By integrating domain knowledge into an underlying Bayesian framework, we derive a novel KL-divergence-based loss function that capitalizes on uncertainty to better learn seizure characteristics from scalp EEG. Thus, BUNDL offers a straightforward and model-agnostic method for training deep neural networks with noisy training labels that does not add any parameters to existing architectures. Additionally, we explore the impact of improved detection system on the task of automated onset zone localization. We validate BUNDL using a comprehensive simulated EEG dataset and two publicly available datasets collected by Temple University Hospital (TUH) and Boston Children’s Hospital (CHB-MIT). Results show that BUNDL consistently identifies noisy labels and improves the robustness of three base models under various label noise conditions. We also conduct ablation experiments on uncertainty quantification, evaluate cross-site generalizability to Siena EEG dataset, and quantify computational cost of all methods. Furthermore, we demonstrate that BUNDL improves seizure onset zone localization accuracy. Ultimately, BUNDL presents as a reliable method that can be seamlessly integrated with existing deep models used in clinical practice, enabling the training of trustworthy models for epilepsy evaluation.

Reproduced under the paper's license (CC BY), from the paper cited above.

Repository

Its files are read in the Code ↔ Paper reader above, with 5 matches between paragraphs and lines of code.

deeksha-ms/BUNDL

License: none: the authors keep all their rights
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 3029ac2e1a5d3dfd88529c459e6dca93566c9f02, 3 January 2026
Languages: MATLAB (131), Python (10), Jupyter (2)
Size: 177 files, 143 scripts
Software Heritage: not checked
Found in: the text, “Implementation and evaluation”
Holds: README, documentation, 8 notebooks
Not found: license file, CITATION.cff, environment file, tests, continuous integration
Tools: EEGLAB (12 files), NumPy (11 files), PyTorch (10 files), pandas (7 files), SciPy (7 files), Matplotlib (4 files), Statistics and Machine Learning Toolbox (3 files), scikit-learn (2 files), FieldTrip (1 file), Parallel Computing Toolbox (1 file), Signal Processing Toolbox (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
144 files

The paper's code and data availability statement is in the Data section.

Tracing map

Proposed by the machine: these links were found in the paper and verified at the source, without human review. The map will receive a Zenodo DOI once one of the paper's authors has validated it with their ORCID.

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 143 scripts, each with its path and the digest of its content;
  • 5 matches between paragraphs of the paper and lines of the code (method lexical-v1);
  • neither the text of the paper nor the code itself.

Its JSON (tracing-map.json) is deposited on Zenodo with its DOI once the map is validated.

Data

Datasets cited

Data Availability

The simulated data can be reproduced using scripts available at https://github.com/deeksha-ms/BUNDL. The TUH dataset is available at https://isip.piconepress.com/projects/tuh_eeg/ the CHB-MIT dataset is available at https://physionet.org/content/chbmit/1.0.0/ and the Siena Dataset is available at https://physionet.org/content/siena-scalp-eeg/1.0.0/. Our code is available at https://github.com/deeksha-ms/BUNDL.

Reproduced under the paper's license (CC BY), from the paper cited above.

Versions

The history of this record: each version stored by the harvester or made by a correction of its authors or of the maintainers of its code, and what changed in its facts. The texts of the paper (its abstract, its availability statements) are not part of it; versions that changed only those are not listed.

Version 2, 28 September 2026

  • Funding: added National Science Foundation: CAREER, 1845430; National Institutes of Health: R21 CA263804, R01 EB029977, CA263804, R01-HD108790, EB029977

Version 1, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 8 MeSH terms, 44 references.

Cite

This paper

M Shama, D., & Venkataraman, A. (2026). Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection. PloS one, 21(6), e0352191. https://doi.org/10.1371/journal.pone.0352191

BibTeX

@article{mshama2026bayesian,
author = {M Shama, Deeksha and Venkataraman, Archana},
title = {{Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection}},
journal = {PloS one},
year = {2026},
month = jun,
volume = {21},
number = {6},
pages = {e0352191},
publisher = {PLOS},
issn = {1932-6203},
doi = {10.1371/journal.pone.0352191},
url = {https://doi.org/10.1371/journal.pone.0352191},
pmid = {42335163},
pmcid = {PMC13289946}
}

RIS

TY - JOUR
AU - M Shama, Deeksha
AU - Venkataraman, Archana
TI - Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection
T2 - PloS one
J2 - PLoS One
PY - 2026
DA - 2026/06/23
VL - 21
IS - 6
SP - e0352191
SN - 1932-6203
PB - PLOS
DO - 10.1371/journal.pone.0352191
UR - https://doi.org/10.1371/journal.pone.0352191
LA - en
ER -

CSL-JSON

{
"id": "10.1371/journal.pone.0352191",
"type": "article-journal",
"title": "Bayesian Uncertainty-aware Deep Learning with noisy labels: Tackling annotation ambiguity in EEG seizure detection",
"container-title": "PloS one",
"author": [
{
"family": "M Shama",
"given": "Deeksha"
},
{
"family": "Venkataraman",
"given": "Archana"
}
],
"container-title-short": "PLoS One",
"volume": "21",
"issue": "6",
"page": "e0352191",
"DOI": "10.1371/journal.pone.0352191",
"PMID": "42335163",
"PMCID": "PMC13289946",
"ISSN": "1932-6203",
"publisher": "PLOS",
"URL": "https://doi.org/10.1371/journal.pone.0352191",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
23
]
]
}
}

The tracing map gets a citation of its own once an author has validated it and it has a DOI.

Similar papers

The papers with a page that share the most with this one: the tools found in their code, their categories, datasets, cited references and authors, the rarest counting most.

[1] doi:10.3389/fnins.2023.1191683
Epileptic seizures detection and the analysis of optimal seizure prediction horizon based on frequency and phase analysis.
Journal: Frontiers in neuroscience
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 3 references
[2] doi:10.1186/s42492-025-00208-8
Comprehensive review of machine learning and deep learning techniques for epileptic seizure detection and prediction based on neuroimaging modalities.
Journal: Visual computing for industry, biomedicine, and art
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, EEG, 3 references
[3] doi:10.3390/s26030863
Explainable AI-Enhanced Ensemble Protocol Using Gradient-Boosted Models for Zero-False-Alarm Seizure Detection from EEG.
Journal: Sensors (Basel, Switzerland)
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, EEG, 3 references
[4] doi:10.3389/fphys.2023.1227952
Automatic epileptic seizure detection based on persistent homology.
Journal: Frontiers in physiology
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 2 references
[5] doi:10.1038/s41598-025-88492-5
Synchronization-based graph spatio-temporal attention network for seizure prediction.
Journal: Scientific reports
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, EEG, 2 references
[6] doi:10.3390/brainsci14040306
Evaluation of the Relation between Ictal EEG Features and XAI Explanations.
Journal: Brain sciences
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 2 references
[7] doi:10.3390/s22083066
Evaluation of Feature Selection Methods for Classification of Epileptic Seizure EEG Signals.
Journal: Sensors (Basel, Switzerland)
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 2 references
[8] doi:10.1098/rsos.230601 [code]
Epileptic seizure detection using CHB-MIT dataset: The overlooked perspectives.
Journal: Royal Society open science
In common: scikit-learn, pandas, SciPy, 2 other tools, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 2 references
[9] doi:10.3390/biomedicines12061283
Graphical Insight: Revolutionizing Seizure Detection with EEG Representation.
Journal: Biomedicines
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, EEG, 2 references
[10] doi:10.1002/epi4.12704 [code]
EEG datasets for seizure detection and prediction- A review.
Journal: Epilepsia open
In common: physionet.org/content/siena-scalp-eeg, physionet.org/content/chbmit, epilepsy, methods / tools, EEG, 1 reference

Contribute

The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.

Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.

Add the badge to the code's README

OSCR: the badge of this paper

If you are an author or a maintainer of this paper's code, you can add this badge. It says what OSCR knows of the paper (its code, its validated tracing map) and links the code to this page. Paste one of these snippets under the README's title. Keep the two marks around it, so that the badge can be replaced in place and is never added twice. OSCR changes nothing in your repository.

Markdown
<!-- oscr-badge:start -->
[![OSCR](https://openscicode.org/badge/doi/10.1371/journal.pone.0352191.svg)](https://openscicode.org/badge/doi/10.1371/journal.pone.0352191)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1371/journal.pone.0352191.svg
   :target: https://openscicode.org/badge/doi/10.1371/journal.pone.0352191
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1371/journal.pone.0352191"><img src="https://openscicode.org/badge/doi/10.1371/journal.pone.0352191.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

On GitHub, open the README, choose Edit (the pencil), paste the snippet under the title, then "Commit changes".

If you choose to, you can have the badge kept up to date for you, with oscr badge --write from the command line or with the GitHub Action in your repository's workflows. Every other form and option (a card, AsciiDoc, LaTeX, shields.io) is on the badge page.

Request its removal

To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).

Discussion, reproductions, activity

Discussion: code errors and mismatches between the code and the paper about this paper and its code, from readers and its authors, beside the paper and its tracing map.

Report a mismatch between the code and the paper · Report a code error (signed in)

Reproductions: reports from readers who ran the authors' code and did not get the paper's result, what they ran, with which environment, commit and data.

Report a reproduction failure (signed in)

Versions of its code: the releases of its code tied to a version of this paper (the preprint, the accepted manuscript, the version of record…), each with the tracing map versioned with it.

Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.