A context-free model of savings in motor learning.
The 3 matches
- [1] § Methods › Growing up training phase ↔ task.py, lines 22–139 · score 0.79 · 100–300 ms, random uniform, catch trial, starting positions, go cue, joint
- [2] § Methods › RNN model ↔ utils.py, lines 19–67 · score 0.55 · rigid tendon Hill, muscle
- [3] § Methods › Targeted dimensionality reduction ↔ tdr.py, lines 4–30 · score 0.55 · Gram Schmidt orthogonalization, matrix
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
Python · 279 lines · 9.2 KB · no license · 1 match
- import motornet as mn
- import torch as th
- import numpy as np
- from typing import Any
- from typing import Union
- go_time = 0.44
- #go_time = 0.10
- class CentreOutFF(mn.environment.Environment):
- """A reach to a random target from a random starting position."""
- def __init__(self, *args, **kwargs):
- # pass everything as-is to the parent Environment class
- super().__init__(*args, **kwargs)
- self.__name__ = "CentreOutFF"
- # check if we have K and B in kwargs
- self.K = kwargs.get('K', 150)
- self.B = kwargs.get('B', 0.5)
- def reset(self, *,
- seed: int | None = None,
- ff_coefficient: float = 0.,
- condition: str = 'train',
- catch_trial_perc: float = 50,
- go_cue_random = None,
- is_channel: bool = False,
- calc_endpoint_force: bool = False,
- go_cue_range: Union[list, tuple, np.ndarray] = (0.1, 0.3),
- options: dict[str, Any] | None = None) -> tuple[Any, dict[str, Any]]:
- self._set_generator(seed)
- options = {} if options is None else options
- batch_size: int = options.get('batch_size', 1)
- joint_state: th.Tensor | np.ndarray | None = options.get('joint_state', None)
- deterministic: bool = options.get('deterministic', False)
- self.calc_endpoint_force = calc_endpoint_force
- self.batch_size = batch_size
- self.catch_trial_perc = catch_trial_perc
- self.ff_coefficient = ff_coefficient
- self.go_cue_range = go_cue_range # in seconds
- self.is_channel = is_channel
- if (condition=='train'): # train net to reach to random targets
- joint_state = None
- goal = self.joint2cartesian(self.effector.draw_random_uniform_states(batch_size)).chunk(2, dim=-1)[0]
- self.goal = goal if self.differentiable else self.detach(goal)
- # specify go cue time
- if go_cue_random is None:
- go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
- else:
- if go_cue_random:
- go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
- else:
- go_cue_time = np.tile(go_time,batch_size)
- self.go_cue_time = go_cue_time
- elif (condition=='test'): # centre-out reaches to each target
- angle_set = np.deg2rad(np.arange(0,360,45)) # 8 directions
- reps = int(np.ceil(batch_size / len(angle_set)))
- angle = np.tile(angle_set, reps=reps)
- batch_size = reps * len(angle_set)
- reaching_distance = 0.10
- lb = np.array(self.effector.pos_lower_bound)
- ub = np.array(self.effector.pos_upper_bound)
- start_position = lb + (ub - lb) / 2
- start_position = np.array([1.047, 1.570])
- start_position = start_position.reshape(1,-1)
- start_jpv = th.from_numpy(np.concatenate([start_position, np.zeros_like(start_position)], axis=1)) # joint position and velocity
- start_cpv = self.joint2cartesian(start_jpv).numpy()
- end_cp = reaching_distance * np.stack([np.cos(angle), np.sin(angle)], axis=-1)
- goal_states = start_cpv + np.concatenate([end_cp, np.zeros_like(end_cp)], axis=-1)
- goal_states = goal_states[:,:2]
- goal_states = goal_states.astype(np.float32)
- joint_state = th.from_numpy(np.tile(start_jpv,(batch_size,1)))
- goal = th.from_numpy(goal_states)
- self.goal = goal if self.differentiable else self.detach(goal)
- # specify go cue time
- if go_cue_random is None:
- go_cue_time = np.tile(go_time,batch_size)
- else:
- if go_cue_random:
- go_cue_time = np.random.uniform(self.go_cue_range[0],self.go_cue_range[1],batch_size)
- else:
- go_cue_time = np.tile(go_time,batch_size)
- self.go_cue_time = go_cue_time
- self.effector.reset(options={"batch_size": batch_size,"joint_state": joint_state})
- self.elapsed = 0.
- action = th.zeros((batch_size, self.muscle.n_muscles)).to(self.device)
- self.obs_buffer["proprioception"] = [self.get_proprioception()] * len(self.obs_buffer["proprioception"])
- self.obs_buffer["vision"] = [self.get_vision()] * len(self.obs_buffer["vision"])
- self.obs_buffer["action"] = [action] * self.action_frame_stacking
- # specify catch trials
- catch_trial = np.zeros(batch_size, dtype='float32')
- p = int(np.floor(batch_size * self.catch_trial_perc / 100))
- catch_trial[np.random.permutation(catch_trial.size)[:p]] = 1.
- self.catch_trial = catch_trial
- # specify go cue time
- self.go_cue_time[self.catch_trial==1] = self.max_ep_duration
- self.go_cue = th.zeros((batch_size,1)).to(self.device)
- self.init = self.states['fingertip']
- obs = self.get_obs(deterministic=deterministic)
- self.endpoint_load = th.zeros((batch_size,2)).to(self.device)
- self.endpoint_force = th.zeros((batch_size,2)).to(self.device)
- info = {
- "states": self.states,
- "endpoint_load": self.endpoint_load,
- "endpoint_force": self.endpoint_force,
- "action": action,
- "noisy action": action, # no noise here so it is the same
- "goal": self.goal * self.go_cue + self.init * (1-self.go_cue), # target
- }
- return obs, info
- def step(self, action, deterministic: bool = False):
- self.elapsed += self.dt
- if deterministic is False:
- noisy_action = self.apply_noise(action, noise=self.action_noise)
- else:
- noisy_action = action
- self.effector.step(noisy_action,endpoint_load=self.endpoint_load)
- # calculate endpoint force (External force)
- self.endpoint_load = get_endpoint_load(self)
- mask = self.elapsed < (self.go_cue_time + (self.vision_delay) * self.dt)
- self.endpoint_load[mask] = 0
- # calculate endpoint force (Internal force)
- self.endpoint_force = get_endpoint_force(self)
- # specify go cue time
- #mask = self.elapsed >= (self.go_cue_time + (self.vision_delay-1) * self.dt)
- mask = self.elapsed > (self.go_cue_time + (self.vision_delay) * self.dt)
- self.go_cue[mask] = 1
- obs = self.get_obs(action=noisy_action)
- terminated = bool(self.elapsed >= self.max_ep_duration)
- info = {
- "states": self.states,
- "endpoint_load": self.endpoint_load,
- "endpoint_force": self.endpoint_force,
- "action": action,
- "noisy action": noisy_action,
- "goal": self.goal * self.go_cue + self.init * (1-self.go_cue),
- }
- return obs, terminated, info
- def get_proprioception(self):
- mlen = self.states["muscle"][:, 1:2, :] / self.muscle.l0_ce
- mvel = self.states["muscle"][:, 2:3, :] / self.muscle.vmax
- prop = th.concatenate([mlen, mvel], dim=-1).squeeze(dim=1)
- return self.apply_noise(prop, self.proprioception_noise)
- def get_vision(self):
- vis = self.states["fingertip"]
- return self.apply_noise(vis, self.vision_noise)
- def get_obs(self, action=None, deterministic: bool = False):
- self.update_obs_buffer(action=action)
- obs_as_list = [
- self.obs_buffer["vision"][0], # oldest element
- self.obs_buffer["proprioception"][0], # oldest element
- self.goal, # goal #self.init, # initial position
- self.go_cue, # sepcify go cue as an input to the network
- ]
- obs = th.cat(obs_as_list, dim=-1)
- if deterministic is False:
- obs = self.apply_noise(obs, noise=self.obs_noise)
- return obs
- def get_endpoint_force(self):
- """Internal force
- """
- endpoint_force = th.zeros((self.batch_size, 2)).to(self.device)
- if self.calc_endpoint_force:
- L1 = self.skeleton.L1
- L2 = self.skeleton.L2
- pos0, pos1 = self.states['joint'][:,0], self.states['joint'][:,1]
- pos_sum = pos0 + pos1
- c1 = th.cos(pos0)
- c12 = th.cos(pos_sum)
- s1 = th.sin(pos0)
- s12 = th.sin(pos_sum)
- jacobian_11 = -L1*s1 - L2*s12
- jacobian_12 = -L2*s12
- jacobian_21 = L1*c1 + L2*c12
- jacobian_22 = L2*c12
- forces = self.states['muscle'][:, self.muscle.state_name.index('force'):self.muscle.state_name.index('force')+1, :]
- moments = self.states["geometry"][:, 2:, :]
- torque = -th.sum(forces * moments, dim=-1)
- for i in range(self.batch_size):
- jacobian_i = th.tensor([[jacobian_11[i], jacobian_12[i]], [jacobian_21[i], jacobian_22[i]]])
- endpoint_force[i] = torque[i] @ th.inverse(jacobian_i)
- return endpoint_force
- else:
- return endpoint_force
- def get_endpoint_load(self):
- """External force
- """
- # Calculate endpoiont_load
- vel = self.states["cartesian"][:,2:]
- # TODO
- self.goal = self.goal.clone()
- self.init = self.init.clone()
- endpoint_load = th.zeros((self.batch_size,2)).to(self.device)
- if self.is_channel:
- X2 = self.goal
- X1 = self.init
- # vector that connect initial position to the target
- line_vector = X2 - X1
- xy = self.states["cartesian"][:,2:]
- xy = xy - X1
- projection = th.sum(line_vector * xy, axis=-1)/th.sum(line_vector * line_vector, axis=-1)
- projection = line_vector * projection[:,None]
- err = xy - projection
- projection = th.sum(line_vector * vel, axis=-1)/th.sum(line_vector * line_vector, axis=-1)
- projection = line_vector * projection[:,None]
- err_d = vel - projection
- F = -1*(self.B*err+self.K*err_d)
- endpoint_load = F
- else:
- FF_matvel = th.tensor([[0, 1], [-1, 0]], dtype=th.float32)
- endpoint_load = self.ff_coefficient * (vel@FF_matvel.T)
- return endpoint_load
task.py at commit 2bb2883, no license · at the source
Overview
- Department of Psychology, Western University, London, Canada
- Mila–Québec Artificial Intelligence Institute, Montréal, Canada
- Department of Neuroscience, Université de Montréal, Montréal, Canada
- Department of Physiology and Pharmacology, Schulich School of Medicine and Dentistry, London, Canada
- School of Kinesiology and Health Science, Faculty of Health, York University, Toronto, Canada
Abstract
Learning to adapt voluntary movements to an external perturbation, whether mechanical or visual, is faster during a second encounter than during the first. The mechanisms underlying this phenomenon, known as savings, remain unclear. Recent studies propose that the high dimensionality of neural control enables the retention of learning traces that may facilitate savings. To test this idea, we used MotorNet, a framework for training recurrent neural networks (RNNs) to control biomechanical models of the human upper limb. RNNs were trained to perform reaching movements with a velocity-dependent force field (FF) and without (NF) in the sequence NF1 (baseline), FF1 (adaptation), NF2 (washout), and FF2 (re-adaptation). RNNs showed behaviural signatures of savings in the absence of any explicit contextual input signalling the presence or absence of the FF. Savings was more robust in RNNs with larger numbers of units. We identified a component of RNN activity associated with savings—a shift in preparatory activity that persisted even after washout. Displacing this preparatory activity in the direction of the shift enhanced savings, whereas perturbations in the opposite direction reduced or eliminated savings. These findings suggest a potential neural basis for motor memory retention underlying savings that is reliant on the high dimensionality of neural circuits for control, and is independent of cognitive or strategic learning.
Reproduced under the paper's license (CC BY), from the paper cited above.
Repository
Its files are read in the Code ↔ Paper reader above, with 3 matches between paragraphs and lines of code.
mshahbazi1997/MotorSavingModel
2bb2883bff69eef97d7a65a461003babb4f6c79d, 17 March 2026Availability: 1 check, the latest on 28 September 2026: the link answers
- 28 September 2026: the link answers
17 files
- get_utils.py, Python, 167 lines
- model.py, Python, 326 lines
- notebooks/
Latent_analysis.ipynb , Jupyter, 480 lines - notebooks/
hidden_behav_corr.ipynb , Jupyter, 276 lines - notebooks/
perturb_hidden.ipynb , Jupyter, 110 lines - notebooks/
simple.ipynb , Jupyter, 152 lines - notebooks/
weight_ana.ipynb , Jupyter, 34 lines - plot.py, Python, 302 lines
- policy.py, Python, 71 lines
- results/
result_behav.ipynb , Jupyter, 251 lines - results/
result_latent.ipynb , Jupyter, 337 lines - results/
test_network.ipynb , Jupyter, 253 lines - task.py, Python, 279 lines, 1 match
- tdr.py, Python, 87 lines, 1 match
- temp.py, Python, 150 lines
- utils.py, Python, 409 lines, 1 match
- README.md, Text, 8 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;
- 16 scripts, each with its path and the digest of its content;
- 3 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
Python code to reproduce the simulations and analyses described here is available on GitHub at the following repository: https://
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, 4 authors, 1 keyword, 10 MeSH terms, 1 funder, 56 references.
Cite
This paper
Shahbazi, M., Codol, O., Michaels, J. A., & Gribble, P. L. (2026). A context-free model of savings in motor learning. eLife, 14, RP107423. https://
BibTeX
@article{shahbazi2026con
author = {Shahbazi, Mahdiyar and Codol, Olivier and Michaels, Jonathan A and Gribble, Paul L},
title = {{A context-free model of savings in motor learning}},
journal = {eLife},
year = {2026},
month = may,
volume = {14},
pages = {RP107423},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/
url = {https://
pmid = {42126916},
pmcid = {PMC13171098}
}
RIS
TY - JOUR
AU - Shahbazi, Mahdiyar
AU - Codol, Olivier
AU - Michaels, Jonathan A
AU - Gribble, Paul L
TI - A context-free model of savings in motor learning
T2 - eLife
J2 - Elife
PY - 2026
DA - 2026/
VL - 14
SP - RP107423
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": "A context-free model of savings in motor learning",
"container-title": "eLife",
"author": [
{
"family": "Shahbazi",
"given": "Mahdiyar"
},
{
"family": "Codol",
"given": "Olivier"
},
{
"family": "Michaels",
"given": "Jonathan A"
},
{
"family": "Gribble",
"given": "Paul L"
}
],
"container-title-short":
"volume": "14",
"page": "RP107423",
"DOI": "10.7554/
"PMID": "42126916",
"PMCID": "PMC13171098",
"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.pbio.3003684 [code]
- The retrieval of previously learned motor memories is facilitated by the reinstatement of default mode network manifold structures.Journal: PLoS biologyIn common: seaborn, scikit-learn, pandas, 3 other tools, 10 references
- [2] doi:10.3390/biomimetics11080569 [code]
- Pretraining of Embodied Recurrent Networks Bridges the Gap Between Artificial and Cortical Neural Activities.Journal: Biomimetics (Basel, Switzerland)In common: PyTorch, scikit-learn, SciPy, 2 other tools, 6 references
- [3] doi:10.1162/imag.a.1266 [code]
- Multimodal subspace independent vector analysis effectively captures latent relationships between brain structure and function.Journal: Imaging neuroscience (Cambridge, Mass.)In common: statsmodels, seaborn, scikit-learn, 4 other tools, 2 references
- [4] doi:10.1038/s41467-026-74347-8 [code]
- Compositionality of social gaze in the prefrontal-amygdala circuits.Journal: Nature communicationsIn common: statsmodels, seaborn, scikit-learn, 4 other tools, 2 references
- [5] doi:10.1038/s41467-026-75455-1 [code]
- Shared latent representations of speech production for cross-patient speech decoding.Journal: Nature communicationsIn common: statsmodels, PyTorch, seaborn, 5 other tools, 1 reference
- [6] doi:10.1371/journal.pcbi.1014162 [code]
- Exploring neural manifolds across a wide range of intrinsic dimensions.Journal: PLoS computational biologyIn common: scikit-learn, pandas, SciPy, 2 other tools, 3 references
- [7] doi:10.1371/journal.pbio.3003831 [code]
- Disinhibitory signaling enables flexible coding of top-down information in cortical networks.Journal: PLoS biologyIn common: PyTorch, scikit-learn, pandas, 3 other tools, 2 references
- [8] doi:10.1038/s41540-026-00727-x [code]
- Association-sensory spatiotemporal hierarchy and functional gradient-regularised recurrent neural network with implications for schizophrenia.Journal: NPJ systems biology and applicationsIn common: statsmodels, PyTorch, seaborn, 4 other tools, 1 reference
- [9] doi:10.1038/s41467-026-75653-x [code]
- Concept2Brain: an AI model for predicting neurophysiological responses to text and pictures.Journal: Nature communicationsIn common: PyTorch, scikit-learn, pandas, 3 other tools, 2 references
- [10] doi:10.1038/s41467-026-76109-y [code]
- Assistive algorithms influence neural representations in motor brain-computer interfaces.Journal: Nature communicationsIn common: seaborn, scikit-learn, pandas, 3 other tools, 2 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, 16 scripts, and 3 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:80cdb646b315a53f…
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.
