OSCR

Cortical knowledge structures guide word concept learning.

Code ↔ Paper

The paper beside its authors' code: matches between them have not been computed for this paper yet.

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

R · 228 lines · 7.7 KB · no license

  1. #### get p(h) ####
  2. # hc = hclust(dist(cor(NeuralPattern)))
  3. Bayes_getnode = function(hc,leafnodes = T){
  4. nodes_list = list()
  5. # normalize height
  6. hc$height = hc$height/(2*max(hc$height))
  7. # get leaf nodes
  8. leaf_node = list()
  9. for(i in 1:length(hc$labels)){
  10. temp = list(labs = c(hc$labels[i]),
  11. height = 0,
  12. parent_node = c(which(hc$merge[,1] == -i),which(hc$merge[,2] == -i)),
  13. domain = hc$labels[i] %>% substr(.,1,4))
  14. leaf_node[[i]] = temp
  15. }
  16. # get internal node
  17. internal_node = list()
  18. for(i in 1:nrow(hc$merge)){
  19. values = hc$merge[i,]
  20. if(sum(values < 0) == 2){
  21. labs = hc$labels[-values] %>% sort()
  22. height = hc$height[i]
  23. parent_node = ifelse(i == nrow(hc$merge), NA,
  24. c(which(hc$merge[,1] == i),which(hc$merge[,2] == i)))
  25. domains = labs %>% substr(.,1,4) %>% unique()
  26. internal_node[[i]] = list(labs = labs, height = height, parent_node = parent_node,
  27. domain = ifelse(length(domains) == 1, domains,'Mixed'))
  28. }
  29. if(sum(values < 0) == 1){
  30. newlab = hc$labels[-(values[which(values < 0)])]
  31. oldnode = values[which(values > 0)]
  32. labs = c(newlab, internal_node[[oldnode]]$labs) %>% sort()
  33. height = hc$height[i]
  34. parent_node = ifelse(i == nrow(hc$merge), NA,
  35. c(which(hc$merge[,1] == i),which(hc$merge[,2] == i)))
  36. domains = labs %>% substr(.,1,4) %>% unique()
  37. internal_node[[i]] = list(labs = labs, height = height, parent_node = parent_node,
  38. domain = ifelse(length(domains) == 1, domains,'Mixed'))
  39. }
  40. if(sum(values < 0) == 0){
  41. labs = c(internal_node[[values[1]]]$labs,
  42. internal_node[[values[2]]]$labs) %>% sort()
  43. height = hc$height[i]
  44. parent_node = ifelse(i == nrow(hc$merge), NA,
  45. c(which(hc$merge[,1] == i),which(hc$merge[,2] == i)))
  46. domains = labs %>% substr(.,1,4) %>% unique()
  47. internal_node[[i]] = list(labs = labs, height = height, parent_node = parent_node,
  48. domain = ifelse(length(domains) == 1, domains,'Mixed'))
  49. }
  50. }
  51. # get height diff
  52. leaf_height_diff = numeric(length = length(leaf_node))
  53. for(i in 1:length(leaf_node)){
  54. leaf_height_diff[i] = internal_node[[leaf_node[[i]]$parent_node]]$height
  55. }
  56. internal_height_diff = numeric(length = length(internal_node))
  57. for(i in 1:length(internal_node)){
  58. if(!is.na(internal_node[[i]]$parent_node)){
  59. height_self = internal_node[[i]]$height
  60. parent_node = internal_node[[i]]$parent_node
  61. height_parent = internal_node[[parent_node]]$height
  62. internal_height_diff[i] = height_parent - height_self
  63. internal_node_labs = internal_node[[i]]$labs %>% substr(.,1,nchar(.)-5)
  64. if(length(unique(internal_node_labs)) == 1){
  65. if(length(internal_node_labs) == 5){
  66. internal_height_diff[i] = internal_height_diff[i] *10
  67. }
  68. }
  69. }else{
  70. internal_height_diff[i] = 0.5
  71. }
  72. }
  73. # combine height diff into list
  74. for(i in 1:length(leaf_node)){
  75. leaf_node[[i]][['height_diff']] = leaf_height_diff[i]
  76. }
  77. for(i in 1:length(internal_node)){
  78. internal_node[[i]][['height_diff']] = internal_height_diff[i]
  79. }
  80. # combine leaf and internal nodes
  81. if(leafnodes){
  82. nodes_list = c(leaf_node,internal_node)
  83. }else{
  84. nodes_list = c(internal_node)
  85. }
  86. return(nodes_list)
  87. }
  88. #### get p(X|h) ####
  89. Bayes_getlikelihood = function(nodes_list, exp, sigma = .05){
  90. for(i in 1:length(nodes_list)){
  91. occurrence = sum(exp %in% nodes_list[[i]]$labs)
  92. if(occurrence == 0){
  93. nodes_list[[i]][['height_reverse']] = 0
  94. }else{
  95. node_height = nodes_list[[i]]$height+sigma
  96. p_X_h = (1/node_height)^(sum(exp %in% nodes_list[[i]]$labs))
  97. nodes_list[[i]][['height_reverse']] = p_X_h
  98. }
  99. }
  100. return(nodes_list)
  101. }
  102. #### get p(h|X) ####
  103. # Mixedconsider = T
  104. Bayes_getpostprob = function(nodes_list, target,Mixedconsider = T){
  105. # get domain, position of domain, and numver of hypothesis
  106. domain = target %>% substr(.,1,4)
  107. if(isTRUE(Mixedconsider)){
  108. domain_id = 1:length(nodes_list)
  109. num_hypothesis = length(domain_id)
  110. # calculate p(X)
  111. p_X = matrix(data = 0, nrow = num_hypothesis,ncol = 3)
  112. for(i in 1:length(domain_id)){
  113. node_i = domain_id[i]
  114. p_X[i,1] = nodes_list[[node_i]]$height_diff
  115. p_X[i,2] = nodes_list[[node_i]]$height_reverse
  116. }
  117. p_X[,3] = p_X[,1]*p_X[,2]
  118. p_X = sum(p_X[,3],na.rm=T)
  119. # calculate p(h|X)
  120. p_h_X = numeric(length = length(nodes_list))
  121. for(i in 1:length(domain_id)){
  122. node_i = domain_id[i]
  123. p_h = nodes_list[[node_i]]$height_diff
  124. p_X_h = nodes_list[[node_i]]$height_reverse
  125. p_h_X[node_i] = p_X_h * p_h / p_X
  126. }
  127. # combine p(h|X) into node_list
  128. for(i in 1:length(p_h_X)){
  129. nodes_list[[i]][['Post_Prob']] = p_h_X[i]
  130. }
  131. }else{
  132. domain_id = c(which((nodes_list %>% unlist() %>% .[names(.) == 'domain']) == domain))
  133. num_hypothesis = length(domain_id)
  134. # calculate p(X)
  135. p_X = matrix(data = 0, nrow = num_hypothesis,ncol = 3)
  136. for(i in 1:length(domain_id)){
  137. node_i = domain_id[i]
  138. p_X[i,1] = nodes_list[[node_i]]$height_diff
  139. p_X[i,2] = nodes_list[[node_i]]$height_reverse
  140. }
  141. p_X[,3] = p_X[,1]*p_X[,2]
  142. p_X = sum(p_X[,3],na.rm=T)
  143. # calculate p(h|X)
  144. p_h_X = numeric(length = length(nodes_list))
  145. for(i in 1:length(domain_id)){
  146. node_i = domain_id[i]
  147. p_h = nodes_list[[node_i]]$height_diff
  148. p_X_h = nodes_list[[node_i]]$height_reverse
  149. p_h_X[node_i] = p_X_h * p_h / p_X
  150. }
  151. # combine p(h|X) into node_list
  152. for(i in 1:length(p_h_X)){
  153. nodes_list[[i]][['Post_Prob']] = p_h_X[i]
  154. }
  155. }
  156. return(nodes_list)
  157. }
  158. #### get p(y_belongsto_C|X) ####
  159. Bayes_getpredprob = function(nodes_list, exp, target,Mixedconsider = T){
  160. # get which hypothesis did the exps and target both belong
  161. domain = target %>% substr(.,1,4)
  162. if(isTRUE(Mixedconsider)){
  163. domain_id = 1:length(nodes_list)
  164. BothBelong = matrix(data = 0, nrow = length(exp), ncol = length(domain_id))
  165. for(i in 1:length(domain_id)){
  166. node_i = domain_id[i]
  167. for(e in 1:length(exp)){
  168. if(sum(c(exp[e], target) %in% nodes_list[[node_i]]$labs) == length(c(exp[e], target))){
  169. BothBelong[e,i] = 1
  170. }
  171. }
  172. }
  173. BothBelong = as.numeric(BothBelong %>% apply(X = ., MARGIN = 2, FUN = sum) > 0)
  174. # get all post probability
  175. PostProb = nodes_list[domain_id] %>% unlist() %>% .[names(.) == 'Post_Prob'] %>% as.numeric()
  176. # calculate predicted choose probability
  177. pred_choose_prob = sum(PostProb*BothBelong, na.rm = T)
  178. }else{
  179. domain_id = c(which((nodes_list %>% unlist() %>% .[names(.) == 'domain']) == domain))
  180. BothBelong = matrix(data = 0, nrow = length(exp), ncol = length(domain_id))
  181. for(i in 1:length(domain_id)){
  182. node_i = domain_id[i]
  183. for(e in 1:length(exp)){
  184. if(sum(c(exp[e], target) %in% nodes_list[[node_i]]$labs) == length(c(exp[e], target))){
  185. BothBelong[e,i] = 1
  186. }
  187. }
  188. }
  189. BothBelong = as.numeric(BothBelong %>% apply(X = ., MARGIN = 2, FUN = sum) > 0)
  190. # get all post probability
  191. PostProb = nodes_list[domain_id] %>% unlist() %>% .[names(.) == 'Post_Prob'] %>% as.numeric()
  192. # calculate predicted choose probability
  193. pred_choose_prob = sum(PostProb*BothBelong, na.rm = T)
  194. }
  195. return(pred_choose_prob)
  196. }

