OSCR

Modeling flexible behavior with remapping-based hippocampal sequence 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

Jupyter notebook · 137 lines · 4.6 KB · MIT

  1. # %%
  2. import numpy as np
  3. import matplotlib.pyplot as plt
  4. import pickle
  5. # %%
  6. def get_result(reward, terminal):
  7. global Q
  8. result = dict()
  9. num = reward.shape[0]
  10. for t in range(rep):
  11. allroutes = []
  12. Q = np.array(np.zeros([num,num]))+0.1
  13. n_state = 0
  14. for i in range(trialnum):#1万回繰り返し学習を行う
  15. route = [n_state]
  16. while route[-1]+1 not in terminal:
  17. p_state = route[-1]
  18. n_actions = []
  19. for j in range(num):
  20. if reward[p_state,j] >= 1:
  21. n_actions.append(j)
  22. prob = Q[p_state,n_actions]
  23. n_state = np.random.choice(n_actions,p=prob/np.sum(prob)) #行動可能選択肢からランダムに選択
  24. rwd = reward[p_state,n_state]
  25. if n_state + 1 in terminal and check_rwd(route+[n_state], i):
  26. rwd += 100
  27. Q[p_state,n_state] = (1-alpha)*Q[p_state,n_state]+alpha*(rwd+gamma*Q[n_state,np.argmax(Q[n_state,])])
  28. route.append(n_state)
  29. n_state = np.where(reward[n_state, :] > 0)[0]
  30. allroutes.append(route)
  31. result[t] = allroutes
  32. return result
  33. # %%
  34. gamma = 0.6
  35. alpha = 0.4
  36. trialnum = 80
  37. swblock = 20
  38. rep = 40
  39. def check_rwd(route, count):
  40. if count < swblock:
  41. return len(route) == 3
  42. elif count < swblock*2:
  43. return len(route) == 5
  44. else:
  45. return len(route) >= 7
  46. # %%
  47. def get_reward(actdict):
  48. num = len(actdict)
  49. reward = np.zeros((num,num))
  50. for key,val in actdict.items():
  51. reward[key-1][np.array(val)-1] = 1
  52. return reward
  53. # %%
  54. def rwdplot(result):
  55. rwdrate = np.array([[check_rwd(r,n) for n,r in enumerate(route)] for _,route in result.items()])
  56. plt.figure(figsize = (10,4))
  57. for i in range(1,int(trialnum/swblock)-1):
  58. plt.plot([swblock*i-0.5,swblock*i-0.5], [-5,105], "--",color = "#555555")
  59. plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),fmt="go-")
  60. plt.xlabel("trial index", fontsize = 20)
  61. plt.ylabel("correct [%]", fontsize = 20)
  62. plt.xticks(np.arange(-0.5,trialnum+1,20),np.arange(0,trialnum+1,20), fontsize = 15)
  63. plt.yticks(fontsize = 15)
  64. plt.ylim([-5,105])
  65. #plt.savefig("./figure/dropby_2times_correct.png", bbox_inches = "tight")
  66. return rwdrate
  67. # %%
  68. actdict = {1: [3], 2:[4], 3: [7,10], 4: [7,10], 5:[9,11], \
  69. 6:[8,12], 7: [5], 8: [6], 9: [6], 10: [1], 11: [2], 12: [2]}
  70. terminal = [10,11,12]
  71. reward = get_reward(actdict)
  72. result4 = get_result(reward, terminal)
  73. rwdplot(result4)
  74. # %%
  75. actdict = {1: [3], 2: [3], 3: [6,8], 4:[7,9], 5: [7,9],\
  76. 6: [4], 7: [5], 8: [1], 9: [2]}
  77. terminal = [8,9]
  78. reward = get_reward(actdict)
  79. result3 = get_result(reward, terminal)
  80. rwdplot(result3)
  81. # %%
  82. actdict = {1: [2], 2: [4,6],3: [5,7], 4: [3], 5: [3], 6: [1], 7: [1]}
  83. terminal = [6,7]
  84. reward = get_reward(actdict)
  85. result2 = get_result(reward, terminal)
  86. rwdplot(result2)
  87. # %%
  88. actdict = {1: [2], 2: [4,5], 3: [4,5], 4: [3], 5: [1]}
  89. terminal = [5]
  90. reward = get_reward(actdict)
  91. result1 = get_result(reward, terminal)
  92. rwdplot(result1)
  93. # %%
  94. actdict = {1: [2], 2: [3,4], 3: [2], 4: [1]}
  95. terminal = [4]
  96. reward = get_reward(actdict)
  97. result0 = get_result(reward, terminal)
  98. rwdplot(result0)
  99. # %%
  100. plt.figure(figsize = (10,4))
  101. for i in range(1,int(trialnum/swblock)-1):
  102. plt.plot([swblock*i-0.5,swblock*i-0.5], [-5,105], "--",color = "#555555")
  103. clr = ["#00bbcc","#337744","#552255","#880088","#ff0000"]
  104. lbl = ["0 back","1 back","2 back","3 back","our model"]
  105. for n,result in enumerate([result0, result1,result2,result3]):
  106. rwdrate = np.array([[check_rwd(r,n) for n,r in enumerate(route)] for _,route in result.items()])
  107. plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),\
  108. color = clr[n], fmt="o-", label = lbl[n])
  109. with open("./pkls/dropby_2times{}.pkl".format(""), mode = "rb") as f:
  110. allresult = pickle.load(f)
  111. rwdrate = np.zeros((rep,trialnum))
  112. for x in range(rep):
  113. tmp = [res[-1]["rwd"] for r, res in enumerate(allresult[x])]
  114. rwdrate[x,:len(tmp)] = tmp
  115. plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),\
  116. color = clr[4], fmt="o-", label = lbl[4])
  117. plt.legend(bbox_to_anchor=(1.0, 1), loc='upper left', fontsize = 15)
  118. plt.xlabel("trial index", fontsize = 20)
  119. plt.ylabel("correct [%]", fontsize = 20)
  120. plt.xticks(np.arange(-0.5,trialnum+1,20),np.arange(0,trialnum+1,20), fontsize = 15)
  121. plt.yticks(fontsize = 15)
  122. plt.ylim([-5,105])
  123. plt.savefig("./figure/dropby_2time_correct_TD.png", bbox_inches = "tight")
  124. # %%

