OSCR

Low-dimensional and optimised representations of high-level information in the expert brain.

Code ↔ Paper

40 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.

30 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 40 matches · 1 of them tie a paragraph to a whole file without given lines: a weak match, whose lines are not tinted
  1. [1] § Methods › Regions of Interest (ROIs) ↔ chess-supplementary/subcortical-rois/01_prepare_atlas.py, lines 1 to 55 · score 0.93 · volumetric MNI space, CAB NP atlas, glasser hcp, bilateral masks, subcortical structures, parcels · block oscr:b:84KYTYDAR8JF2-B · Report a mismatch
  2. [2] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ chess-supplementary/task-engagement/13_quantify_preference_drivers.py, lines 1 to 81 · score 0.92 · edge density, image entropy, uniquely predicted, board preferences, explained variance, checkmate status · block oscr:b:XR7B7XMAMK3VJ-J · Report a mismatch
  3. [3] § Results › Skill-gradient analysis ↔ chess-supplementary/skill-gradient/11_skill_gradient_group.py, lines 1 to 53 · score 0.88 · chess skill, RSA model fit, neural metrics, Elo rating, move accuracy, fMRI · block oscr:b:DRFN757GA8K2G-N · Report a mismatch
  4. [4] § Results › Where information is encoded: domain-general networks › Univariate networks involvement › Multivariate representational shift ↔ common/neuro_utils.py, lines 1032 to 1177 · score 0.87 · temporo parieto occipital, posterior cingulate, superior parietal, dLPFC, right hemisphere, VVS · block oscr:b:NE66WCW6PXGDZ-Y · Report a mismatch
  5. [5] § Results › Where information is encoded: domain-general networks › Univariate networks involvement › Multivariate representational shift ↔ common/neuro_utils.py, lines 1031 to 1176 · score 0.87 · temporo parieto occipital, posterior cingulate, superior parietal, dLPFC, right hemisphere, VVS · block oscr:b:APVAWEKPGMF4H-Y · Report a mismatch
  6. [6] § Methods › Participation ratio ↔ analyses/manifold/models.py, lines 262 to 376 · score 0.86 · cross validated accuracy, training fold, logistic regression, Classification accuracy, shuffled, stratified · block oscr:b:SY86KMXKD6P2D-Q · Report a mismatch
  7. [7] § Results › Where information is encoded: domain-general networks › Univariate networks involvement ↔ common/neuro_utils.py, lines 1032 to 1177 · score 0.84 · temporo parieto occipital, posterior cingulate, superior parietal, dLPFC, VVS, PCC · block oscr:b:NE66WCW6PXGDZ-Y · Report a mismatch
  8. [8] § Results › Where information is encoded: domain-general networks › Univariate networks involvement ↔ common/neuro_utils.py, lines 1031 to 1176 · score 0.84 · temporo parieto occipital, posterior cingulate, superior parietal, dLPFC, VVS, PCC · block oscr:b:APVAWEKPGMF4H-Y · Report a mismatch
  9. [9] § Results › What is represented: perceptual to relational content › Neural representational geometry ↔ chess-supplementary/rsa-rois/81_table_rsa_rois.py, lines 1 to 78 · score 0.80 · scipy.stats.ttest_ind, theoretical model RDMs, equal_var, Benjamini Hochberg, neural RDMs, confidence intervals · block oscr:b:FSEHEPZ1895CB-E · Report a mismatch
  10. [10] § Results › What is represented: perceptual to relational content › Neural representational geometry ↔ chess-supplementary/mvpa-finer/81_table_mvpa_finer_rsa.py, lines 1 to 79 · score 0.79 · scipy.stats.ttest_ind, theoretical model RDMs, equal_var, Benjamini Hochberg, neural RDMs, confidence intervals · block oscr:b:8XX8KCCTVC93S-E · Report a mismatch
  11. [11] § Methods › Representational similarity analysis (RSA) › Behavioural representational similarity analysis ↔ chess-behavioral/81_table_behavioral_correlations.py, lines 1 to 63 · score 0.77 · correlation coefficient, Benjamini Hochberg, discovery rate, behavioural RDM, confidence intervals, model RDM · block oscr:b:QWM9M9PRAGG0X-K · Report a mismatch
  12. [12] § Methods › Meta-analytic correlation analysis › RSA maps preparation ↔ chess-neurosynth/12_rsa_neurosynth.py, lines 200 to 274 · score 0.77 · general linear model, correlation maps, RSA model, arctanh, intercept, Fisher · block oscr:b:032B5SF788RJ6-3 · Report a mismatch
  13. [13] § Methods › Meta-analytic correlation analysis › Neurosynth term maps ↔ common/constants.py, lines 207 to 264 · score 0.77 · Memory retrieval, language network, fine grained, Working memory, Navigation, configurations · block oscr:b:T5B4YP123CEAX-Z · Report a mismatch
  14. [14] § Results › How representations are structured: compressed geometry › Participant classification based on dimensionality profiles ↔ chess-manifold/91_plot_manifold_panels.py, lines 1 to 58 · score 0.76 · ROI PR matrix, logistic regression, decision boundary, PCA projection, ROI space, Heatmap · block oscr:b:GZ8TQ35E0C4ZR-X · Report a mismatch
  15. [15] § Results › How representations are structured: compressed geometry › Participant classification based on dimensionality profiles ↔ chess-manifold/91_plot_manifold_panels.py, lines 1 to 58 · score 0.76 · ROI PR matrix, logistic regression, decision boundary, PCA projection, ROI space, Heatmap · block oscr:b:FRPNWM1G0GJ2A-G · Report a mismatch
  16. [16] § Methods › Representational similarity analysis (RSA) › Behavioural representational similarity analysis ↔ common/rsa_utils.py, lines 81 to 151 · score 0.76 · lower triangles, correlation coefficient, Pearson correlations, confidence intervals, behavioural RDM, model RDM · block oscr:b:PRDTZX94MV3SW-A · Report a mismatch
  17. [17] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ chess-behavioral/81_table_behavioral_correlations.py, lines 1 to 63 · score 0.75 · behavioural Representational Dissimilari, Benjamini Hochberg, checkmate status, behavioural RSA, behavioural RDM, confidence intervals · block oscr:b:QWM9M9PRAGG0X-K · Report a mismatch
  18. [18] § Methods › Participation ratio ↔ chess-supplementary/run-matching/11_pr_run_matched.py, lines 64 to 149 · score 0.72 · permuted, exceeding, shuffled, recomputed, stratified, logistic · block oscr:b:8Q1CGA87C4Q72-R · Report a mismatch
  19. [19] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ chess-behavioral/91_plot_behavioral_panels.py, lines 1 to 59 · score 0.71 · Expert directional preference, MDS embedding, selection frequencies, behavioural RDMs, matrices · block oscr:b:1GYYFJSS07M4H-L · Report a mismatch
  20. [20] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ chess-behavioral/91_plot_behavioral_panels.py, lines 1 to 59 · score 0.71 · Expert directional preference, MDS embedding, selection frequencies, behavioural RDMs, matrices · block oscr:b:WQD9R1D5VGXXX-Y · Report a mismatch
  21. [21] § Methods › Representational similarity analysis (RSA) › Behavioural representational similarity analysis ↔ chess-behavioral/91_plot_behavioral_panels.py, lines 1 to 59 · score 0.71 · directional preference matrix, pairwise preference, pairwise comparisons, behavioural RDM, symmetric, raw · block oscr:b:1GYYFJSS07M4H-L · Report a mismatch
  22. [22] § Methods › Representational similarity analysis (RSA) › Behavioural representational similarity analysis ↔ chess-behavioral/91_plot_behavioral_panels.py, lines 1 to 59 · score 0.71 · directional preference matrix, pairwise preference, pairwise comparisons, behavioural RDM, symmetric, raw · block oscr:b:WQD9R1D5VGXXX-Y · Report a mismatch
  23. [23] § Methods › Participation ratio ↔ analyses/manifold/models.py, lines 27 to 89 · score 0.70 · logistic regression classifier, distinguishing Experts, cross validation, trained, weight, PR · block oscr:b:AB6AY8273QG3K-9 · Report a mismatch
  24. [24] § Results › Where information is encoded: domain-general networks ↔ chess-supplementary/neurosynth-terms/91_plot_neurosynth_terms.py, lines 221 to 275 · score 0.70 · Language Network, Memory Retrieval, Neurosynth term, Working Memory, Navigation, maps · block oscr:b:6P5DVA4R95318-D · Report a mismatch
  25. [25] § Results › Where information is encoded: domain-general networks ↔ common/constants.py, lines 207 to 264 · score 0.69 · Language Network, Memory Retrieval, Working Memory, Neurosynth term, Navigation, chess · block oscr:b:T5B4YP123CEAX-Z · Report a mismatch
  26. [26] § Methods › Regions of Interest (ROIs) ↔ chess-supplementary/subcortical-rois/11_subcortical_group_rsa.py, lines 1 to 68 · score 0.69 · CAB NP atlas, subcortical structures, exploratory, parcellation, bilateral, Glasser · block oscr:b:4CM85JP2G2B2N-O · Report a mismatch
  27. [27] § Methods › Meta-analytic correlation analysis › Neurosynth term maps ↔ chess-supplementary/neurosynth-terms/91_plot_neurosynth_terms.py, lines 221 to 275 · score 0.69 · Memory retrieval, language network, Working memory, Navigation, Neurosynth, maps · block oscr:b:6P5DVA4R95318-D · Report a mismatch
  28. [28] § Methods › Representational similarity analysis (RSA) › fMRI representational similarity analysis › RSA on Regions of Interest ↔ chess-supplementary/run-matching/01_roi_rsa_run_matched.m, lines 72 to 210 · score 0.68 · cosmo target dsm, neural RDM, model RDM, corr, Pearson, regressor · block oscr:b:3Y2ZA8Q6YJMX4-B · Report a mismatch
  29. [29] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ common/rsa_utils.py, lines 81 to 151 · score 0.68 · lower triangle, Pearson correlations, behavioural RSA, confidence intervals, behavioural RDM, model RDM · block oscr:b:PRDTZX94MV3SW-A · Report a mismatch
  30. [30] § Methods › Participation ratio ↔ analyses/manifold/pr_computation.py, lines 26 to 108 · score 0.65 · evenly distributed, effective dimensionality, Participation Ratio, components, PR, variance · block oscr:b:CQ34VVD3SJJDZ-Z · Report a mismatch
  31. [31] § Methods › Representational similarity analysis (RSA) › fMRI representational similarity analysis ↔ chess-supplementary/rdm-intercorrelation/81_table_rdm_intercorr.py, lines 1 to 78 · score 0.64 · pairwise correlation, dissimilarity matrices, checkmate status, Model RDMs, variables, Theoretical · block oscr:b:QC4F7GVGSBTBN-I · Report a mismatch
  32. [32] § Methods › Representational similarity analysis (RSA) › fMRI representational similarity analysis › Whole-brain Searchlight RSA ↔ chess-mvpa/04_searchlight_rsa.m, lines 204 to 261 · score 0.64 · searchlight RSA, correlation distance, model RDM, neighbourhoods, Pearson, voxel · block oscr:b:FZYG9QQPN5SAR-Q · Report a mismatch
  33. [33] § Results › Where information is encoded: domain-general networks › Univariate networks involvement › Multivariate representational shift ↔ chess-neurosynth/81_table_neurosynth_univariate.py, lines 1 to 57 · score 0.63 · bootstrap confidence intervals, activation patterns, Meta Analytic, FDR corrected, univariate, Neurosynth · block oscr:b:4EWPBQ3WBWB1J-A · Report a mismatch
  34. [34] § Results › What is represented: perceptual to relational content › Behavioural representational geometry ↔ chess-supplementary/behavioral-reliability/12_marginal_split_half.py, lines 1 to 80 · score 0.63 · split half reliability, pairwise comparison, marginal, status, behavioural, preferences · block oscr:b:C8ZTBH3K0H07J-I · Report a mismatch
  35. [35] § Methods › fMRI univariate analysis ↔ chess-neurosynth/12_rsa_neurosynth.py, lines 200 to 274 · score 0.62 · General Linear Model, map correlations, smoothed, mm, neurosynth, GLM · block oscr:b:032B5SF788RJ6-3 · Report a mismatch
  36. [36] § Results › How representations are structured: compressed geometry › Participant classification based on dimensionality profiles ↔ analyses/manifold/models.py, lines 262 to 376 · score 0.62 · cross validated accuracy, fold CV, stratified, permutation, PCA, classifier · block oscr:b:SY86KMXKD6P2D-Q · Report a mismatch
  37. [37] § Results › Where information is encoded: domain-general networks › Univariate networks involvement › Multivariate representational shift ↔ chess-neurosynth/82_table_neurosynth_rsa.py, lines 1 to 48 · score 0.62 · bootstrap confidence intervals, RSA searchlight, Meta Analytic, FDR corrected, Neurosynth, cognitive · block oscr:b:B99CXHS872WKR-0 · Report a mismatch
  38. [38] § Methods › Representational similarity analysis (RSA) › fMRI representational similarity analysis › RSA on Regions of Interest ↔ chess-supplementary/mvpa-finer/01_roi_decoding_fine.m, lines 84 to 217 · score 0.62 · cosmo target dsm, corresponding model RDM, regressor, RSA, ROI, correlated · block oscr:b:PHGR3G8HVJTT6-K · Report a mismatch
  39. [39] § Methods › Representational similarity analysis (RSA) › fMRI representational similarity analysis › Whole-brain Searchlight RSA ↔ common/constants.py, lines 162 to 205 · score 0.61 · brain searchlight RSA, Neurosynth term maps, model RDM, matched, ROIs · block oscr:b:WYHB23Y6C7KZM-4 · Report a mismatch
  40. [40] § Methods › Software ↔ common/chess_config.m, the whole file · a weak match · score 0.61 · Eye tracking, fMRIPrep, MATLAB, preprocessing, manifold, GLM · block oscr:b:K13K6YN1R2P4D-H · 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 · 379 lines · 13 KB · MIT · 3 matches

  1. """
  2. Machine learning utilities for expert vs novice classification.
  3. This module provides functions for training classifiers to distinguish between
  4. expert and novice chess players based on their neural participation ratios,
  5. and for visualizing the results using PCA.
  6. Functions
  7. ---------
  8. train_logreg_on_pr : Train logistic regression on PR features
  9. compute_pca_2d : Compute 2D PCA projection for visualization
  10. compute_2d_decision_boundary : Precompute decision boundary grid for plotting
  11. """
  12. import logging
  13. import numpy as np
  14. import pandas as pd
  15. from typing import Tuple, Dict, Any
  16. from sklearn.linear_model import LogisticRegression
  17. from sklearn.preprocessing import StandardScaler
  18. from sklearn.decomposition import PCA
  19. from sklearn.model_selection import StratifiedKFold, cross_val_score, permutation_test_score
  20. logger = logging.getLogger(__name__)
  21. def train_logreg_on_pr(
  22. pr_df: pd.DataFrame,
  23. participants: pd.DataFrame,
  24. roi_labels: np.ndarray,
  25. random_seed: int = 42
  26. ) -> Tuple[LogisticRegression, StandardScaler, np.ndarray, np.ndarray]:
  27. """
  28. Train a logistic regression classifier to distinguish experts from novices.
  29. The classifier uses PR values across all ROIs as features. Feature weights
  30. indicate which ROIs are most discriminative between groups.
  31. Parameters
  32. ----------
  33. pr_df : pd.DataFrame
  34. Long-format PR results (columns: subject_id, ROI_Label, PR, n_voxels)
  35. participants : pd.DataFrame
  36. Participant metadata (columns: participant_id, group)
  37. roi_labels : np.ndarray
  38. ROI labels defining feature order
  39. random_seed : int, default=42
  40. Random seed for reproducibility
  41. Returns
  42. -------
  43. clf : LogisticRegression
  44. Trained classifier (clf.coef_ contains feature importance weights)
  45. scaler : StandardScaler
  46. Fitted scaler for transforming new data
  47. all_pr_scaled : np.ndarray
  48. Standardized PR data (shape: n_subjects × n_rois)
  49. labels : np.ndarray
  50. Binary labels (1=expert, 0=novice)
  51. Notes
  52. -----
  53. Data is standardized before training because different ROIs have different
  54. PR scales. Without standardization, high-variance ROIs would dominate.
  55. The classifier is trained on ALL data (no cross-validation) because the goal
  56. is feature importance analysis, not generalization performance.
  57. """
  58. logger.info("Training logistic regression on PR features (expert vs novice)...")
  59. all_pr, labels, n_expert, n_novice = build_feature_matrix(
  60. pr_df,
  61. participants,
  62. roi_labels,
  63. )
  64. # Standardize features
  65. scaler = StandardScaler()
  66. all_pr_scaled = scaler.fit_transform(all_pr)
  67. # Train classifier
  68. clf = LogisticRegression(random_state=random_seed, max_iter=1000)
  69. clf.fit(all_pr_scaled, labels)
  70. logger.info(f" Trained on {len(all_pr)} subjects "
  71. f"({n_expert} experts, {n_novice} novices)")
  72. logger.info(f" Using {len(roi_labels)} ROI features")
  73. return clf, scaler, all_pr_scaled, labels
  74. def compute_pca_2d(
  75. data_scaled: np.ndarray,
  76. n_components: int = 2,
  77. random_seed: int = 42
  78. ) -> Tuple[PCA, np.ndarray, np.ndarray]:
  79. """
  80. Compute PCA embedding for 2D visualization.
  81. PCA finds directions of maximum variance and projects the high-dimensional
  82. PR data into 2D for visualization.
  83. Parameters
  84. ----------
  85. data_scaled : np.ndarray
  86. Standardized data (shape: n_subjects × n_features)
  87. n_components : int, default=2
  88. Number of components (2 for 2D visualization)
  89. random_seed : int, default=42
  90. Random seed for reproducibility
  91. Returns
  92. -------
  93. pca : PCA
  94. Fitted PCA object (pca.components_ shows ROI loadings on each PC)
  95. coords_2d : np.ndarray
  96. 2D coordinates (shape: n_subjects × 2)
  97. explained_variance_pct : np.ndarray
  98. Percentage of variance explained by each PC
  99. Notes
  100. -----
  101. PC1 captures the direction of maximum variance, PC2 captures the second-
  102. maximum variance orthogonal to PC1. Together they often capture major
  103. group differences.
  104. """
  105. logger.info("Computing 2D PCA embedding...")
  106. # Fit PCA and transform data
  107. pca = PCA(n_components=n_components, random_state=random_seed)
  108. coords_2d = pca.fit_transform(data_scaled)
  109. # Get variance explained
  110. explained_variance_pct = (pca.explained_variance_ratio_ * 100).astype(float)
  111. logger.info(f" PC1 explains {explained_variance_pct[0]:.1f}% variance")
  112. logger.info(f" PC2 explains {explained_variance_pct[1]:.1f}% variance")
  113. return pca, coords_2d, explained_variance_pct
  114. def compute_2d_decision_boundary(
  115. coords_2d: np.ndarray,
  116. labels: np.ndarray,
  117. random_seed: int = 42,
  118. grid_resolution: int = 200
  119. ) -> Tuple[np.ndarray, np.ndarray, np.ndarray]:
  120. """
  121. Precompute decision boundary grid for 2D visualization.
  122. Trains a simple classifier in 2D space and evaluates it on a dense grid,
  123. creating a smooth decision boundary for plotting.
  124. Parameters
  125. ----------
  126. coords_2d : np.ndarray
  127. 2D coordinates from PCA (shape: n_subjects × 2)
  128. labels : np.ndarray
  129. Binary labels (1=expert, 0=novice)
  130. random_seed : int, default=42
  131. Random seed for reproducibility
  132. grid_resolution : int, default=200
  133. Grid points per axis (higher = smoother boundary)
  134. Returns
  135. -------
  136. xx : np.ndarray
  137. X-coordinates of grid (shape: grid_resolution × grid_resolution)
  138. yy : np.ndarray
  139. Y-coordinates of grid (shape: grid_resolution × grid_resolution)
  140. Z : np.ndarray
  141. Predicted class at each grid point (for contour plotting)
  142. Notes
  143. -----
  144. The boundary shows how well groups separate in the 2D PCA space. It's for
  145. visualization only - actual group discrimination happens in full-dimensional
  146. space (see train_logreg_on_pr).
  147. """
  148. logger.info("Computing 2D decision boundary for visualization...")
  149. # Train simple classifier in 2D
  150. clf_2d = LogisticRegression(random_state=random_seed, max_iter=1000)
  151. clf_2d.fit(coords_2d, labels)
  152. # Create grid with 1-unit margins
  153. x_min, x_max = coords_2d[:, 0].min() - 1, coords_2d[:, 0].max() + 1
  154. y_min, y_max = coords_2d[:, 1].min() - 1, coords_2d[:, 1].max() + 1
  155. xx, yy = np.meshgrid(
  156. np.linspace(x_min, x_max, grid_resolution),
  157. np.linspace(y_min, y_max, grid_resolution)
  158. )
  159. # Predict at each grid point
  160. Z = clf_2d.predict(np.c_[xx.ravel(), yy.ravel()]).reshape(xx.shape)
  161. logger.info(f" Computed {grid_resolution}×{grid_resolution} grid")
  162. return xx, yy, Z
  163. __all__ = [
  164. 'train_logreg_on_pr',
  165. 'compute_pca_2d',
  166. 'compute_2d_decision_boundary',
  167. ]
  168. def build_feature_matrix(
  169. pr_df: pd.DataFrame,
  170. participants: pd.DataFrame,
  171. roi_labels: np.ndarray,
  172. ) -> Tuple[np.ndarray, np.ndarray, int, int]:
  173. """
  174. Public API to construct feature matrix X (subjects × ROIs) and labels y.
  175. Parameters
  176. ----------
  177. pr_df : pd.DataFrame
  178. Long-format PR results (columns: subject_id, ROI_Label, PR)
  179. participants : pd.DataFrame
  180. Participant metadata (columns: participant_id, group)
  181. roi_labels : np.ndarray
  182. ROI labels defining column order
  183. Returns
  184. -------
  185. X : np.ndarray
  186. Feature matrix ordered by [experts, novices]
  187. y : np.ndarray
  188. Binary labels (1=expert, 0=novice)
  189. n_expert : int
  190. Number of expert subjects
  191. n_novice : int
  192. Number of novice subjects
  193. """
  194. from common.bids_utils import merge_group_labels
  195. from .utils import ensure_roi_order
  196. pr_with_group = merge_group_labels(pr_df, participants, subject_col='subject_id')
  197. expert_pr = pr_with_group[pr_with_group['group'] == 'expert'].pivot(
  198. index='subject_id',
  199. columns='ROI_Label',
  200. values='PR'
  201. )
  202. expert_pr = ensure_roi_order(expert_pr, roi_labels)[roi_labels].values
  203. novice_pr = pr_with_group[pr_with_group['group'] == 'novice'].pivot(
  204. index='subject_id',
  205. columns='ROI_Label',
  206. values='PR'
  207. )
  208. novice_pr = ensure_roi_order(novice_pr, roi_labels)[roi_labels].values
  209. X = np.vstack([expert_pr, novice_pr])
  210. y = np.array([1] * len(expert_pr) + [0] * len(novice_pr))
  211. return X, y, len(expert_pr), len(novice_pr)
  212. def evaluate_classification_significance(
  213. pr_df: pd.DataFrame,
  214. participants: pd.DataFrame,
  215. roi_labels: np.ndarray,
  216. space: str = 'roi',
  217. random_seed: int = 42,
  218. n_splits: int = None,
  219. n_permutations: int = 1000,
  220. ) -> Dict[str, Any]:
  221. """
  222. Evaluate whether classification accuracy exceeds chance using CV and permutations.
  223. Methods (for papers)
  224. --------------------
  225. Feature construction: For each subject we build a feature vector from PR
  226. values across ROIs with a binary label (1=expert, 0=novice). We use a
  227. scikit‑learn Pipeline with StandardScaler, and for the 2D analysis we add
  228. PCA(n_components=2) inside the pipeline so PCA is fit only on training folds.
  229. Cross‑validation: We estimate performance with stratified K‑fold CV (K is
  230. the largest feasible up to 5 given class sizes). The classifier is logistic
  231. regression (max_iter=1000). We report the mean accuracy across folds and
  232. the standard deviation across folds as a descriptive spread.
  233. Inference via permutation: Statistical significance for above‑chance
  234. performance is assessed with a label‑permutation test using
  235. `permutation_test_score`, run with the same CV and full pipeline. This
  236. yields an assumption‑light p‑value for the null that accuracy equals chance
  237. (0.5 for balanced classes).
  238. Parameters
  239. ----------
  240. pr_df : pd.DataFrame
  241. Long-format PR results.
  242. participants : pd.DataFrame
  243. Participant metadata with group labels.
  244. roi_labels : np.ndarray
  245. ROI labels defining feature order.
  246. space : {'roi', 'pca2d'}, default='roi'
  247. Feature space to evaluate. 'roi' uses all ROIs as features; 'pca2d'
  248. uses a pipeline with PCA(2) fit within each CV fold.
  249. random_seed : int, default=42
  250. Random seed for reproducibility.
  251. n_splits : int or None, default=None
  252. Number of CV folds (StratifiedKFold). If None, chooses the maximum
  253. feasible up to 5 given class counts.
  254. n_permutations : int, default=1000
  255. Number of permutations for permutation test.
  256. Returns
  257. -------
  258. dict
  259. Dictionary with keys:
  260. - 'space': 'roi' or 'pca2d'
  261. - 'cv_accuracy_mean', 'cv_accuracy_std'
  262. - 'n_splits', 'n_subjects', 'n_experts', 'n_novices'
  263. - 'perm_pvalue', 'perm_null_mean', 'perm_null_std', 'n_permutations'
  264. """
  265. from sklearn.pipeline import Pipeline
  266. logger.info(f"Evaluating classification significance in '{space}' space...")
  267. X, y, n_expert, n_novice = build_feature_matrix(pr_df, participants, roi_labels)
  268. n_subjects = X.shape[0]
  269. # Determine feasible number of splits
  270. if n_splits is None:
  271. max_splits = max(2, min(5, n_expert, n_novice))
  272. n_splits = max_splits
  273. if n_splits < 2 or n_splits > min(n_expert, n_novice):
  274. n_splits = min(max(2, n_splits), n_expert, n_novice)
  275. cv = StratifiedKFold(n_splits=n_splits, shuffle=True, random_state=random_seed)
  276. steps = [('scaler', StandardScaler())]
  277. if space.lower() in ['pca2d', 'pca_2d', '2d', 'pca']:
  278. steps.append(('pca', PCA(n_components=2, random_state=random_seed)))
  279. steps.append(('clf', LogisticRegression(random_state=random_seed, max_iter=1000)))
  280. estimator = Pipeline(steps)
  281. # Cross-validated accuracy (mean ± std across folds)
  282. cv_scores = cross_val_score(estimator, X, y, cv=cv, scoring='accuracy')
  283. cv_acc_mean = float(np.mean(cv_scores))
  284. cv_acc_std = float(np.std(cv_scores, ddof=1)) if len(cv_scores) > 1 else 0.0
  285. # Permutation test (scikit-learn handles CV internally)
  286. score, perm_scores, pvalue = permutation_test_score(
  287. estimator, X, y,
  288. scoring='accuracy',
  289. cv=cv,
  290. n_permutations=n_permutations,
  291. random_state=random_seed,
  292. n_jobs=None,
  293. )
  294. results = {
  295. 'space': 'pca2d' if ('pca' in [name for name, _ in steps]) else 'roi',
  296. 'cv_accuracy_mean': cv_acc_mean,
  297. 'cv_accuracy_std': cv_acc_std,
  298. 'n_splits': int(n_splits),
  299. 'n_subjects': int(n_subjects),
  300. 'n_experts': int(n_expert),
  301. 'n_novices': int(n_novice),
  302. 'perm_pvalue': float(pvalue),
  303. 'perm_null_mean': float(np.mean(perm_scores)),
  304. 'perm_null_std': float(np.std(perm_scores, ddof=1)) if len(perm_scores) > 1 else 0.0,
  305. 'n_permutations': int(n_permutations),
  306. }
  307. logger.info(
  308. f" CV accuracy: {cv_acc_mean:.3f} ± {cv_acc_std:.3f} (n_splits={n_splits})\n"
  309. f" Permutation p={pvalue:.4g} (null mean={np.mean(perm_scores):.3f})"
  310. )
  311. return results
  312. __all__.extend(['evaluate_classification_significance', 'build_feature_matrix'])