Bayesian Model functions.R, no license · at the source

Overview

Authors: Guangyao Zhang1, Xiaosha Wang2,3,4, Dingchen Zhang1, Siwen Xie5,6, Lusha Zhu2,3,4,7, Yanchao Bi2,3,4,5
ORCID iDs: Lusha Zhu, Yanchao Bi
  1. Faculty of Psychology, Beijing Normal University,Beijing, China
  2. School of Psychological and Cognitive Sciences, Peking University,Beijing, China
  3. IDG/McGovern Institute for Brain Research, Peking University,Beijing, China
  4. Key Laboratory of Machine Perception (Ministry of Education),Beijing, China
  5. Institute for Artificial Intelligence, Peking University,Beijing, China
  6. Yuanpei College, Peking University,Beijing, China
  7. Peking-Tsinghua Center for Life Sciences, Peking University,Beijing, China
Institutions: Beijing Normal University (China); Peking University (China)
Journal: Nature communications, volume 17, issue 1, article 6366
Dates: received 21 July 2025; accepted 21 April 2026; published online 13 May 2026
Type: Research article · Language: English
License: CC BY-NC-ND
Identifiers: DOI 10.1038/s41467-026-72868-w · PMID 42129217 · PMCID PMC13376883 · OpenAlex W7161005493
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), cognitive (subfield)
Methods: Statistics, Machine learning, Connectivity, fMRI & imaging
Keywords: Learning and memory, Cognitive neuroscience
MeSH: Cerebral Cortex*, Concept Formation*, Learning*, Adult, Bayes Theorem, Brain Mapping, Female, Hippocampus, Humans, Large Language Models, Magnetic Resonance Imaging, Male, Models, Neurological, Young Adult (* major topic)
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Citations: cited by 1 paper (Europe PMC); 90 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.

