Pursuit of biomarkers of brain diseases: beyond cohort comparisons.
The 2 matches
- [1] § The case of brain activity-based biomarkers › Brain Swap ↔ AI_model.ipynb, lines 1–114 · score 0.56 · readout layer, RNN2, trained, RNN1, loss, RNNs
- [2] § The case of brain activity-based biomarkers › Brain Swap ↔ AI_model.ipynb, lines 1–114 · score 0.52 · hidden state, Adam, RNN2, layer, RNN1, loss
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 299 lines · 9.8 KB · GPL-3.0 · 2 matches
- # %%
- import torch
- import torch.nn as nn
- import torch.optim as optim
- import numpy as np
- import matplotlib.pyplot as plt
- # Set random seeds for reproducibility
- seed_num = 42
- torch.manual_seed(seed_num)
- np.random.seed(seed_num)
- # Parameters
- input_size = 10
- hidden_size = 50
- output_size = 1
- seq_length = 20
- batch_size = 32
- n_epochs = 100
- learning_rate = 0.01
- # Generate synthetic data
- def generate_data(batch_size, seq_length, input_size):
- X = torch.randn(batch_size, seq_length, input_size)
- # Simple task: predict the sum of the last 5 inputs
- y = torch.sum(X[:, -5:, :], dim=(1, 2)).unsqueeze(1)
- return X, y
- # Define the RNN model
- class RNNModel(nn.Module):
- def __init__(self, input_size, hidden_size, output_size):
- super(RNNModel, self).__init__()
- self.rnn = nn.RNN(input_size, hidden_size, batch_first=True)
- self.readout = nn.Linear(hidden_size, output_size)
- def forward(self, x):
- rnn_out, _ = self.rnn(x)
- # Take the last hidden state
- last_hidden = rnn_out[:, -1, :]
- output = self.readout(last_hidden)
- return output
- # Create two identical RNN models
- rnn1 = RNNModel(input_size, hidden_size, output_size)
- rnn2 = RNNModel(input_size, hidden_size, output_size)
- # Make rnn2's RNN identical to rnn1's RNN initially
- rnn2.rnn.load_state_dict(rnn1.rnn.state_dict())
- #rnn2.bias.load_state_dict(rnn1.bias.state_dict())
- # Verify they have the same parameters initially
- print("Initial parameter comparison:")
- for (name1, param1), (name2, param2) in zip(rnn1.named_parameters(), rnn2.named_parameters()):
- print(f"{name1} and {name2} equal: {torch.allclose(param1, param2)}")
- # Training setup
- criterion = nn.MSELoss()
- optimizer1 = optim.Adam(rnn1.parameters(), lr=learning_rate)
- optimizer2 = optim.Adam(rnn2.parameters(), lr=learning_rate)
- # Training loop
- for epoch in range(n_epochs):
- X, y = generate_data(batch_size, seq_length, input_size)
- # Train RNN1
- optimizer1.zero_grad()
- output1 = rnn1(X)
- loss1 = criterion(output1, y)
- loss1.backward()
- optimizer1.step()
- # Train RNN2
- optimizer2.zero_grad()
- output2 = rnn2(X)
- loss2 = criterion(output2, y)
- loss2.backward()
- optimizer2.step()
- if epoch % 10 == 0:
- print(f"Epoch {epoch}, Loss1: {loss1.item():.4f}, Loss2: {loss2.item():.4f}")
- # After training, compare the readout layers
- print("\nAfter training parameter comparison:")
- for (name1, param1), (name2, param2) in zip(rnn1.named_parameters(), rnn2.named_parameters()):
- print(f"{name1} and {name2} equal: {torch.allclose(param1, param2, atol=1e-4)}")
- # Test the models
- X_test, y_test = generate_data(batch_size, seq_length, input_size)
- with torch.no_grad():
- output1 = rnn1(X_test)
- output2 = rnn2(X_test)
- print(f"\nTest MSE RNN1: {criterion(output1, y_test).item():.4f}")
- print(f"Test MSE RNN2: {criterion(output2, y_test).item():.4f}")
- # Now drive the second readout with the first RNN's activity
- with torch.no_grad():
- rnn1_activity, _ = rnn1.rnn(X_test)
- rnn1_last_hidden = rnn1_activity[:, -1, :]
- output2_driven = rnn2.readout(rnn1_last_hidden)
- print(f"\nTest MSE when driving rnn2's readout with rnn1's activity: {criterion(output2_driven, y_test).item():.4f}")
- # Plot results
- plt.figure(figsize=(6, 3))
- plt.plot(y_test.numpy(), label='True')
- plt.plot(output1.numpy(), 'o', label='Model 1')
- plt.plot(output2.numpy(), 'o', label='Model 2')
- plt.plot(output2_driven.numpy(), 'x', label='Model 3')
- plt.legend(ncol=4,loc='upper left')
- plt.ylim((-15,24))
- #plt.title("Comparison of Outputs")
- plt.xlabel("Input ID")
- plt.ylabel("Output")
- plt.show()
- # %%
- import torch
- import torch.nn as nn
- import torch.optim as optim
- import numpy as np
- import matplotlib.pyplot as plt
- # Set random seeds for reproducibility
- seed_num = 0
- torch.manual_seed(seed_num)
- np.random.seed(seed_num)
- # Parameters
- input_size = 3 # Reduced for easier visualization
- seq_length = 20 # Reduced for easier visualization
- batch_size = 32
- n_epochs = 100
- learning_rate = 0.01
- # Generate synthetic data
- def generate_data(batch_size, seq_length, input_size):
- X = torch.randn(batch_size, seq_length, input_size)
- # Simple task: predict the sum of the last 5 inputs
- y = torch.sum(X[:, -5:, :], dim=(1, 2)).unsqueeze(1)
- return X, y
- # 1. Let's generate some sample data just for visualization
- X_vis, y_vis = generate_data(batch_size=3, seq_length=seq_length, input_size=input_size)
- # 2. Create a plot
- fig, axes = plt.subplots(3, 1, figsize=(3, 6))
- # Color map for the input features
- colors = ['black', 'black', 'black']
- matplot_colors = ["C{}".format(i) for i in range(20)]
- for i in range(3):
- ax = axes[i]
- # Plot each feature of the i-th sequence in the batch
- for feat in range(input_size):
- ax.plot(X_vis[i, :, feat].numpy(),
- color=colors[i],
- linestyle='-',
- marker='o',
- markersize=4,
- label=f'Feature {feat+1}' if i == 0 else ""
- )
- # Highlight the last 5 timesteps, which are used for the target sum
- ax.axvspan(seq_length-5, seq_length-1, alpha=0.3, label='Used for Target' if i == 0 else "")
- # Add the target value as text on the plot
- ax.text(0.40, 0.85, f'Output {i*32} = {y_vis[i].item():.2f}', transform=ax.transAxes,
- bbox=dict(boxstyle='round', facecolor=matplot_colors[0], alpha=0.3))
- ax.set_xlabel('Timestep')
- ax.set_title(f'Input {i*32}')
- ax.grid(True, linestyle='--', alpha=0.6)
- ax.set_xticks(np.arange(0, seq_length, 2))
- ax.set_xlim(0, 19)
- plt.tight_layout(rect=[0, 0.05, 1, 0.95]) # Adjust layout to make room for suptitle and legend
- plt.show()
- # %%
- import numpy as np
- import matplotlib.pyplot as plt
- from scipy.stats import multivariate_normal
- from sklearn.discriminant_analysis import LinearDiscriminantAnalysis
- def create_rotated_covariance(major_var, minor_var, angle_deg):
- """
- Create a covariance matrix with specified rotation and axis variances.
- Parameters:
- major_var: variance along the major axis (long direction)
- minor_var: variance along the minor axis (short direction)
- angle_deg: rotation angle in degrees (0° = aligned with x-axis)
- """
- # Convert angle to radians
- angle_rad = np.deg2rad(angle_deg)
- # Create rotation matrix
- cos_angle = np.cos(angle_rad)
- sin_angle = np.sin(angle_rad)
- R = np.array([[cos_angle, -sin_angle],
- [sin_angle, cos_angle]])
- # Create eigenvalue matrix (diagonal)
- Lambda = np.array([[major_var, 0],
- [0, minor_var]])
- # Compute covariance matrix: Σ = R Λ Rᵀ
- covariance = R @ Lambda @ R.T
- return covariance
- # Set parameters
- angle = -45 # Keep rotation constant at 45°
- major_var_1, minor_var_1 = 3.0, 0.1 # First Gaussian: long and thin
- major_var_2, minor_var_2 = 2., 0.2 # Second Gaussian: also long and thin, but different
- # Create covariance matrices with same rotation but different shapes
- cov1 = create_rotated_covariance(major_var_1, minor_var_1, angle)
- cov2 = create_rotated_covariance(major_var_2, minor_var_2, angle)
- # Set random seed for reproducibility
- np.random.seed(42)
- # Create the figure with subplots
- plt.figure(figsize=(6, 5))
- # Generate data
- n_samples = 1000
- # Create two correlated 2D distributions
- mean1 = [1.2, 1]
- #cov1 = [[2, -1.6], [-0.4, .5]] # Positive correlation
- mean2 = [2, 2]
- #cov2 = [[1, -0.8], [-0.8, 1]] # Negative correlation
- # Generate samples
- samples1 = np.random.multivariate_normal(mean1, cov1, n_samples)
- samples2 = np.random.multivariate_normal(mean2, cov2, n_samples)
- # Prepare data for LDA
- X = np.vstack((samples1, samples2)) # Combine all features
- y = np.hstack((np.zeros(n_samples), np.ones(n_samples))) # Create labels: Class1=0, Class2=1
- # Fit Linear Discriminant Analysis (LDA)
- lda = LinearDiscriminantAnalysis()
- lda.fit(X, y)
- # Main 2D scatter plot
- ax_scatter = plt.subplot2grid((3, 3), (1, 0), colspan=2, rowspan=2)
- ax_scatter.scatter(samples1[:, 0], samples1[:, 1], alpha=0.6, label='Group 1', s=10)
- ax_scatter.scatter(samples2[:, 0], samples2[:, 1], alpha=0.6, label='Group 2', s=10)
- ax_scatter.set_xlabel('Feature 1')
- ax_scatter.set_ylabel('Feature 2')
- #ax_scatter.set_title('2D View: Easy Separation')
- ax_scatter.legend()
- ax_scatter.grid(True, alpha=0.1)
- # --- Plot the LDA separatrix ---
- # Create a mesh grid covering the plot area
- x_min, x_max = ax_scatter.get_xlim()
- y_min, y_max = ax_scatter.get_ylim()
- xx, yy = np.meshgrid(np.linspace(x_min, x_max, 100),
- np.linspace(y_min, y_max, 100))
- # Predict class probabilities for each grid point
- Z = lda.predict_proba(np.c_[xx.ravel(), yy.ravel()])[:, 1]
- Z = Z.reshape(xx.shape)
- # Plot the decision boundary (separatrix) at P(class=1) = 0.5
- contour = ax_scatter.contour(xx, yy, Z, levels=[0.5], colors='red', linewidths=3, linestyles='dashed')
- ax_scatter.clabel(contour, inline=True, fontsize=0)
- #, fmt='P(Class2)=0.5'
- # X marginal (top)
- ax_x_marginal = plt.subplot2grid((3, 3), (0, 0), colspan=2)
- ax_x_marginal.hist(samples1[:, 0], bins=30, alpha=0.5, density=True, label='Class 1')
- ax_x_marginal.hist(samples2[:, 0], bins=30, alpha=0.5, density=True, label='Class 2')
- ax_x_marginal.set_title('Feature 1')
- ax_x_marginal.set_ylabel('Density')
- #ax_x_marginal.legend()
- #ax_x_marginal.grid(True, alpha=0.3)
- # Y marginal (right)
- ax_y_marginal = plt.subplot2grid((3, 3), (1, 2), rowspan=2)
- ax_y_marginal.hist(samples1[:, 1], bins=30, orientation='horizontal', alpha=0.5, density=True, label='Class 1')
- ax_y_marginal.hist(samples2[:, 1], bins=30, orientation='horizontal', alpha=0.5, density=True, label='Class 2')
- ax_y_marginal.set_title('Feature 2')
- ax_y_marginal.set_xlabel('Density')
- #ax_y_marginal.legend()
- #ax_y_marginal.grid(True, alpha=0.3)
- # Add some empty space for better layout
- #ax_empty = plt.subplot2grid((4, 4), (0, 2), rowspan=1)
- #ax_empty.axis('off')
- plt.tight_layout()
- plt.show()
AI_model.ipynb at commit d159a15, under GPL-3.0 · at the source
Overview
- School of Electrical Engineering and Computer Science and Digital Futures, KTH Royal Institute of Technology Stockholm,Stockholm, Sweden
- Science For Life Laboratory,Solna, Sweden
- UMR 5293, IMN, University of Bordeaux, CNRS,Bordeaux, France
Abstract
Despite the diversity and volume of brain data acquired and advanced AI-based algorithms to analyze them, brain features are rarely used in clinics for diagnosis and prognosis. Here we argue that the field continues to rely on cohort comparisons to seek biomarkers, despite the well-established degeneracy of brain features. Using a thought experiment (Brain Swap), we show that more data and more powerful algorithms will not be sufficient to identify biomarkers of brain diseases. We argue that instead of comparing patient versus healthy controls using single data type, we should use multimodal (e.g. brain activity, neurotransmitters, neuromodulators, brain imaging) and longitudinal brain data to guide the grouping before defining multidimensional biomarkers for brain diseases.
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 2 matches between paragraphs and lines of code.
paschels/brain_disease_biomarker
d159a15239d4e885edfc89c3a8e6783416a42411, 24 November 2025Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
3 files
- AI_model.ipynb, Jupyter, 299 lines, 2 matches
- LICENCE.txt, License, 226 lines
- README.md, Text, 5 lines
Code availability
We used Pytorch for our code, which you can find at https://
Reproduced under the paper's license (CC BY), from the paper cited above.
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;
- 1 script, each with its path and the digest of its content;
- 2 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
No dataset and no data link were found in the paper.
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 1, 29 September 2026: the first record
Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 4 keywords, 1 funder, 46 references.
Cite
This paper
Helson, P., & Kumar, A. (2026). Pursuit of biomarkers of brain diseases: beyond cohort comparisons. NPJ digital medicine, 9(1), 361. https://
BibTeX
@article{helson2026pursu
author = {Helson, Pascal and Kumar, Arvind},
title = {{Pursuit of biomarkers of brain diseases: beyond cohort comparisons}},
journal = {NPJ digital medicine},
year = {2026},
month = apr,
volume = {9},
number = {1},
pages = {361},
publisher = {Nature Publishing Group},
issn = {2398-6352},
doi = {10.1038/
url = {https://
pmid = {41963496},
pmcid = {PMC13156286}
}
RIS
TY - JOUR
AU - Helson, Pascal
AU - Kumar, Arvind
TI - Pursuit of biomarkers of brain diseases: beyond cohort comparisons
T2 - NPJ digital medicine
J2 - NPJ Digit Med
PY - 2026
DA - 2026/
VL - 9
IS - 1
SP - 361
SN - 2398-6352
PB - Nature Publishing Group
DO - 10.1038/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.1038/
"type": "article-journal",
"title": "Pursuit of biomarkers of brain diseases: beyond cohort comparisons",
"container-title": "NPJ digital medicine",
"author": [
{
"family": "Helson",
"given": "Pascal"
},
{
"family": "Kumar",
"given": "Arvind"
}
],
"container-title-short":
"volume": "9",
"issue": "1",
"page": "361",
"DOI": "10.1038/
"PMID": "41963496",
"PMCID": "PMC13156286",
"ISSN": "2398-6352",
"publisher": "Nature Publishing Group",
"URL": "https://
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
10
]
]
}
}
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.1038/s41467-026-71918-7 [code]
- Developmental disinhibition gates language lateralization in childhood.Journal: Nature communicationsIn common: PyTorch, scikit-learn, SciPy, 2 other tools, 3 references
- [2] doi:10.1186/s12916-026-04903-y [code]
- Structural connectome architecture and biological vulnerability shape cortical atrophy in cocaine use disorder.Journal: BMC medicineIn common: scikit-learn, SciPy, Matplotlib, 1 other tool, 3 references
- [3] doi:10.1038/s41593-026-02205-3 [code]
- Competitive interactions shape mammalian brain network dynamics and computation.Journal: Nature neuroscienceIn common: PyTorch, scikit-learn, SciPy, 2 other tools, 2 references
- [4] doi:10.1371/journal.pone.0344600 [code]
- Robust disease prognosis via diagnostic knowledge preservation: A sequential learning approach.Journal: PloS oneIn common: PyTorch, scikit-learn, SciPy, 2 other tools, clinical / translational, 1 reference
- [5] doi:10.1038/s41467-026-71555-0 [code]
- A deep representation learning model to predict response to vagus nerve stimulation.Journal: Nature communicationsIn common: PyTorch, scikit-learn, SciPy, 2 other tools, clinical / translational, 1 reference
- [6] doi:10.1093/braincomms/fcag253 [code]
- Disease detection and classification in temporal lobe epilepsy: step-wise versus simultaneous AI decision models in a multisite neuroimaging study.Journal: Brain communicationsIn common: PyTorch, scikit-learn, SciPy, 2 other tools, clinical / translational, 1 reference
- [7] doi:10.1038/s41467-026-71961-4 [code]
- Spatiotemporal asymmetries on brain energy landscape uncover system entrapment related to depression severity.Journal: Nature communicationsIn common: scikit-learn, SciPy, Matplotlib, 1 other tool, 2 references
- [8] doi:10.1038/s43856-026-01606-6 [code]
- Validation of remote multimodal AI screening for Parkinson disease across diverse settings.Journal: Communications medicineIn common: PyTorch, scikit-learn, SciPy, 2 other tools, clinical / translational, 1 reference
- [9] doi:10.1038/s41398-026-04101-7 [code]
- Using deep learning to identify brain networks mediating cognitive and motor impairments in alcohol use disorder.Journal: Translational psychiatryIn common: PyTorch, scikit-learn, SciPy, 2 other tools, 1 reference
- [10] doi:10.1162/imag.a.1269 [code]
- From early to contemporary normative modeling: Mapping individual differences in neurophysiological signals.Journal: Imaging neuroscience (Cambridge, Mass.)In common: scikit-learn, SciPy, Matplotlib, 1 other tool, 2 references
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.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 1 script, and 2 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:8bd2ef27133eb1f5…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
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: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
