Modeling flexible behavior with remapping-based hippocampal sequence learning.
Paper
Loaded from Europe PMC by your browser, not stored by OSCR: doi.org · Europe PMC
The paper is loaded when this pane is shown.
The authors' code
Jupyter notebook · 137 lines · 4.6 KB · MIT
- # %%
- import numpy as np
- import matplotlib.pyplot as plt
- import pickle
- # %%
- def get_result(reward, terminal):
- global Q
- result = dict()
- num = reward.shape[0]
- for t in range(rep):
- allroutes = []
- Q = np.array(np.zeros([num,num]))+0.1
- n_state = 0
- for i in range(trialnum):#1万回繰り返し学習を行う
- route = [n_state]
- while route[-1]+1 not in terminal:
- p_state = route[-1]
- n_actions = []
- for j in range(num):
- if reward[p_state,j] >= 1:
- n_actions.append(j)
- prob = Q[p_state,n_actions]
- n_state = np.random.choice(n_actions,p=prob/np.sum(prob)) #行動可能選択肢からランダムに選択
- rwd = reward[p_state,n_state]
- if n_state + 1 in terminal and check_rwd(route+[n_state], i):
- rwd += 100
- Q[p_state,n_state] = (1-alpha)*Q[p_state,n_state]+alpha*(rwd+gamma*Q[n_state,np.argmax(Q[n_state,])])
- route.append(n_state)
- n_state = np.where(reward[n_state, :] > 0)[0]
- allroutes.append(route)
- result[t] = allroutes
- return result
- # %%
- gamma = 0.6
- alpha = 0.4
- trialnum = 80
- swblock = 20
- rep = 40
- def check_rwd(route, count):
- if count < swblock:
- return len(route) == 3
- elif count < swblock*2:
- return len(route) == 5
- else:
- return len(route) >= 7
- # %%
- def get_reward(actdict):
- num = len(actdict)
- reward = np.zeros((num,num))
- for key,val in actdict.items():
- reward[key-1][np.array(val)-1] = 1
- return reward
- # %%
- def rwdplot(result):
- rwdrate = np.array([[check_rwd(r,n) for n,r in enumerate(route)] for _,route in result.items()])
- plt.figure(figsize = (10,4))
- for i in range(1,int(trialnum/swblock)-1):
- plt.plot([swblock*i-0.5,swblock*i-0.5], [-5,105], "--",color = "#555555")
- plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),fmt="go-")
- plt.xlabel("trial index", fontsize = 20)
- plt.ylabel("correct [%]", fontsize = 20)
- plt.xticks(np.arange(-0.5,trialnum+1,20),np.arange(0,trialnum+1,20), fontsize = 15)
- plt.yticks(fontsize = 15)
- plt.ylim([-5,105])
- #plt.savefig("./figure/dropby_2times_correct.png", bbox_inches = "tight")
- return rwdrate
- # %%
- actdict = {1: [3], 2:[4], 3: [7,10], 4: [7,10], 5:[9,11], \
- 6:[8,12], 7: [5], 8: [6], 9: [6], 10: [1], 11: [2], 12: [2]}
- terminal = [10,11,12]
- reward = get_reward(actdict)
- result4 = get_result(reward, terminal)
- rwdplot(result4)
- # %%
- actdict = {1: [3], 2: [3], 3: [6,8], 4:[7,9], 5: [7,9],\
- 6: [4], 7: [5], 8: [1], 9: [2]}
- terminal = [8,9]
- reward = get_reward(actdict)
- result3 = get_result(reward, terminal)
- rwdplot(result3)
- # %%
- actdict = {1: [2], 2: [4,6],3: [5,7], 4: [3], 5: [3], 6: [1], 7: [1]}
- terminal = [6,7]
- reward = get_reward(actdict)
- result2 = get_result(reward, terminal)
- rwdplot(result2)
- # %%
- actdict = {1: [2], 2: [4,5], 3: [4,5], 4: [3], 5: [1]}
- terminal = [5]
- reward = get_reward(actdict)
- result1 = get_result(reward, terminal)
- rwdplot(result1)
- # %%
- actdict = {1: [2], 2: [3,4], 3: [2], 4: [1]}
- terminal = [4]
- reward = get_reward(actdict)
- result0 = get_result(reward, terminal)
- rwdplot(result0)
- # %%
- plt.figure(figsize = (10,4))
- for i in range(1,int(trialnum/swblock)-1):
- plt.plot([swblock*i-0.5,swblock*i-0.5], [-5,105], "--",color = "#555555")
- clr = ["#00bbcc","#337744","#552255","#880088","#ff0000"]
- lbl = ["0 back","1 back","2 back","3 back","our model"]
- for n,result in enumerate([result0, result1,result2,result3]):
- rwdrate = np.array([[check_rwd(r,n) for n,r in enumerate(route)] for _,route in result.items()])
- plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),\
- color = clr[n], fmt="o-", label = lbl[n])
- with open("./pkls/dropby_2times{}.pkl".format(""), mode = "rb") as f:
- allresult = pickle.load(f)
- rwdrate = np.zeros((rep,trialnum))
- for x in range(rep):
- tmp = [res[-1]["rwd"] for r, res in enumerate(allresult[x])]
- rwdrate[x,:len(tmp)] = tmp
- plt.errorbar(np.arange(trialnum), np.nanmean(rwdrate,0)*100, 100*np.nanstd(rwdrate,0)/np.sqrt(rep),\
- color = clr[4], fmt="o-", label = lbl[4])
- plt.legend(bbox_to_anchor=(1.0, 1), loc='upper left', fontsize = 15)
- plt.xlabel("trial index", fontsize = 20)
- plt.ylabel("correct [%]", fontsize = 20)
- plt.xticks(np.arange(-0.5,trialnum+1,20),np.arange(0,trialnum+1,20), fontsize = 15)
- plt.yticks(fontsize = 15)
- plt.ylim([-5,105])
- plt.savefig("./figure/dropby_2time_correct_TD.png", bbox_inches = "tight")
- # %%
FigS2.ipynb at commit e9ca9b8, under MIT · at the source
Overview
- Department of Neuroscience, Graduate School of Medicine, The University of Tokyo Tokyo Japan
- Laboratory for Neural Computation and Adaptation, RIKEN Center for Brain Science Saitama Japan
- Division of Visual Information Processing, National Institute for Physiological Sciences Okazaki Japan
- Department of Mathematical Informatics, Graduate School of Information Science and Technology, the University of Tokyo Tokyo Japan
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
e9ca9b8189785688829f8d7cb3cbb08fe65673ea, 13 May 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
14 files
- FigS2.ipynb, Jupyter, 137 lines
- FigS3.ipynb, Jupyter, 128 lines
- Networkmodel.py, Python, 618 lines
- lap_cells.ipynb, Jupyter, 182 lines
- lap_cells_alternative.ip
ynb , Jupyter, 181 lines - lap_cells_inhibit.ipynb, Jupyter, 262 lines
- splitter_cell.ipynb, Jupyter, 554 lines
- switch_prob_2cond_0.5_AS
D.ipynb , Jupyter, 227 lines - switch_prob_2cond_0.5_Do
eller.ipynb , Jupyter, 292 lines - switch_prob_2cond_0.5_SZ
.ipynb , Jupyter, 224 lines - switch_prob_2cond_0.5_no
rmal.ipynb , Jupyter, 291 lines - switch_prob_2cond_0.8.ip
ynb , Jupyter, 267 lines - LICENSE, License, 21 lines
- README.md, Text, 15 lines
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/
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://
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/
url = {https://
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/
VL - 14
SP - RP106506
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/
UR - https://
LA - en
ER -
CSL-JSON
{
"id": "10.7554/
"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":
"volume": "14",
"page": "RP106506",
"DOI": "10.7554/
"PMID": "42125964",
"PMCID": "PMC13171104",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://
"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.1014438 [code]
- GATE: Adaptive learning with working memory by information gating in multi-lamellar hippocampal formation.Journal: PLoS computational biologyIn common: SciPy, Matplotlib, NumPy, cognitive, 6 references
- [2] doi:10.1371/journal.pbio.3003755 [code]
- Action information is integrated into entorhinal representations of conceptual space and is reflected in eye movements.Journal: PLoS biologyIn common: SciPy, Matplotlib, NumPy, cognitive, 6 references
- [3] doi:10.1038/s41593-026-02357-2 [code]
- Experience reorganizes content-specific memory traces in macaques.Journal: Nature neuroscienceIn common: SciPy, Matplotlib, NumPy, 5 references
- [4] doi:10.1038/s41593-026-02365-2 [code]
- Hippocampal theta sweeps indicate goal direction during navigation.Journal: Nature neuroscienceIn common: SciPy, Matplotlib, NumPy, 5 references
- [5] doi:10.1371/journal.pcbi.1013487 [code]
- Flexible navigation with neuromodulated cognitive maps.Journal: PLoS computational biologyIn common: SciPy, Matplotlib, NumPy, 5 references
- [6] doi:10.1038/s41467-026-74822-2 [code]
- A likelihood-based method for identifying replay from spike sequences.Journal: Nature communicationsIn common: 6 references
- [7] doi:10.1038/s42256-026-01254-4 [code]
- Neural sampling from cognitive maps enables goal-directed imagination and planning.Journal: Nature machine intelligenceIn common: Matplotlib, NumPy, cognitive, 5 references
- [8] doi:10.1038/s41467-026-77240-6
- Prefrontal-thalamic goal states organize spatially aligned hippocampal maps.Journal: Nature communicationsIn common: 6 references
- [9] doi:10.1093/braincomms/fcag255 [code]
- Impaired consolidation of spatial memory during sleep in patients with leucine-rich glioma-inactivated 1-associated limbic encephalitis.Journal: Brain communicationsIn common: Matplotlib, NumPy, cognitive, 4 references
- [10] doi:10.1016/j.bpsgos.2026.100760
- Prediction and Prediction Error in Autism: A Meta-Analysis of Functional Magnetic Resonance Imaging Results.Journal: Biological psychiatry global open scienceIn common: autism, cognitive, 4 references
Contribute
The authors of this paper can claim it, correct its record and validate its tracing map, and the maintainers of its code (its owner, or a public member of its organization) correct what it says of their repository; anyone signed in can ask for its removal. Every request goes to OSCR's own machine, which answers it; your account page follows them.
Sign in with ORCID to claim this paper as one of its authors, correct its record or validate its tracing map: when the paper's metadata lists your ORCID iD, you are recognized at once. Maintainers of its code: sign in with GitHub, then claim the repository on your account page.
Claim this paper
Correct its record
Say what each link of this record is, remove the ones that are not the paper's, add the ones that are missing. The correction becomes a new version of the record, in its Versions section.
Validate its tracing map
You validate the map as this page shows it: 1 repository of the authors' code, each at its verified commit and with its license, 12 scripts, and 0 matches between paragraphs and code (see the Code and Map sections). It then receives a DOI on Zenodo, with you (your ORCID iD) and OSCR as its creators; the code itself is not deposited.
The map's fingerprint: sha256:d2e6c1f3fe20e75e…
Add the badge to its README
The badge links the code to this page. Copy one of these into the README of the paper's code: only you decide where it goes, and nothing is changed for you.
Markdown
[, paste the snippet at the top, then “Commit changes…” and, to review it first, “Create a new branch and start a pull request”. You open the pull request; OSCR asks for no permission.
Request its removal
To ask OSCR to remove this record, the copies of its authors' scripts or its tracing map, use the removal request page: signed in, you say who you are, what to remove and why, then review and confirm the request. Published rules decide every request (how).
Discussion, reproductions, activity
Discussion: questions and error reports about this paper and its code, from signed-in readers and its authors. It opens with sign-in.
Reproductions: reports from readers who ran the authors' code: what they reproduced, with which environment, commit and data. It opens with sign-in.
Activity: what happens around this paper: new versions of its record, its map's validation, discussions and reproductions. It opens with sign-in.
