OSCR

Global error signal guides local optimization in mismatch calculation.

Code ↔ Paper

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

The 2 matches
  1. [1] § Methods › Data analysis ↔ analyze/vml_Fig2_John.m, lines 187–241 · score 0.58 · fitted GMMs, favor, BIC, pseudo, component, Gaussian
  2. [2] § Results › Three-factor learning rule optimizes prediction-error computation ↔ scripts/class_main_nPE_perturbe.py, lines 13–66 · score 0.50 · anti Hebbian, Hebbian learning, match, training

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

MATLAB · 291 lines · 10 KB · no license · 1 match

  1. clearvars -except agg* proj*
  2. close all
  3. %%
  4. pp=fieldnames(aggregateData);
  5. iP=1;
  6. corr_thr=0.02;
  7. %%
  8. parameters_main;
  9. sumIDX=35:45;
  10. normalization=19:29;
  11. TP = 1;
  12. cl=[-.2 .2];
  13. grayscale=.97;
  14. pp=fieldnames(aggregateData);
  15. % ?? for iP=7
  16. for iP=1
  17. IDX = aggregateData.(pp{iP}).expType{TP};
  18. MM = aggregateData.(pp{iP}).avgMM{TP};
  19. MMR= aggregateData.(pp{iP}).avgMMRandom{TP};
  20. CM = aggregateData.(pp{iP}).corrM{TP};
  21. CP = aggregateData.(pp{iP}).corrP{TP};
  22. FF = aggregateData.(pp{iP}).ROIinfo{TP};
  23. %MM=MM-MMR;
  24. mm=mean(MM(meanPost,:))-mean(MM(meanPre,:));
  25. tmp=aggregateData.(pp{iP}).avgMM{TP}-aggregateData.(pp{iP}).avgMMRandom{TP};
  26. mm=mean(tmp(meanPost,:))-mean(tmp(meanPre,:));
  27. FF=FF(:,1);
  28. for type=0:1
  29. % type=1;
  30. figure(type+1)
  31. %mm=mean(MM(sumIDX,:));
  32. actIDX=FF>4;
  33. realP=~isnan(CP);
  34. realM=~isnan(CM);
  35. d = -0.6:0.025:0.6;
  36. MIDX_CT=IDX==type & actIDX & realP & realM;
  37. aCT=CM(MIDX_CT);
  38. bCT=CP(MIDX_CT);
  39. fprintf('Corr: %0.3f',corr(aCT,bCT))
  40. cCT=mm(MIDX_CT);
  41. m=length(cCT);
  42. n = fix(m/2);
  43. x = n~=(m/2);
  44. %r = [(0:1:n-1)/n,ones(1,n+x)];
  45. %g = [(0:1:n-1)/n,ones(1,x),(n-1:-1:0)/n];
  46. %bl = [ones(1,n+x),(n-1:-1:0)/n];
  47. r = grayscale*[(0:1:n-1)/n,ones(1,n+x)];
  48. %r(r<.5)=.5;
  49. bl = grayscale*[(0:1:n-1)/n,ones(1,x),(n-1:-1:0)/n];
  50. g = grayscale*[ones(1,n+x),((n-1:-1:0)/n)];
  51. g(g<.65)=.65;
  52. cmap = [r(:),g(:),bl(:)];
  53. [~,sidx]=sort(cCT);
  54. %cCT(cCT<0)=2*cCT(cCT<0);
  55. sidx=1:length(cCT);
  56. % subplot(1,2,1+type)
  57. hold on
  58. scatter(bCT(sidx),aCT(sidx),15,cCT(sidx),'filled','MarkerEdgeColor', 'k')
  59. % Compute angles in radians
  60. % norm_bCT=bCT(sidx)-mean(bCT(sidx));
  61. % norm_aCT=aCT(sidx)-mean(aCT(sidx));
  62. norm_bCT=bCT(sidx);
  63. norm_aCT=aCT(sidx);
  64. dist_all= sqrt(norm_bCT.^2+norm_aCT.^2);
  65. set(gcf, 'Position', [100, 100, 400, 300]); % [x, y, width, height]
  66. set(gca,'CLim',cl,'XTick',0,'YTick',0)
  67. colormap(cmap);
  68. % colorbar
  69. axis image
  70. xlim([-.7 .7])
  71. ylim([-.7 .7])
  72. hold on
  73. grid on
  74. file_name = ['./Figures/' pp{1} '_type_' num2str(type),'_scattor' ]; % Use the first field name for naming
  75. % Save the figure in different formats
  76. saveas(gcf, [file_name, '.fig']); % Save as MATLAB .fig file
  77. saveas(gcf, [file_name, '.svg']); % Save as SVG
  78. sig_thr=(norm_bCT.^2+norm_aCT.^2)>corr_thr;
  79. % sig_thr=(norm_bCT.^2+norm_aCT.^2)<corr_thr;
  80. num_cell=sum(sig_thr);
  81. norm_aCT_sig=norm_aCT(sig_thr);
  82. norm_bCT_sig=norm_bCT(sig_thr);
  83. % theta_corr = atan2(norm_bCT(sig_thr),norm_aCT(sig_thr) );
  84. theta_corr = atan2(norm_bCT,norm_aCT );
  85. % figure(666) % Find the optimal threshold.
  86. % clf
  87. %
  88. %
  89. % % Define more bins for higher resolution
  90. % num_bins = 50; % Increase number of bins
  91. % bin_edges = logspace(log10(min(dist_all)), log10(max(dist_all)), num_bins); % Log-spaced bins
  92. %
  93. % % Plot histogram
  94. % histogram(dist_all, 'BinEdges', bin_edges, 'Normalization', 'probability', ...
  95. % 'FaceColor', 'blue', 'EdgeColor', 'black', 'FaceAlpha', 0.7);
  96. %
  97. % set(gca, 'XScale', 'log');
  98. % ylabel('Probability Density');
  99. % title('Histogram of distance (Log-Scale X-Axis)');
  100. %
  101. % % Set axes properties
  102. % set(gca, 'FontSize', 12);
  103. % Adjust angles that are less than -3/4 * pi
  104. theta_corr(theta_corr < -3/4 * pi) = theta_corr(theta_corr < -3/4 * pi) + 2 * pi;
  105. % Create figure
  106. bin_width = pi / 10.0;
  107. bin_edges = -3 * pi / 4 : bin_width : (5/4 * pi + bin_width); % Define bins
  108. % Compute weighted histogram manually
  109. [counts, edges] = histcounts(theta_corr, bin_edges, 'Normalization', 'probability');
  110. weighted_counts = accumarray(discretize(theta_corr, bin_edges), dist_all, [length(counts), 1], @sum);
  111. weighted_counts = weighted_counts/sum(weighted_counts) ;
  112. % Use bin_centers as the "data", weighted by weighted_counts
  113. bin_centers = (edges(1:end-1) + edges(2:end)) / 2;
  114. % Initialize pseudo sample container
  115. theta_pseudo = [];
  116. sum_pseudo_weight=0;
  117. sum_weight= sum(dist_all);
  118. rng(1); % Set seed for reproducibility
  119. % Loop through each point
  120. for i = 1:length(theta_corr)
  121. % Repeat theta_corr(i) 100 times with inclusion probability dist_all(i)
  122. % if theta_corr(i)/pi-1/4>3/4 || theta_corr(i)/pi-1/4<-3/4
  123. % continue
  124. % end
  125. if theta_corr(i)/pi-1/4>1/2 || theta_corr(i)/pi-1/4<-1/2
  126. continue
  127. end
  128. if dist_all(i)<0.1
  129. continue
  130. end
  131. sum_pseudo_weight=sum_pseudo_weight+dist_all(i);
  132. n_repeat = sum(rand(1, 200) < dist_all(i)); % Number of times to include this point
  133. theta_pseudo = [theta_pseudo; repmat(theta_corr(i), n_repeat, 1)];
  134. end
  135. % Get BIC scores
  136. Neff = (sum(dist_all))^2 / sum(dist_all.^2);
  137. options= statset('MaxIter', 1000);
  138. gm1 = fitgmdist(theta_pseudo-pi/4, 1, 'RegularizationValue', 1e-5,'Options', options);
  139. gm2 = fitgmdist(theta_pseudo-pi/4, 2, 'RegularizationValue', 1e-5,'Options', options);
  140. bic1 = gm1.BIC;
  141. bic2 = gm2.BIC;
  142. aic1 = gm1.AIC;
  143. aic2 = gm2.AIC;
  144. logL1 = gm1.NegativeLogLikelihood * -1;
  145. logL2 = gm2.NegativeLogLikelihood * -1;
  146. k1 = gm1.NumComponents;
  147. k2 = gm2.NumComponents;
  148. % bic1 = -2 * logL1 + k1 * log(Neff);
  149. % bic2 = -2 * logL2 + k2 * log(Neff);
  150. bic1_eff = -2 * logL1 + k1 * log(Neff);
  151. bic2_eff = -2 * logL2 + k2 * log(Neff);
  152. fprintf('BIC (1 comp): %.2f\n', bic1);
  153. fprintf('BIC (2 comp): %.2f\n', bic2);
  154. fprintf('AIC (1 comp): %.2f\n', aic1);
  155. fprintf('AIC (2 comp): %.2f\n', aic2);
  156. fprintf('BIC eff (1 comp): %.2f\n', bic1_eff);
  157. fprintf('BIC eff (2 comp): %.2f\n', bic2_eff);
  158. figure(type+21)
  159. clf
  160. histogram(theta_pseudo-pi/4, 'Normalization', 'pdf', 'BinWidth', 0.05);
  161. set(gcf, 'Position', [200,300,560, 420]); % [left, bottom, width, height]
  162. hold on;
  163. xgrid = linspace(min(theta_pseudo-pi/4), max(theta_pseudo-pi/4), 200)';
  164. y1 = pdf(gm1, xgrid);
  165. y2 = pdf(gm2, xgrid);
  166. plot(xgrid, y1, 'r-', 'LineWidth', 2);
  167. plot(xgrid, y2, 'b-', 'LineWidth', 2);
  168. % Plot vertical lines at component means
  169. means1 = gm1.mu;
  170. means2 = gm2.mu;
  171. for m = 1:length(means1)
  172. xline(means1(m), 'r--', 'LineWidth', 1.5);
  173. end
  174. for m = 1:length(means2)
  175. xline(means2(m), 'b--', 'LineWidth', 1.5);
  176. end
  177. legend('Data', '1-comp GMM', '2-comp GMM');
  178. xticks([-pi / 2, 0, pi/2]);
  179. xticklabels({'-\pi/2', '0', '\pi/2'});
  180. set(gca, 'FontSize', 18, 'XMinorTick', 'on'); % Adjust font size if needed
  181. % Add BIC difference in the title
  182. BIC_diff = gm1.BIC - gm2.BIC; % Positive value favors gm2 (2-component)
  183. if BIC_diff > 0
  184. preferred = '2-comp GMM';
  185. else
  186. preferred = '1-comp GMM';
  187. end
  188. box off
  189. title(sprintf('Gaussian Mixture Model Fit (ΔBIC = %.2f, Preferred: %s)', BIC_diff, preferred));
  190. file_name = ['./Figures/' pp{1} '_type_' num2str(type),'_fittedGMM' ]; % Use the first field name for naming
  191. % Save the figure in different formats
  192. saveas(gcf, [file_name, '.fig']); % Save as MATLAB .fig file
  193. saveas(gcf, [file_name, '.svg']); % Save as SVG
  194. figure(type+11)
  195. clf
  196. hold on
  197. % bar((bin_edges(1:end-1)+bin_edges(2:end))-pi/4, weighted_counts/bin_width, 'FaceColor', 'blue', 'EdgeColor', 'black', 'FaceAlpha', 0.7, 'BarWidth', 1);
  198. bar(bin_edges(1:end-1)-pi/4+bin_width/2, weighted_counts/bin_width, 'FaceColor', 'blue', 'EdgeColor', 'black', 'FaceAlpha', 0.7, 'BarWidth', 1);
  199. set(gcf, 'Position', [200,300,300, 225]); % [left, bottom, width, height]
  200. xgrid=linspace(-pi, pi,200)';
  201. xgrid_width=2*pi/200;
  202. y1 = pdf(gm1, xgrid);
  203. y2 = pdf(gm2, xgrid);
  204. % y1_norm=y1;
  205. % y2_norm=y2;
  206. y1_norm=y1*sum_pseudo_weight/sum_weight;
  207. y2_norm=y2*sum_pseudo_weight/sum_weight;
  208. % plot(xgrid, y1_norm, 'k-', 'LineWidth', 2);
  209. % plot(xgrid, y2_norm, 'r-', 'LineWidth', 2);
  210. box off
  211. % % Plot histogram
  212. % histogram(theta_corr, 'BinEdges', bin_edges, 'Normalization', 'probability', ...
  213. % 'FaceColor', 'blue', 'EdgeColor', 'black', 'FaceAlpha', 0.7,'Weights',dist_all(sig_thr));
  214. % Customize x-ticks
  215. % xticks([-3 * pi / 4, -pi / 4, pi / 4, 3/4 * pi, 5/4 * pi]);
  216. xticks([-pi, -pi / 2, 0, pi/2, pi]);
  217. xticklabels({'-\pi', '-\pi/2', '0', '\pi/2', '\pi'});
  218. % Set axis labels (optional)
  219. hold off
  220. % Set axes properties
  221. set(gca, 'FontSize', 12, 'XMinorTick', 'on'); % Adjust font size if needed
  222. file_name = ['./Figures/' pp{1} '_type_' num2str(type),'_hist' ]; % Use the first field name for naming
  223. % Save the figure in different formats
  224. saveas(gcf, [file_name, '.fig']); % Save as MATLAB .fig file
  225. saveas(gcf, [file_name, '.svg']); % Save as SVG
  226. % Save raw data to .mat file
  227. % file_name = ['./Figures/' pp{1} '_type_' num2str(type) ]; % Use the first field name for naming
  228. % save([file_name, '_data.mat'], 'bCT', 'aCT');
  229. end
  230. end
  231. % % Silverman test.
  232. % [p, h_crit, h_boot] = silverman_test(theta_pseudo, dist_all,200);
  233. %
  234. % % Optional: visualize bootstrap distribution of critical bandwidths
  235. % figure;
  236. % histogram(h_boot, 'Normalization', 'pdf');
  237. % hold on;
  238. % xline(h_crit, 'r--', 'LineWidth', 2);
  239. % xlabel('Critical Bandwidth');
  240. % ylabel('PDF');
  241. % title(sprintf("Silverman's Test p = %.3f", p));