models.py at commit 58ad401, under MIT · at the source

Overview

Authors: Andrea I Costantino1,2, Artem Platonov1, Felipe Fontana Vieira1,3, Emily Van Hove1,2, Merim Bilalić4, Hans Op de Beeck1,2
  1. Department of Brain and Cognition, Faculty of Psychology and Educational Sciences, KU Leuven, Leuven, Belgium
  2. Leuven Brain Institute, KU Leuven, Leuven, Belgium
  3. Department of Data Analysis, Faculty of Psychology and Educational Sciences, Ghent University, Ghent, Belgium
  4. School of Psychology, Northumbria University, Newcastle upon Tyne, UK
Institutions: KU Leuven (Belgium); Ghent University (Belgium); Northumbria University (United Kingdom)
Journal: Nature communications, volume 17, issue 1, article 8024
Dates: received 14 November 2025; accepted 8 June 2026; published online 26 June 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-74566-z · PMID 42362539 · PMCID PMC13454291 · OpenAlex W4416220635
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), cognitive (subfield)
Methods: Connectivity, Spectral & time-frequency, Statistics, Smoothing, state filtering, decompositions, Machine learning, Preprocessing, fMRI & imaging, Physiology & signal measures
Keywords: Computational neuroscience, Learning and memory, Cognitive neuroscience, Human behaviour
MeSH: Brain*, Brain Mapping, Humans, Magnetic Resonance Imaging, Models, Neurological, Neuroimaging (* major topic)
Topic: Face Recognition and Perception (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Fonds Wetenschappelijk Onderzoek (G0D3322N); Flemish Government
Citations: cited by 1 paper (Europe PMC); 77 references in the paper
Research resources: which is based on Nipype 1.8.6 RRID:SCR_002502, scikit-learn 1.7.1 RRID:SCR_002577, MA) with Psychtoolbox-3 RRID:SCR_002881, SPM12 RRID:SCR_007037, CoSMoMVPA RRID:SCR_014519, RRID:SCR_016216