FigS2.ipynb at commit e9ca9b8, under MIT · at the source

Overview

Authors: Yoshiki Ito1,2,3, Taro Toyoizumi2,4
  1. Department of Neuroscience, Graduate School of Medicine, The University of Tokyo Tokyo Japan
  2. Laboratory for Neural Computation and Adaptation, RIKEN Center for Brain Science Saitama Japan
  3. Division of Visual Information Processing, National Institute for Physiological Sciences Okazaki Japan
  4. Department of Mathematical Informatics, Graduate School of Information Science and Technology, the University of Tokyo Tokyo Japan
Journal: eLife, volume 14, article RP106506
Dates: published online 13 May 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.106506 · PMID 42125964 · PMCID PMC13171104 · OpenAlex W4411091049
Open access: gold, a free copy (OpenAlex)
Status: code verified (how the code is found and verified)
Categories: human (organism), autism (population), schizophrenia / psychosis (population), cognitive (subfield)
Keywords: hippocampal sequence, remapping, context, Amari-Hopfield model, schizophrenia, ASD, None
MeSH: Hippocampus*, Learning*, Models, Neurological*, Animals, Humans, Schizophrenia (* major topic)
Journal subjects: Neuroscience
Topic: Memory and Neural Mechanisms (Cognitive Neuroscience, Neuroscience), according to OpenAlex
Funding: Core Research for Evolutional Science and Technology (10.52926/jpmjcr23n2); RIKEN (TRIP initiative: Quantum); Japan Society for the Promotion of Science (KAKENHI 25K24466)
Citations: not cited yet (Europe PMC); 96 references in the paper

Abstract

Animals flexibly change their behavior depending on context. It is reported that the hippocampus is one of the most prominent regions for contextual behaviors, and its sequential activity shows context dependency. However, how such context-dependent sequential activity is established through reorganization of neuronal activity (remapping) remains unclear. To better understand the formation of hippocampal activity and its contribution to context-dependent flexible behavior, we present a novel biologically plausible reinforcement learning model. In this model, Context selector promotes the formation of context-dependent sequential activity and allows for flexible switching of behavior in multiple contexts. This model reproduces a variety of findings from neural activity, optogenetic inactivation, human fMRI, and clinical research. Furthermore, our model predicts that imbalances in the ratio between sensory and contextual representations in Context selector account for schizophrenia and autism spectrum disorder-like behaviors.

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

Repository

Its files are read in the Code ↔ Paper reader above.

toppo365/flexiblemodel

License: MIT
State: the link answers, verified on 28 September 2026
Evidence: files inventoried
Commit: e9ca9b8189785688829f8d7cb3cbb08fe65673ea, 13 May 2026
Languages: Jupyter (11), Python (1)
Size: 24 files, 12 scripts
Software Heritage: archived
Found in: “Data availability”
Holds: README, license file, 11 notebooks
Not found: CITATION.cff, environment file, tests, continuous integration, documentation
Tools: NumPy (12 files), Matplotlib (11 files), SciPy (3 files)
Availability: 1 check, the latest on 28 September 2026: the link answers
  • 28 September 2026: the link answers