vml_Fig2_John.m at commit aac6733, no license · at the source

Overview

  1. Center for Neural Science, New York University,New York, NY USA
Institutions: New York University (United States)
Journal: Nature communications, volume 17, issue 1, article 3868
Dates: received 22 August 2025; accepted 24 February 2026; published online 12 March 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-70354-x · PMID 41820382 · PMCID PMC13125295 · OpenAlex W7135064761
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: computational modeling (no new data) (modality), mouse (organism)
Methods: Single-unit activity, calcium imaging, Connectivity, Smoothing, state filtering, decompositions
Keywords: Learning algorithms, Sensorimotor processing, Network models
MeSH: Models, Neurological*, Acoustic Stimulation, Animals, Learning, Mice, Neurons, Synapses (* major topic)
Topic: Statistical and numerical algorithms (Applied Mathematics, Mathematics), according to OpenAlex
Funding: ONR (N00014-23-1-2040); National Institute of Mental Health (R01MH062349)
Citations: cited by 2 papers (Europe PMC); 78 references in the paper

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.

Repository

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

johnhongyumeng/DuetPredictiveCoding_Plasticity

License: none: the authors keep all their rights
State: the link answers, verified on 30 September 2026
Evidence: files inventoried
Commit: aac67332eb4b7b0bfe459ff72d610b560b2eab64, 28 January 2026
Languages: Python (21), MATLAB (1)
Size: 33 files, 22 scripts
Software Heritage: not archived
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (21 files), Matplotlib (15 files), SciPy (10 files), Brian 2 (4 files), Statistics and Machine Learning Toolbox (1 file), Numba (1 file), scikit-learn (1 file), seaborn (1 file)
Availability: 1 check, the latest on 30 September 2026: the link answers
  • 30 September 2026: the link answers