Abstract

The abstract is not reproduced here: the paper's license (CC BY-NC-ND) does not allow it. Read it in the paper, at the publisher or on Europe PMC.

Repositories

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

costantinoai/chess-expertise-2025

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Commit: 58ad401c241ec28a6327882f490b29a026ab2e74, 5 June 2026
Languages: Python (135), MATLAB (17), Shell (1)
Size: 175 files, 153 scripts
Software Heritage: archived
Found in: “Code availability”
Holds: README, license file, environment (environment.yml, pyproject.toml, requirements.txt)
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: pandas (80 files), NumPy (67 files), Matplotlib (33 files), SciPy (18 files), Nilearn (13 files), SPM (9 files), NiBabel (7 files), scikit-learn (6 files), CoSMoMVPA (5 files), seaborn (5 files), Plotly (2 files), statsmodels (2 files), fMRIPrep (1 file), Pingouin (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers
  • 27 September 2026: the link answers
155 files

Zenodo 19392282

License: MIT
State: the link answers, verified on 27 September 2026
Evidence: files inventoried
Size: 1 file
Software Heritage: not checked
Found in: “Code availability”
Not found: README, license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: pandas (79 files), NumPy (66 files), Matplotlib (32 files), SciPy (18 files), Nilearn (13 files), SPM (9 files), NiBabel (7 files), scikit-learn (6 files), CoSMoMVPA (5 files), seaborn (5 files), Plotly (2 files), statsmodels (2 files), fMRIPrep (1 file), Pingouin (1 file)
Availability: 1 check, the latest on 27 September 2026: the link answers (HTTP 200)
  • 27 September 2026: the link answers (HTTP 200)
154 files
At the source:

Code availability statement

The paper has a code availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

Read it in the paper: doi.org/10.1038/s41467-026-74566-z.

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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 305 scripts, each with its path and the digest of its content;
  • 40 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.

Data availability statement

The paper has a data availability statement. Its license (CC BY-NC-ND) does not allow reproducing it here; in short, from what the harvester recognized in it:

  • no repository, dataset or request procedure was recognized in it

Read it in the paper: doi.org/10.1038/s41467-026-74566-z.

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, 27 September 2026: the first record

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 4 keywords, 6 MeSH terms, 2 funders, 59 references, 6 RRIDs.

Cite

This paper

Costantino, A. I., Platonov, A., Fontana Vieira, F., Van Hove, E., Bilalić, M., & Op de Beeck, H. (2026). Low-dimensional and optimised representations of high-level information in the expert brain. Nature communications, 17(1), 8024. https://doi.org/10.1038/s41467-026-74566-z

BibTeX

@article{costantino2026low,
author = {Costantino, Andrea I and Platonov, Artem and Fontana Vieira, Felipe and Van Hove, Emily and Bilalić, Merim and Op de Beeck, Hans},
title = {{Low-dimensional and optimised representations of high-level information in the expert brain}},
journal = {Nature communications},
year = {2026},
month = jun,
volume = {17},
number = {1},
pages = {8024},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-74566-z},
url = {https://doi.org/10.1038/s41467-026-74566-z},
pmid = {42362539},
pmcid = {PMC13454291}
}

RIS

TY - JOUR
AU - Costantino, Andrea I
AU - Platonov, Artem
AU - Fontana Vieira, Felipe
AU - Van Hove, Emily
AU - Bilalić, Merim
AU - Op de Beeck, Hans
TI - Low-dimensional and optimised representations of high-level information in the expert brain
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/06/26
VL - 17
IS - 1
SP - 8024
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-74566-z
UR - https://doi.org/10.1038/s41467-026-74566-z
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-74566-z",
"type": "article-journal",
"title": "Low-dimensional and optimised representations of high-level information in the expert brain",
"container-title": "Nature communications",
"author": [
{
"family": "Costantino",
"given": "Andrea I"
},
{
"family": "Platonov",
"given": "Artem"
},
{
"family": "Fontana Vieira",
"given": "Felipe"
},
{
"family": "Van Hove",
"given": "Emily"
},
{
"family": "Bilalić",
"given": "Merim"
},
{
"family": "Op de Beeck",
"given": "Hans"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "8024",
"DOI": "10.1038/s41467-026-74566-z",
"PMID": "42362539",
"PMCID": "PMC13454291",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-74566-z",
"language": "en",
"issued": {
"date-parts": [
[
2026,
6,
26
]
]
}
}

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/s42003-024-07415-8 [code]
A computational deep learning investigation of animacy perception in the human brain.
Journal: Communications biology
In common: Pingouin, statsmodels, seaborn, 5 other tools, cognitive, 1 reference, 2 authors
[2] doi:10.7554/elife.82580 [code]
THINGS-data, a multimodal collection of large-scale datasets for investigating object representations in human brain and behavior.
Journal: eLife
In common: CoSMoMVPA, Nilearn, NiBabel, 6 other tools, 8 references
[3] doi:10.1371/journal.pbio.3003268 [code]
Transfer of motor learning is associated with patterns of activity in the default mode network.
Journal: PLoS biology
In common: Pingouin, Nilearn, SPM, 8 other tools, 5 references
[4] doi:10.1038/s42003-025-08395-z [code]
Distinct neural representational geometries of numerosity in early visual and association regions across visual streams.
Journal: Communications biology
In common: CoSMoMVPA, Nilearn, Plotly, 7 other tools, cognitive, 4 references
[5] doi:10.1038/s41467-026-71151-2 [code]
Common and distinct neural correlates of social interaction processing and theory of mind in narratives.
Journal: Nature communications
In common: fMRIPrep, Nilearn, SPM, 8 other tools, cognitive, 4 references
[6] doi:10.1038/s41467-025-67855-6 [code]
Investigating action topography in visual cortex and deep artificial neural networks.
Journal: Nature communications
In common: CoSMoMVPA, SPM, scikit-learn, 4 other tools, 3 references, author Hans Op de Beeck
[7] doi:10.1038/s41467-024-50310-3 [code]
Modeling short visual events through the BOLD moments video fMRI dataset and metadata.
Journal: Nature communications
In common: fMRIPrep, Nilearn, statsmodels, 6 other tools, cognitive, 6 references
[8] doi:10.1038/s41467-025-65468-7 [code]
Impact of a transient neonatal visual deprivation on the development of the ventral occipito-temporal cortex in humans.
Journal: Nature communications
In common: CoSMoMVPA, 3 references, 2 authors
[9] doi:10.1038/s41597-024-02931-y [code]
An fMRI Dataset on Social Reward Processing and Decision Making in Younger and Older Adults.
Journal: Scientific data
In common: fMRIPrep, Nilearn, statsmodels, 6 other tools, cognitive, 6 references
[10] doi:10.7554/elife.82566 [code]
Statistical inference on representational geometries.
Journal: eLife
In common: fMRIPrep, Nilearn, SPM, 7 other tools, 5 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.

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.1038/s41467-026-74566-z.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-74566-z)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.1038/s41467-026-74566-z.svg
   :target: https://openscicode.org/badge/doi/10.1038/s41467-026-74566-z
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-74566-z"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-74566-z.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.