14 files

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

Tracing map

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

What the map holds:

  • 1 repository of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 12 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

All data needed to evaluate the conclusions in the paper are present in the paper and/or the Supplementary Materials. All source code is provided in https://github.com/toppo365/flexiblemodel (copy archived at Ito, 2026).

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

Versions

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

Version 1, 28 September 2026: the first record

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

Cite

This paper

Ito, Y., & Toyoizumi, T. (2026). Modeling flexible behavior with remapping-based hippocampal sequence learning. eLife, 14, RP106506. https://doi.org/10.7554/elife.106506

BibTeX

@article{ito2026modeling,
author = {Ito, Yoshiki and Toyoizumi, Taro},
title = {{Modeling flexible behavior with remapping-based hippocampal sequence learning}},
journal = {eLife},
year = {2026},
month = may,
volume = {14},
pages = {RP106506},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.106506},
url = {https://doi.org/10.7554/elife.106506},
pmid = {42125964},
pmcid = {PMC13171104}
}

RIS

TY - JOUR
AU - Ito, Yoshiki
AU - Toyoizumi, Taro
TI - Modeling flexible behavior with remapping-based hippocampal sequence learning
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/05/13
VL - 14
SP - RP106506
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.106506
UR - https://doi.org/10.7554/elife.106506
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.106506",
"type": "article-journal",
"title": "Modeling flexible behavior with remapping-based hippocampal sequence learning",
"container-title": "eLife",
"author": [
{
"family": "Ito",
"given": "Yoshiki"
},
{
"family": "Toyoizumi",
"given": "Taro"
}
],
"container-title-short": "Elife",
"volume": "14",
"page": "RP106506",
"DOI": "10.7554/elife.106506",
"PMID": "42125964",
"PMCID": "PMC13171104",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.106506",
"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.pcbi.1013545 [code]
Three types of remapping with linear decoders: A population-geometric perspective.
Journal: PLoS computational biology
In common: 12 references
[2] doi:10.1038/s41586-024-08548-w [code]
Learning produces an orthogonalized state machine in the hippocampus.
Journal: Nature
In common: SciPy, Matplotlib, NumPy, cognitive, 10 references
[3] doi:10.1371/journal.pcbi.1014093 [code]
Contextual inference through flexible integration of environmental features and behavioural outcomes.
Journal: PLoS computational biology
In common: SciPy, Matplotlib, NumPy, cognitive, 8 references
[4] doi:10.1038/s41467-024-44877-0 [code]
Distinguishing examples while building concepts in hippocampal and artificial networks.
Journal: Nature communications
In common: SciPy, Matplotlib, NumPy, 4 references, author Taro Toyoizumi
[5] doi:10.1038/s41593-025-01908-3 [code]
Constructing future behavior in the hippocampal formation through composition and replay.
Journal: Nature neuroscience
In common: SciPy, Matplotlib, NumPy, 8 references
[6] doi:10.7554/elife.80663 [code]
Rapid learning of predictive maps with STDP and theta phase precession.
Journal: eLife
In common: SciPy, Matplotlib, NumPy, 8 references
[7] doi:10.1038/s41467-025-56731-y [code]
Exploring replay.
Journal: Nature communications
In common: SciPy, Matplotlib, NumPy, cognitive, 7 references
[8] doi:10.1038/s41467-024-54257-3 [code]
A hierarchical active inference model of spatial alternation tasks and the hippocampal-prefrontal circuit.
Journal: Nature communications
In common: SciPy, Matplotlib, NumPy, cognitive, 7 references
[9] doi:10.7554/elife.99931 [code]
A unifying account of replay as context-driven memory reactivation.
Journal: eLife
In common: SciPy, Matplotlib, NumPy, cognitive, 7 references
[10] doi:10.1038/s41467-025-63346-w [code]
Generative emergence of non-local representations in the hippocampus.
Journal: Nature communications
In common: SciPy, Matplotlib, 8 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.7554/elife.106506.svg)](https://openscicode.org/badge/doi/10.7554/elife.106506)
<!-- oscr-badge:end -->
reStructuredText
.. oscr-badge:start

.. image:: https://openscicode.org/badge/doi/10.7554/elife.106506.svg
   :target: https://openscicode.org/badge/doi/10.7554/elife.106506
   :alt: OSCR

.. oscr-badge:end
HTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.7554/elife.106506"><img src="https://openscicode.org/badge/doi/10.7554/elife.106506.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.