23 files

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-70354-x.

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;
  • 22 scripts, 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.

Code and data availability statement

The paper has a code and data 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-70354-x.

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

Recorded: type, language, journal, volume, issue, pages, dates, 2 authors, 3 keywords, 7 MeSH terms, 2 funders, 73 references.

Cite

This paper

Meng, J. H., & Wang, X.-J. (2026). Global error signal guides local optimization in mismatch calculation. Nature communications, 17(1), 3868. https://doi.org/10.1038/s41467-026-70354-x

BibTeX

@article{meng2026global,
author = {Meng, John Hongyu and Wang, Xiao-Jing},
title = {{Global error signal guides local optimization in mismatch calculation}},
journal = {Nature communications},
year = {2026},
month = mar,
volume = {17},
number = {1},
pages = {3868},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-70354-x},
url = {https://doi.org/10.1038/s41467-026-70354-x},
pmid = {41820382},
pmcid = {PMC13125295}
}

RIS

TY - JOUR
AU - Meng, John Hongyu
AU - Wang, Xiao-Jing
TI - Global error signal guides local optimization in mismatch calculation
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/03/12
VL - 17
IS - 1
SP - 3868
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-70354-x
UR - https://doi.org/10.1038/s41467-026-70354-x
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-70354-x",
"type": "article-journal",
"title": "Global error signal guides local optimization in mismatch calculation",
"container-title": "Nature communications",
"author": [
{
"family": "Meng",
"given": "John Hongyu"
},
{
"family": "Wang",
"given": "Xiao-Jing"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "3868",
"DOI": "10.1038/s41467-026-70354-x",
"PMID": "41820382",
"PMCID": "PMC13125295",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-70354-x",
"language": "en",
"issued": {
"date-parts": [
[
2026,
3,
12
]
]
}
}

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-70347-w [code]
Desegregation of neuronal predictive processing.
Journal: Nature communications
In common: Statistics and Machine Learning Toolbox, computational modeling (no new data), 16 references
[2] doi:10.1371/journal.pcbi.1014164 [code]
'Backpropagation and the brain' realized in cortical error neuron microcircuits.
Journal: PLoS computational biology
In common: SciPy, Matplotlib, NumPy, computational modeling (no new data), 10 references
[3] doi:10.1126/sciadv.aed6417 [code]
Intrinsic timing, not temporal prediction, underlies ramping dynamics in visual and parietal cortex during passive behavior.
Journal: Science advances
In common: seaborn, scikit-learn, SciPy, 2 other tools, mouse, 6 references
[4] doi:10.64898/2026.03.03.705098
Spiking and neuromodulation during active experience shape visuomotor integration in V1 layer 2/3 neurons
Journal: bioRxiv (preprint)
In common: 8 references
[5] doi:10.1371/journal.pone.0354021 [code]
A genetic algorithm for self-supervised models of oscillatory neurodynamics.
Journal: PloS one
In common: SciPy, Matplotlib, NumPy, computational modeling (no new data), 6 references
[6] doi:10.7554/elife.105953 [code]
Top-down feedback in deep neural networks leads to functional differences during audiovisual integration.
Journal: eLife
In common: seaborn, scikit-learn, SciPy, 2 other tools, 5 references
[7] doi:10.1038/s41467-026-74460-8 [code]
Spike-based alignment learning solves the weight transport problem.
Journal: Nature communications
In common: Numba, seaborn, scikit-learn, 3 other tools, computational modeling (no new data), 3 references
[8] doi:10.1523/jneurosci.0987-25.2026 [code]
Cell-Type-Specific Synaptic Scaling Mechanisms Differentially Contribute to Associative Learning.
Journal: The Journal of neuroscience : the official journal of the Society for Neuroscience
In common: Numba, seaborn, SciPy, 2 other tools, 4 references
[9] doi:10.1371/journal.pbio.3003915 [code]
Noise-invariant representations of sound emerge along the canonical cortical hierarchy.
Journal: PLoS biology
In common: Numba, Statistics and Machine Learning Toolbox, seaborn, 4 other tools, mouse, 2 references
[10] doi:10.1371/journal.pcbi.1014001 [code]
Burst firing creates an attractor in synaptic weight dynamics.
Journal: PLoS computational biology
In common: Statistics and Machine Learning Toolbox, computational modeling (no new data), 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.

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.