OSF wrt9s

License: none: the authors keep all their rights
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Languages: R (5)
Size: 73 files, 5 scripts
Software Heritage: not checked
Found in: “Code availability”
Holds: README
Not found: license file, CITATION.cff, environment file, tests, continuous integration, documentation
Tools: tidyverse (3 files), BayesFactor (1 file)
Availability: 1 check, the latest on 28 September 2026: the link answers (HTTP 200)
  • 28 September 2026: the link answers (HTTP 200)
6 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:

  • it points to the authors' code: OSF wrt9s

Read it in the paper: doi.org/10.1038/s41467-026-72868-w.

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;
  • 5 scripts, each with its path and the digest of its content;
  • no match between paragraphs and code yet;
  • 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-72868-w.

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

Recorded: type, language, journal, volume, issue, pages, dates, 6 authors, 2 keywords, 14 MeSH terms, 1 funder, 81 references.

Cite

This paper

Zhang, G., Wang, X., Zhang, D., Xie, S., Zhu, L., & Bi, Y. (2026). Cortical knowledge structures guide word concept learning. Nature communications, 17(1), 6366. https://doi.org/10.1038/s41467-026-72868-w

BibTeX

@article{zhang2026cortical,
author = {Zhang, Guangyao and Wang, Xiaosha and Zhang, Dingchen and Xie, Siwen and Zhu, Lusha and Bi, Yanchao},
title = {{Cortical knowledge structures guide word concept learning}},
journal = {Nature communications},
year = {2026},
month = may,
volume = {17},
number = {1},
pages = {6366},
publisher = {Nature Publishing Group},
issn = {2041-1723},
doi = {10.1038/s41467-026-72868-w},
url = {https://doi.org/10.1038/s41467-026-72868-w},
pmid = {42129217},
pmcid = {PMC13376883}
}

RIS

TY - JOUR
AU - Zhang, Guangyao
AU - Wang, Xiaosha
AU - Zhang, Dingchen
AU - Xie, Siwen
AU - Zhu, Lusha
AU - Bi, Yanchao
TI - Cortical knowledge structures guide word concept learning
T2 - Nature communications
J2 - Nat Commun
PY - 2026
DA - 2026/05/13
VL - 17
IS - 1
SP - 6366
SN - 2041-1723
PB - Nature Publishing Group
DO - 10.1038/s41467-026-72868-w
UR - https://doi.org/10.1038/s41467-026-72868-w
LA - en
ER -

CSL-JSON

{
"id": "10.1038/s41467-026-72868-w",
"type": "article-journal",
"title": "Cortical knowledge structures guide word concept learning",
"container-title": "Nature communications",
"author": [
{
"family": "Zhang",
"given": "Guangyao"
},
{
"family": "Wang",
"given": "Xiaosha"
},
{
"family": "Zhang",
"given": "Dingchen"
},
{
"family": "Xie",
"given": "Siwen"
},
{
"family": "Zhu",
"given": "Lusha"
},
{
"family": "Bi",
"given": "Yanchao"
}
],
"container-title-short": "Nat Commun",
"volume": "17",
"issue": "1",
"page": "6366",
"DOI": "10.1038/s41467-026-72868-w",
"PMID": "42129217",
"PMCID": "PMC13376883",
"ISSN": "2041-1723",
"publisher": "Nature Publishing Group",
"URL": "https://doi.org/10.1038/s41467-026-72868-w",
"language": "en",
"issued": {
"date-parts": [
[
2026,
5,
13
]
]
}
}

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.1371/journal.pbio.3002863
Object color knowledge representation occurs in the macaque brain despite the absence of a developed language system.
Journal: PLoS biology
In common: cognitive, 7 references, author Yanchao Bi
[2] doi:10.7554/elife.81681
Early language exposure affects neural mechanisms of semantic representations.
Journal: eLife
In common: cognitive, 6 references, author Yanchao Bi
[3] doi:10.1038/s41467-025-58896-y [code]
Innate network mechanisms of temporal pole for semantic cognition in neonatal and adult twin studies.
Journal: Nature communications
In common: 5 references, author Yanchao Bi
[4] doi:10.1038/s41467-026-70608-8 [code]
Semantic similarity across languages reflects neurocognitive dimensions shaped by climate.
Journal: Nature communications
In common: tidyverse, cognitive, 4 references, author Yanchao Bi
[5] doi:10.1371/journal.pbio.3003161
Object knowledge representation in the human visual cortex requires a connection with the language system.
Journal: PLoS biology
In common: 5 references, author Yanchao Bi
[6] doi:10.1038/s43588-026-00956-4 [code]
A neural network for modeling human concept formation, understanding and communication.
Journal: Nature computational science
In common: 5 references, author Yanchao Bi
[7] doi:10.1098/rspb.2024.1433 [code]
The nature of label-induced categories: preverbal infants represent surface features and category symbols.
Journal: Proceedings. Biological sciences
In common: 5 references
[8] doi:10.7554/elife.83645 [code]
The shared and unique neural correlates of personal semantic, general semantic, and episodic memory.
Journal: eLife
In common: cognitive, 6 references
[9] doi:10.1002/hbm.26546 [code]
Unraveling lexical semantics in the brain: Comparing internal, external, and hybrid language models.
Journal: Human brain mapping
In common: 7 references
[10] doi:10.7554/elife.91522 [code]
When abstract becomes concrete, naturalistic encoding of concepts in the brain.
Journal: eLife
In common: cognitive, 6 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-72868-w.svg)](https://openscicode.org/badge/doi/10.1038/s41467-026-72868-w)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

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

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.1038/s41467-026-72868-w"><img src="https://openscicode.org/badge/doi/10.1038/s41467-026-72868-w.svg" alt="OSCR"></a>
<!-- oscr-badge:end -->

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)

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