OSCR

Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms.

Code ↔ Paper

8 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 8 matches
  1. [1] § Methods › Model architecture and training ↔ beyond_backprop/algorithms/common/layer.py, lines 281–315 · score 0.64 · dendritic branch, batch normalization, affine, nonlinearities, multicompartmental, bias
  2. [2] § Methods › Generating hallucinations in hierarchical variational autoencoders ↔ halluc.ipynb, lines 19–68 · score 0.63 · Tiny ImageNet, VDVAE models, trained models, VAEs
  3. [3] § Methods › Classifier training ↔ beyond_backprop/algorithms/image_classification.py, lines 19–147 · score 0.59 · cross entropy loss, classifier, phase, algorithm, trained, network
  4. [4] § Results › Mapping the Wake-Sleep algorithm onto cortical architecture ↔ beyond_backprop/algorithms/wake_sleep/rm_wake_sleep.py, lines 37–54 · score 0.59 · Wake Sleep algorithm, Wake phase, Sleep phase, inference, architecture, layer
  5. [5] § Methods › Classifier training ↔ beyond_backprop/algorithms/algorithm.py, lines 28–95 · score 0.56 · cross entropy loss, phase, class, algorithm, trained, network
  6. [6] § Methods › Model architecture and training ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 511–582 · score 0.55 · inference mode, network activity, Wake Sleep, plasticity, CIFAR10, MNIST
  7. [7] § Methods › Quantifying interareal causality through inactivations ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 511–582 · score 0.53 · prevent numerical instability, ratio, variances
  8. [8] § Results › Effects of psychedelics on single neurons ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 126–192 · score 0.51 · apical plasticity, dose dependent, Wake Sleep, gated, psychedelic, basal

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 · 694 lines · 34 KB · MIT · 3 matches

  1. """
  2. Analysis code for processing trained networks
  3. These are callbacks, called by Pytorch Lightning functionality at various points in training
  4. Results are stored in the logs folder
  5. """
  6. from __future__ import annotations
  7. from logging import getLogger as get_logger
  8. from pathlib import Path
  9. import torch
  10. from lightning import Callback, Trainer
  11. from torch import Tensor
  12. import cv2
  13. from collections import defaultdict
  14. from beyond_backprop.algorithms.algorithm import Algorithm
  15. from beyond_backprop.datamodules.dataset_normalizations import cifar10_unnormalization
  16. import matplotlib.pyplot as plt
  17. import numpy as np
  18. from sklearn.decomposition import PCA
  19. from torch.distributions.multivariate_normal import MultivariateNormal
  20. logger = get_logger(__name__)
  21. basal_color = '#72a6ca'
  22. apical_color = '#e0474c'
  23. fontsize = 5
  24. def generated_image_plot(sample_data, log_dir):
  25. """
  26. Plotting function for the GenerativeSamples Callback
  27. """
  28. fig, axes = plt.subplots(2, 5, sharey = True, figsize = (7.5, 3))
  29. fig.suptitle('sample generated image', fontsize = fontsize)
  30. idx = 0
  31. shape = sample_data[idx,...].shape
  32. if shape[0] == 3 and shape[1] == 32:
  33. cifar10 = True
  34. else:
  35. cifar10 = False
  36. for ii in range(0,2):
  37. for jj in range(0,5):
  38. if cifar10:
  39. axes[ii,jj].imshow(cifar10_unnormalization(torch.tensor(sample_data[idx,...].permute(1,2,0))))
  40. else:
  41. axes[ii,jj].imshow(torch.tensor(sample_data[idx,...].permute(1,2,0)), cmap = 'gray', vmin = -1, vmax = 1)
  42. axes[ii,jj].tick_params(left=False,
  43. bottom=False,
  44. labelleft=False,
  45. labelbottom=False)
  46. idx = idx + 1
  47. plt.savefig(str(log_dir / "gen_images.pdf"), format = 'pdf')
  48. return
  49. class GenerativeSamples(Callback):
  50. def __init__(self) -> None:
  51. """
  52. Callback that plots generative samples from a trained InfGenNetwork after testing
  53. """
  54. super().__init__()
  55. def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
  56. pl_module.network.gen_forward()
  57. sample_data = pl_module.network.gen_ts[-1].gen_output.cpu()
  58. if trainer is not None:
  59. # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
  60. # except maybe during some unit tests where the DataModule is used by itself.)
  61. log_dir = Path(trainer.log_dir or log_dir)
  62. generated_image_plot(sample_data, log_dir)
  63. return
  64. class SimRecord(defaultdict):
  65. __getattr__= defaultdict.__getitem__
  66. __setattr__= defaultdict.__setitem__
  67. __delattr__= defaultdict.__delitem__
  68. def default_factory():
  69. return []
  70. def inf_gen_loss_plot(record, log_dir):
  71. """
  72. Plotting the network inference and generative losses
  73. """
  74. fig, axes = plt.subplots(1, 2, sharey = False, figsize = (3,1.5), layout='constrained')
  75. fig.suptitle('Loss curves', fontsize = fontsize)
  76. axes[0].plot(torch.tensor(record.inf_loss), color = basal_color)
  77. axes[0].set_yscale('symlog')
  78. axes[0].set_title('inf_loss', color = basal_color, fontsize = fontsize)
  79. axes[1].plot(torch.tensor(record.gen_loss), color = apical_color)
  80. axes[1].set_yscale('symlog')
  81. axes[1].set_title('gen_loss', color = apical_color, fontsize = fontsize)
  82. axes[0].spines.top.set_visible(False)
  83. axes[0].spines.right.set_visible(False)
  84. axes[1].spines.top.set_visible(False)
  85. axes[1].spines.right.set_visible(False)
  86. plt.savefig(str(log_dir / "loss.pdf"), format = 'pdf')
  87. return
  88. class InfGenLossRecord(Callback):
  89. def __init__(self) -> None:
  90. """
  91. Callback that records inference and generative losses for a network during training and generates plots
  92. """
  93. super().__init__()
  94. self.record = SimRecord(default_factory)
  95. def on_train_batch_end(
  96. self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int
  97. ) -> None:
  98. self.record.inf_loss.append(pl_module.pre_grad_inf.detach())
  99. self.record.gen_loss.append(pl_module.pre_grad_gen.detach())
  100. return
  101. def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
  102. if trainer is not None:
  103. # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
  104. # except maybe during some unit tests where the DataModule is used by itself.)
  105. log_dir = Path(trainer.log_dir or log_dir)
  106. inf_gen_loss_plot(self.record, log_dir)
  107. return
  108. def plasticity_quant_plot(total_apical_plasticity, total_apical_plasticity_sem, total_basal_plasticity, total_basal_plasticity_sem, apical_cossim, basal_cossim, log_dir):
  109. """Plotting function for analyzing psychedelic-induced increases in plasticity"""
  110. if len(total_apical_plasticity) == 11:
  111. mixing_constant = torch.arange(0,1.1,0.1)
  112. else:
  113. mixing_constant = torch.arange(0,1,0.2)
  114. fig, axes = plt.subplots(1,1, figsize = (3,3))
  115. axes.errorbar(mixing_constant, total_apical_plasticity, yerr = total_apical_plasticity_sem, color = apical_color, ecolor = apical_color)
  116. axes.errorbar(mixing_constant, (1-mixing_constant) * total_apical_plasticity, yerr = (1-mixing_constant) * total_apical_plasticity_sem, color = 'k', ecolor = 'k')
  117. axes.set_title('apical')
  118. plt.legend(['without gating', 'with gating'])
  119. axes.set_ylim([0, torch.max(total_apical_plasticity)])
  120. axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
  121. axes.set_ylabel('total plasticity', fontsize = fontsize)
  122. axes.spines.top.set_visible(False)
  123. axes.spines.right.set_visible(False)
  124. axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  125. axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  126. plt.tight_layout()
  127. fig.suptitle('Dose dependence of apical plasticity', fontsize = fontsize)
  128. fig.savefig(str(log_dir / "Plasticity Quant Apical.pdf"), format = 'pdf')
  129. fig_2, axes_2 = plt.subplots(1,1, figsize = (3,3))
  130. axes_2.errorbar(mixing_constant, total_basal_plasticity, yerr = total_basal_plasticity_sem, color = basal_color, ecolor = basal_color)
  131. axes_2.errorbar(mixing_constant, mixing_constant * total_basal_plasticity, yerr = (mixing_constant) * total_basal_plasticity_sem, color = 'k', ecolor = 'k')
  132. axes_2.set_title('basal')
  133. plt.legend(['without gating', 'with gating'])
  134. axes_2.set_ylim([0, torch.max(total_basal_plasticity)])
  135. axes_2.set_xlabel(r'$\alpha$', fontsize = fontsize)
  136. axes_2.set_ylabel('total plasticity', fontsize = fontsize)
  137. axes_2.spines.top.set_visible(False)
  138. axes_2.spines.right.set_visible(False)
  139. axes_2.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  140. axes_2.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  141. plt.tight_layout()
  142. fig_2.suptitle('Dose dependence of basal plasticity', fontsize = fontsize)
  143. fig_2.savefig(str(log_dir / "Plasticity Quant Basal.pdf"), format = 'pdf')
  144. fig_3, axes_3 = plt.subplots(1,2, figsize = (3,1.5))
  145. axes_3[0].scatter(mixing_constant, apical_cossim, color = apical_color)
  146. axes_3[1].scatter(mixing_constant, basal_cossim, color = basal_color)
  147. axes_3[0].set_title('apical')
  148. axes_3[1].set_title('basal')
  149. axes_3[0].set_xlabel(r'$\alpha$', fontsize = fontsize)
  150. axes_3[0].set_ylabel('cosine sim', fontsize = fontsize)
  151. axes_3[1].set_xlabel(r'$\alpha$', fontsize = fontsize)
  152. axes_3[1].set_ylabel('cosine sim', fontsize = fontsize)
  153. axes_3[0].set_ylim([0,1])
  154. axes_3[1].set_ylim([0,1])
  155. axes_3[0].spines.top.set_visible(False)
  156. axes_3[0].spines.right.set_visible(False)
  157. axes_3[1].spines.top.set_visible(False)
  158. axes_3[1].spines.right.set_visible(False)
  159. axes_3[0].tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  160. axes_3[0].tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  161. axes_3[1].tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  162. axes_3[1].tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  163. plt.tight_layout()
  164. fig_3.suptitle('Dose dependence of plasticity cosine sim', fontsize = fontsize)
  165. fig_3.savefig(str(log_dir / "Plasticity Quant Cosine Sim.pdf"), format = 'pdf')
  166. return
  167. def apical_basal_alignment_plot(record, log_dir):
  168. """Plotting function for analyzing alignment between the apical and basal dendrites"""
  169. plt.figure()
  170. fig, axes = plt.subplots(1, 5, figsize = (7.5,1.5))
  171. basal = torch.vstack(record.basal).cpu()
  172. apical = torch.vstack(record.apical).cpu()
  173. fig.suptitle('Apical Basal Alignment', fontsize = fontsize)
  174. for idx in range(0,4):
  175. axes[idx].scatter(basal[:, idx], apical[:, idx])
  176. axes[idx].plot([-1, 1], [-1,1])
  177. basal_standardized = (basal - torch.mean(basal, axis = 0, keepdim = True))/torch.std(basal, axis = 0, keepdim = True)
  178. apical_standardized = (apical - torch.mean(apical, axis = 0, keepdim = True))/torch.std(apical, axis = 0, keepdim = True)
  179. corr = basal_standardized.T @ apical_standardized/ basal_standardized.shape[0]
  180. diag = torch.diag(corr)
  181. N = len(diag)
  182. off_diag = corr.flatten()[1:].view(N-1, N+1)[:,:-1].flatten()
  183. K = 1
  184. axes[4].imshow(corr[0:K, 0:K], vmin = -1, vmax = 1)
  185. axes[4].set_title('apical and basal correlations', fontsize = fontsize)
  186. axes[4].set_ylabel('basal neuron #', fontsize = fontsize)
  187. axes[4].set_xlabel('apical neuron #', fontsize = fontsize)
  188. fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
  189. axes.boxplot([off_diag, diag], tick_labels = ['rand.', 'same'], showfliers = False)
  190. axes.set_yticks([-0.5, 0, 0.5, 1])
  191. axes.set_ylim([-0.5, 1.2])
  192. axes.set_yticklabels([-0.5, 0, 0.5, 1], fontsize = fontsize)
  193. axes.spines.top.set_visible(False)
  194. axes.spines.right.set_visible(False)
  195. axes.set_ylabel('correlation', fontsize = fontsize)
  196. plt.tight_layout()
  197. plt.savefig(str(log_dir / "Apical Basal Alignment.pdf"), format = 'pdf')
  198. return
  199. class ApicalBasalAlignment(Callback):
  200. "Callback for quantifying the degree of apical-basal alignment for a given network"
  201. def __init__(self) -> None:
  202. """
  203. Callback that records network activation variables for a network during training
  204. """
  205. super().__init__()
  206. self.record = SimRecord(default_factory)
  207. def on_test_batch_end(
  208. self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int, dataloader_idx = 0
  209. ) -> None:
  210. pl_module.network.forward(pl_module.x)
  211. self.record.basal.append(pl_module.network.ts[2].output)
  212. pl_module.network.gen_log_prob()
  213. self.record.apical.append(pl_module.network.ts[2].predicted_activity_gen[0])
  214. return
  215. def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
  216. if trainer is not None:
  217. # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
  218. # except maybe during some unit tests where the DataModule is used by itself.)
  219. log_dir = Path(trainer.log_dir or log_dir)
  220. apical_basal_alignment_plot(self.record, log_dir)
  221. return
  222. def fig2rgb_array(fig):
  223. fig.canvas.draw()
  224. buf = fig.canvas.tostring_rgb()
  225. ncols, nrows = fig.canvas.get_width_height()
  226. return np.fromstring(buf, dtype=np.uint8).reshape(nrows, ncols, 3)
  227. def figure_to_array(fig):
  228. fig.canvas.draw()
  229. fig_array = fig2rgb_array(fig)
  230. fig_array = fig_array[:,:,[2,1,0]]
  231. return fig_array
  232. def dynamic_mixed_samples_pyplot(sample_data, log_dir):
  233. """Function for storing a hallucination sequence as a video"""
  234. sample_data[torch.where(sample_data < 0)] = 0
  235. sample_data[torch.where(sample_data > 1)] = 1
  236. file_handle = 'Dynamic mixed samples image.mp4'
  237. filename = str(log_dir / file_handle)
  238. frame_size = (1000, 1000)
  239. output = cv2.VideoWriter(filename, cv2.VideoWriter_fourcc(*'mp4v'), 60, frame_size)
  240. T = sample_data.shape[2]
  241. fig, axes = plt.subplots(6, 6, sharey = True, sharex = True, figsize = (10, 10))
  242. for tt in range(0,T):
  243. for ii in range(0,6):
  244. for jj in range(0,6):
  245. idx_j = jj * 2
  246. axes[ii,jj].imshow(sample_data[ii,idx_j,tt,...], cmap = 'gray', vmin = -1, vmax = 1)
  247. axes[ii,jj].tick_params(left=False,
  248. bottom=False,
  249. labelleft=False,
  250. labelbottom=False)
  251. if ii == 0:
  252. axes[ii,jj].set_title(r'$\alpha : %1.2f$' %(idx_j*0.2), fontsize = fontsize)
  253. fig_array = figure_to_array(fig)
  254. output.write(fig_array)
  255. output.release()
  256. cv2.destroyAllWindows()
  257. def classifier_output_quant(mixed_samples, reference_data, y, network):
  258. """Utility function for quantifying the classifier output accuracy and variability for hallucination data"""
  259. if torch.cuda.is_available():
  260. mixed_samples = mixed_samples.to(torch.cuda.current_device())
  261. reference_data = reference_data.to(torch.cuda.current_device())
  262. y = y.to(torch.cuda.current_device())
  263. classifier_logits = network.classifier(mixed_samples)
  264. reference_logits = network.classifier(reference_data)
  265. class_predictions = torch.argmax(classifier_logits, dim = -1)
  266. accuracy = torch.sum(class_predictions[:,-1] == y)/len(y)
  267. variability = torch.mean(torch.var(classifier_logits, axis = 1))
  268. classifier_corr = torch.corrcoef(classifier_logits.flatten(end_dim = 1).permute(1,0))
  269. reference_corr = torch.corrcoef(reference_logits.flatten(end_dim = 1).permute(1,0))
  270. dist = 1 - torch.corrcoef(torch.stack([classifier_corr.flatten(), reference_corr.flatten()]))[0,1]
  271. return accuracy, variability, dist
  272. def classifier_output_plot(classifier_accuracy, classifier_variability, log_dir):
  273. """Plotting function for the classifier accuracy"""
  274. mixing_constant = torch.arange(0,1.1,0.1)
  275. fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
  276. axes.scatter(mixing_constant, classifier_accuracy, color = apical_color)
  277. plt.title('Classifier Accuracy')
  278. axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
  279. axes.set_ylabel('Proportion correct', fontsize = fontsize)
  280. axes.set_ylim([0,1])
  281. axes.spines.top.set_visible(False)
  282. axes.spines.right.set_visible(False)
  283. axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  284. axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  285. plt.tight_layout()
  286. fig.savefig(str(log_dir / "classifier accuracy.pdf"), format = 'pdf')
  287. fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
  288. axes.scatter(mixing_constant, classifier_variability, color = apical_color)
  289. plt.title('Classifier Output Variability')
  290. axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
  291. axes.set_ylabel('Variability', fontsize = fontsize)
  292. axes.spines.top.set_visible(False)
  293. axes.spines.right.set_visible(False)
  294. axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  295. axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  296. plt.tight_layout()
  297. fig.savefig(str(log_dir / "classifier variability.pdf"), format = 'pdf')
  298. def dynamic_stim_cond_var(mixed_outputs, reference):
  299. """Utility function for computing the change in stimulus-conditioned variability averaged over a batch of stimuli, for hallucinated network activity"""
  300. var = torch.var(mixed_outputs, dim = 0)
  301. ref_var = torch.var(reference, dim = 0)
  302. delta_var = torch.mean(var - ref_var)
  303. sem_var = torch.std(var - ref_var)/np.sqrt(var.shape[0])
  304. return delta_var, sem_var
  305. def dynamic_across_stim_var(mixed_outputs, inact_mixed_outputs):
  306. """Utility function for computing the change in across-stimulus variability for hallucinated network activity"""
  307. var_ratio_eps = 1e-3
  308. var = torch.var(mixed_outputs[[-1],...], dim = (0,1))
  309. inact_var = torch.var(inact_mixed_outputs[[-1],...], dim = (0,1))
  310. mean_var_ratio = torch.mean((inact_var + var_ratio_eps)/(var + var_ratio_eps))
  311. sem_var_ratio = torch.std((inact_var + var_ratio_eps)/(var + var_ratio_eps))/np.sqrt(var.shape[0])
  312. return mean_var_ratio, sem_var_ratio
  313. def dynamic_stim_cond_var_plot(mean_stimulus_conditioned_variance, sem_stimulus_conditioned_variance, log_dir, indicator = ""):
  314. """Plotting function for quantifying stimulus-conditioned variability"""
  315. #generate plots
  316. fig, axes = plt.subplots(1,1,figsize = (1.5,1.5))
  317. plt.bar(torch.arange(0,12), mean_stimulus_conditioned_variance, yerr = sem_stimulus_conditioned_variance)
  318. plt.xticks(ticks = torch.arange(0,12), labels = [r"$\alpha$ = 0", r"$\alpha$ = 0.1", r"$\alpha$ = 0.2", r"$\alpha$ = 0.3", r"$\alpha$ = 0.4", r"$\alpha$ = 0.5", r"$\alpha$ = 0.6", r"$\alpha$ = 0.7", r"$\alpha$ = 0.8", r"$\alpha$ = 0.9", r"$\alpha$ = 1", "across stim"], rotation = 90, fontsize = fontsize)
  319. plt.title("Dose Dependence of Stimulus-Conditioned Variance", fontsize = fontsize)
  320. axes.spines.top.set_visible(False)
  321. axes.spines.right.set_visible(False)
  322. axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  323. axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  324. plt.tight_layout()
  325. path = "Delta Dynamic Stimulus Conditioned Variance" + indicator + ".pdf"
  326. plt.savefig(str(log_dir / path), format = 'pdf')
  327. return
  328. def dynamic_across_stim_var_plot(mean_var_ratio, std_var_ratio, log_dir, indicator = ""):
  329. """Plotting function for quantifying across-stimulus variability"""
  330. fig, axes = plt.subplots(1,1,figsize = (1.5,1.5))
  331. plt.errorbar(torch.arange(0,11), mean_var_ratio, yerr = std_var_ratio)
  332. plt.plot(torch.arange(0,11), torch.ones(11), 'k')
  333. plt.xticks(ticks = torch.arange(0,11), labels = [r"$\alpha$ = 0", r"$\alpha$ = 0.1", r"$\alpha$ = 0.2", r"$\alpha$ = 0.3", r"$\alpha$ = 0.4", r"$\alpha$ = 0.5", r"$\alpha$ = 0.6", r"$\alpha$ = 0.7", r"$\alpha$ = 0.8", r"$\alpha$ = 0.9", r"$\alpha$ = 1"], rotation = 90, fontsize = fontsize)
  334. plt.title("Dose Dependence of Across-Stim Variance", fontsize = fontsize)
  335. axes.spines.top.set_visible(False)
  336. axes.spines.right.set_visible(False)
  337. axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
  338. axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
  339. plt.tight_layout()
  340. path = "Delta Variance" + indicator + ".pdf"
  341. plt.savefig(str(log_dir / path), format = 'pdf')
  342. return
  343. def dynamic_image_plot(sample_data, log_dir, indicator = ""):
  344. """Plotting function for stimulus-layer hallucination snapshots"""
  345. fig, axes = plt.subplots(6, 11, sharey = True, figsize = (7.5, 3))
  346. fig.suptitle('sample generated image', fontsize = fontsize)
  347. idx = 0
  348. shape = sample_data[idx,...].shape
  349. if shape[0] == 3 and shape[1] == 32:
  350. cifar10 = True
  351. else:
  352. cifar10 = False
  353. for ii in range(0,6):
  354. for jj in range(0,11):
  355. if cifar10:
  356. axes[ii,jj].imshow(cifar10_unnormalization(torch.tensor(sample_data[ii,jj,...].permute(1,2,0))))
  357. else:
  358. axes[ii,jj].imshow(torch.tensor(sample_data[ii,jj,...].permute(1,2,0)), cmap = 'gray', vmin = -1, vmax = 1)
  359. axes[ii,jj].tick_params(left=False,
  360. bottom=False,
  361. labelleft=False,
  362. labelbottom=False)
  363. idx = idx + 1
  364. path = indicator + "_dynamic_images.pdf"
  365. plt.savefig(str(log_dir / path), format = 'pdf')
  366. return
  367. def dynamic_corr_calc(activity):
  368. """Utility function for computing within-layer correlations"""
  369. flat_activity = activity
  370. return torch.corrcoef(flat_activity.T)
  371. def dynamic_corr_comparisons_plot(corr_list, log_dir, indicator = ""):
  372. """Plotting function for comparing correlation matrices across different hallucination levels"""
  373. mixing_constant = np.arange(0,1,0.2)
  374. fig, axes = plt.subplots(1, 11, sharey = True, sharex = True, figsize = (15,1.5))
  375. fig_2, axes_2 = plt.subplots(1, 11, sharey = True, sharex = True, figsize = (15,1.5))
  376. fig_3, axes_3 = plt.subplots(1,1, figsize = (1.5,1.5))
  377. fig.suptitle('Across stimulus correlation matrices', fontsize = fontsize)
  378. K = 20
  379. mixing_constant = np.arange(0,1.1,0.1)
  380. corr_vec = torch.zeros(len(mixing_constant))
  381. for jj in range(0,len(mixing_constant)):
  382. corr_full = corr_list[jj,...]
  383. corr = corr_full[0:K,0:K]
  384. if jj == 0:
  385. corr_0 = corr
  386. corr_0_full = corr_full
  387. im = axes[jj].imshow(corr - torch.eye(*corr.shape), vmin = -1, vmax = 1)
  388. fig.colorbar(im, ax = axes[jj])
  389. axes[jj].set_title(r'$\alpha : %1.2f$' %(jj*0.1), fontsize = fontsize)
  390. axes[jj].tick_params(left=False,
  391. bottom=False,
  392. labelleft=False,
  393. labelbottom=False)
  394. axes_2[jj].scatter(corr_0.flatten(), corr.flatten())
  395. axes_2[jj].set_xlabel(r'$\alpha = 0$ correlation', fontsize = fontsize)
  396. axes_2[jj].set_ylabel(r'$\alpha = %1.2f$ correlation' %(jj*0.1), fontsize = fontsize)
  397. corr_vec[jj] = torch.corrcoef(torch.stack([corr_0_full.flatten(), corr_full.flatten()]))[0,1]
  398. axes_3.scatter(mixing_constant[jj], corr_vec[jj])
  399. path_1 = indicator + "Correlation matrices.pdf"
  400. path_2 = indicator + "Correlation matrix scatterplots.pdf"
  401. fig.savefig(str(log_dir / path_1), format = 'pdf')
  402. fig_2.savefig(str(log_dir / path_2), format = 'pdf')
  403. axes_3.set_ylabel('corr sim')
  404. axes_3.set_title('Dose Dependence of Correlation similarity')
  405. axes_3.set_ylim([0,1])
  406. plt.xticks(ticks = mixing_constant, labels = [r"$\alpha$ = 0", r"$\alpha$ = 0.1", r"$\alpha$ = 0.2", r"$\alpha$ = 0.3", r"$\alpha$ = 0.4", r"$\alpha$ = 0.5", r"$\alpha$ = 0.6", r"$\alpha$ = 0.7", r"$\alpha$ = 0.8", r"$\alpha$ = 0.9", r"$\alpha$ = 1.0"], rotation = 90, fontsize = fontsize)
  407. plt.tight_layout()
  408. path_3 = indicator + "Correlation similarity metric.pdf"
  409. fig_3.savefig(str(log_dir / path_3), format = 'pdf')
  410. return
  411. def cosine_similarity(vec_1, vec_2):
  412. """Utility function for computing cosine similarity"""
  413. norm_1 = vec_1.flatten()
  414. norm_1 = norm_1/torch.linalg.norm(norm_1)
  415. norm_2 = vec_2.flatten()
  416. norm_2 = norm_2/torch.linalg.norm(norm_2)
  417. return torch.dot(norm_1, norm_2)
  418. def explained_var_calc(data, n_components):
  419. """Utility function for computing the proportion explained variance of different principal components"""
  420. pca = PCA(n_components=n_components)
  421. pca.fit(data.flatten(start_dim = 1))
  422. return pca.explained_variance_ratio_
  423. def explained_var_plot(explained_var, log_dir):
  424. """Plotting function for the proportion explained variance for different principal components across different hallucination levels"""
  425. fig, ax = plt.subplots(1,1, figsize = (3, 3))
  426. ax.plot(explained_var[0,:])
  427. ax.plot(explained_var[5,:])
  428. ax.plot(explained_var[-1,:])
  429. ax.set_xlabel('PC #')
  430. ax.set_ylabel('Proportion explained variance')
  431. plt.legend((r'$\alpha = 0$', r'$\alpha = 0.5$', r'$\alpha = 1$'))
  432. plt.tight_layout()
  433. fig.savefig(str(log_dir / "explained variance ratio analysis.pdf"), format = 'pdf')
  434. class DynamicMixedSampler(Callback):
  435. def __init__(self) -> None:
  436. """
  437. The primary callback for generating and analyzing hallucinatory activity in trained networks
  438. """
  439. super().__init__()
  440. self.record = SimRecord(default_factory)
  441. def on_test_batch_end(
  442. self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int, dataloader_idx = 0
  443. ) -> None:
  444. self.record.x.append(pl_module.x)
  445. self.record.y.append(pl_module.y)
  446. return
  447. def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
  448. """Run on a fully trained network at the end of training"""
  449. with torch.inference_mode(False),torch.set_grad_enabled(True):
  450. if trainer is not None:
  451. # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
  452. # except maybe during some unit tests where the DataModule is used by itself.)
  453. log_dir = Path(trainer.log_dir or log_dir)
  454. mixing_constant = np.arange(0,1.1,0.1)
  455. T = 800 #number of simulation timesteps
  456. plasticity_eps = 1e-2 #constant to prevent numerical instability in plasticity calculations
  457. sample_data = torch.zeros(6,11,T, *pl_module.x[0,...].permute(1,2,0).shape)
  458. #Initialize all storage variables
  459. x = pl_module.x
  460. y = pl_module.y
  461. timescale = 0.1
  462. shape = x[0,...].shape
  463. sample_data_im_analysis = torch.zeros(x.shape[0],11, *pl_module.x[0,...].permute(1,2,0).shape)
  464. sample_data_closed_eyes = torch.zeros(6,11,*pl_module.x[0,...].permute(1,2,0).shape)
  465. if shape[0] == 3 and shape[1] == 32:
  466. cifar10 = True
  467. inaturalist = False
  468. mnist = False
  469. elif shape[0] == 3 and shape[1] == 224:
  470. inaturalist = True
  471. cifar10 = False
  472. mnist = False
  473. else:
  474. mnist = True
  475. cifar10 = False
  476. inaturalist = False
  477. classifier_accuracy = torch.zeros(11)
  478. classifier_variability = torch.zeros(11)
  479. classifier_dist = torch.zeros(13)
  480. corr_N = np.prod(pl_module.network.ts[1].output.shape[1::])
  481. corr = torch.zeros(11,corr_N, corr_N)
  482. pc_num = 20
  483. explained_var = torch.zeros(11, pc_num)
  484. mean_stimulus_conditioned_variance = torch.zeros(12)
  485. std_stimulus_conditioned_variance = torch.zeros(12)
  486. mean_var_ratio = torch.zeros(11)
  487. sem_var_ratio = torch.zeros(11)
  488. mean_var_ratio_apical = torch.zeros(11)
  489. sem_var_ratio_apical = torch.zeros(11)
  490. total_apical_plasticity = torch.zeros(11)
  491. total_apical_plasticity_sem = torch.zeros(11)
  492. apical_cosine_sim = torch.zeros(11)
  493. total_basal_plasticity = torch.zeros(11)
  494. total_basal_plasticity_sem = torch.zeros(11)
  495. basal_cosine_sim = torch.zeros(11)
  496. gen_opt, inf_opt, _ = pl_module.optimizers()
  497. if mnist:
  498. multiplier = -1.
  499. else:
  500. multiplier = 0.
  501. if torch.cuda.is_available():
  502. x_closed_eyes = multiplier*torch.ones(pl_module.x.shape, device = torch.cuda.current_device())
  503. else:
  504. x_closed_eyes = multiplier*torch.ones(pl_module.x.shape)
  505. for jj in range(0,11): # loop through hallucination magnitudes
  506. data = x
  507. #Store network activity for layers 0 and 1 while under hallucinatory dynamics
  508. data = pl_module.network.dynamic_mixed_forward(data, T, mixing_constant = 1-mixing_constant[jj], timescale = timescale, idxs = [0,1], mode = pl_module.hallucination_mode)
  509. #Generate plasticity based on hallucinatory network activity
  510. gen_opt.zero_grad()
  511. total_likelihood_gen_rm = - pl_module.network.gen_log_prob(mixed_output = True)
  512. pre_grad_gen = torch.mean(total_likelihood_gen_rm)
  513. pre_grad_gen.backward()
  514. gen_grad_list = []
  515. gen_grad_var_list = []
  516. gen_grad_dim_list = []
  517. gen_cosine_sim = []
  518. if jj == 0:
  519. baseline_grad_list_gen = []
  520. ctr = 0
  521. #Quantify plasticity based on hallucinatory network activity
  522. for param in pl_module.network.gen_group.parameters():
  523. if not(param.grad is None):
  524. if jj == 0:
  525. baseline_grad_list_gen.append(param.grad)
  526. gen_grad_list.append(torch.mean(pl_module.hp.backward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
  527. gen_grad_dim_list.append(torch.prod(torch.tensor(param.grad.shape)))
  528. gen_grad_var_list.append(torch.var(pl_module.hp.backward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
  529. gen_cosine_sim.append(cosine_similarity(param.grad, baseline_grad_list_gen[ctr]))
  530. ctr += 1
  531. total_apical_plasticity[jj] = torch.mean(torch.tensor(gen_grad_list))
  532. total_gen_param_num = torch.sum(torch.tensor(gen_grad_dim_list))
  533. #have to reweight the variances by the number of parameters in each tensor
  534. total_apical_plasticity_sem[jj] = torch.sum((torch.tensor(gen_grad_dim_list) * torch.tensor(gen_grad_var_list)))/total_gen_param_num / torch.sqrt(total_gen_param_num)
  535. apical_cosine_sim[jj] = torch.mean(torch.tensor(gen_cosine_sim))
  536. inf_opt.zero_grad()
  537. total_likelihood_inf = -pl_module.network.log_prob(mixed_output = True)
  538. pre_grad_inf = torch.mean(total_likelihood_inf)
  539. pre_grad_inf.backward()
  540. inf_grad_list = []
  541. inf_grad_dim_list = []
  542. inf_grad_var_list = []
  543. inf_cosine_sim = []
  544. if jj == 0:
  545. baseline_grad_list_inf = []
  546. ctr = 0
  547. for param in pl_module.network.inf_group.parameters():
  548. if not(param.grad is None):
  549. if jj == 0:
  550. baseline_grad_list_inf.append(param.grad)
  551. inf_grad_list.append(torch.mean(pl_module.hp.forward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
  552. inf_grad_dim_list.append(torch.prod(torch.tensor(param.grad.shape)))
  553. inf_grad_var_list.append(torch.var(pl_module.hp.forward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
  554. inf_cosine_sim.append(cosine_similarity(param.grad, baseline_grad_list_inf[ctr]))
  555. ctr +=1
  556. total_basal_plasticity[jj] = torch.mean(torch.tensor(inf_grad_list))
  557. total_inf_param_num = torch.sum(torch.tensor(inf_grad_dim_list))
  558. #have to reweight the variances by the number of parameters in each tensor
  559. total_basal_plasticity_sem[jj] = torch.sum((torch.tensor(inf_grad_dim_list) * torch.tensor(inf_grad_var_list)))/total_inf_param_num / torch.sqrt(total_inf_param_num)
  560. basal_cosine_sim[jj] = torch.mean(torch.tensor(inf_cosine_sim))
  561. im_data = data[0].cpu().permute(1,0,3,4,2)
  562. lesion_idx = 0
  563. #generate inactivation data (inactivate highest network layer)
  564. data_inactivation = pl_module.network.dynamic_mixed_forward(x, T, mixing_constant = 1-mixing_constant[jj], timescale = timescale, idxs = [0], lesion_idxs = [lesion_idx], mode = pl_module.hallucination_mode)
  565. #generate apical inactivation data (cut off apical inputs to the stimulus layer)
  566. apical_lesion_idx = len(pl_module.network.gen_ts) - 1
  567. data_apical_inactivation = pl_module.network.dynamic_mixed_forward(x, T, mixing_constant = 1-mixing_constant[jj], timescale = timescale, idxs = [0], apical_lesion_idxs = [apical_lesion_idx], mode = pl_module.hallucination_mode)
  568. im_data_inactivation = data_inactivation[0].cpu().permute(1,0,3,4,2)
  569. im_data_apical_inactivation = data_apical_inactivation[0].cpu().permute(1,0,3,4,2)
  570. data_closed_eyes = pl_module.network.dynamic_mixed_forward(x_closed_eyes, T, mixing_constant = 1-mixing_constant[jj], timescale = timescale, idxs = [0])
  571. im_data_closed_eyes = data_closed_eyes[0].cpu().permute(1,0,3,4,2)
  572. if jj == 0:
  573. class_data_ref = data[1].cpu().permute(1,0,2)
  574. class_data = data[1].cpu().permute(1,0,2)
  575. corr[jj,...] = dynamic_corr_calc(class_data[:,-1,...])
  576. explained_var[jj,:] = torch.from_numpy(explained_var_calc(class_data[:,-1,...], pc_num))
  577. sample_data[:,jj,...] = im_data[0:6,...] #
  578. sample_data_closed_eyes[:,jj,...] = im_data_closed_eyes[0:6,-1,...]
  579. sample_data_im_analysis[:,jj,...] = im_data[:,-1,...]
  580. if cifar10:
  581. sample_data[:,jj,...] = cifar10_unnormalization(sample_data[:,jj,...])
  582. elif inaturalist:
  583. sample_data = sample_data
  584. if jj == 0:
  585. reference_data = im_data.permute(1,0,2,3,4)
  586. if jj == 0:
  587. mean_stimulus_conditioned_variance[-1], std_stimulus_conditioned_variance[-1] = dynamic_stim_cond_var(im_data.permute(1,0,2,3,4)[0,...], reference_data)
  588. mean_stimulus_conditioned_variance[jj], std_stimulus_conditioned_variance[jj] = dynamic_stim_cond_var(im_data.permute(1,0,2,3,4), reference_data)
  589. mean_var_ratio[jj], sem_var_ratio[jj] = dynamic_across_stim_var(im_data.permute(1,0,2,3,4), im_data_inactivation.permute(1,0,2,3,4))
  590. mean_var_ratio_apical[jj], sem_var_ratio_apical[jj]= dynamic_across_stim_var(im_data.permute(1,0,2,3,4), im_data_apical_inactivation.permute(1,0,2,3,4))
  591. classifier_accuracy[jj], classifier_variability[jj], classifier_dist[jj] = classifier_output_quant(class_data, class_data_ref, y, pl_module.network)
  592. if mnist:
  593. sample_data = (sample_data + 1)/2 #now mnist data lies between 0 and 1
  594. sample_data = sample_data.repeat(1,1,1,1,1,3) #convert [28,28,1] shape to [28,28,3] shape
  595. #generate plots based on analyzed data
  596. dynamic_stim_cond_var_plot(mean_stimulus_conditioned_variance, std_stimulus_conditioned_variance, log_dir)
  597. plasticity_quant_plot(total_apical_plasticity, total_apical_plasticity_sem, total_basal_plasticity, total_basal_plasticity_sem, apical_cosine_sim, basal_cosine_sim, log_dir)
  598. explained_var_plot(explained_var, log_dir)
  599. dynamic_across_stim_var_plot(mean_var_ratio, sem_var_ratio, log_dir, indicator = "")
  600. dynamic_across_stim_var_plot(mean_var_ratio_apical, sem_var_ratio_apical, log_dir, indicator = " apical inact")
  601. classifier_output_plot(classifier_accuracy, classifier_variability, log_dir)
  602. dynamic_image_plot(sample_data[:,:,-1,...].permute(0,1,4,2,3), log_dir, indicator = "mixed")
  603. dynamic_image_plot(sample_data_closed_eyes.permute(0,1,4,2,3), log_dir, indicator = "closed_eyes")
  604. dynamic_corr_comparisons_plot(corr, log_dir, indicator = "dynamic_")
  605. dynamic_mixed_samples_pyplot(sample_data[:,:,0:500,...], log_dir) #video functionality. Runtime can be significantly reduced by commenting out this line
  606. return

callbacks.py at commit 40dbd6d, under MIT · at the source

Overview

Authors: Colin Bredenberg1,2, Fabrice Normandin1, Blake Richards1,3, Guillaume Lajoie1,2
  1. Mila - Quebec AI Institute, Montreal, Canada
  2. University of Montreal, Montreal, Canada
  3. McGill University, Montreal, Canada
Journal: eLife, volume 14, article RP105968
Dates: published online 21 April 2026
Type: Research article · Language: English
License: CC BY
Identifiers: DOI 10.7554/elife.105968 · PMID 42011872 · PMCID PMC13099140 · OpenAlex W4411087740
Open access: gold, a free copy (OpenAlex)
Status: code verified
Categories: human (organism)
Methods: Single-unit activity, calcium imaging, Machine learning
Keywords: None
MeSH: Hallucinations*, Hallucinogens*, Neuronal Plasticity*, Dreams, Humans, Models, Neurological, Neural Networks, Computer, Sleep (* major topic)
Topic: Psychedelics and Drug Studies (Clinical Psychology, Psychology), according to OpenAlex
Funding: Arthur B. McDonald Fellowship (566355-2022); Natural Sciences and Engineering Research Council of Canada (RGPIN-2020-05105, RGPAS-2020-00031, RGPIN-2018-04821)
Citations: cited by 1 paper (Europe PMC); 146 references in the paper

Abstract

Classical psychedelics induce complex visual hallucinations in humans, generating percepts that are coherent at a low level, but which have surreal, dream-like qualities at a high level. While there are many hypotheses as to how classical psychedelics could induce these effects, there are no concrete mechanistic models that capture the variety of observed effects in humans, while remaining consistent with the known pharmacological effects of classical psychedelics on neural circuits. In this work, we propose the ‘oneirogen hypothesis,’ which posits that the perceptual effects of classical psychedelics are a result of their pharmacological actions inducing neural activity states that truly are more similar to dream-like states. We simulate classical psychedelics’ effects via manipulating neural network models trained on perceptual tasks with the Wake-Sleep algorithm. This established machine learning algorithm leverages two activity phases: a perceptual phase (wake) where sensory inputs are encoded, and a generative phase (dream) where the network internally generates activity consistent with stimulus-evoked responses. We simulate the action of psychedelics by partially shifting the model to the ‘Sleep’ state, which entails a greater influence of top-down connections, in line with the impact of psychedelics on apical dendrites. The effects resulting from this manipulation capture a number of experimentally observed phenomena, including the emergence of hallucinations, increases in stimulus-conditioned variability, and large increases in synaptic plasticity. We further provide a number of testable predictions which could be used to validate or invalidate our oneirogen hypothesis.

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

Repositories

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

colinbredenberg/oneirogen-hypothesis

License: MIT
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 40dbd6de2ca131ebe291b47fd7ff7ff786a38f34, 11 September 2024
Languages: Python (54)
Size: 87 files, 54 scripts
Software Heritage: archived
Found in: “Data availability”
Holds: README, license file, environment (pyproject.toml, requirements.txt), tests
Not found: CITATION.cff, continuous integration, documentation
Tools: PyTorch (35 files), PyTorch Lightning (10 files), NumPy (5 files), NetworkX (4 files), Matplotlib (1 file), OpenCV (1 file), Pillow (1 file), scikit-learn (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
56 files

colinbredenberg/vdvae

License: MIT
State: the link answers, verified on 29 September 2026
Evidence: files inventoried
Commit: 919a2360c6df9cb429a13570a12deb5cdf647d9b, 6 October 2025
Languages: Python (8), Shell (4), Jupyter (1)
Size: 19 files, 13 scripts
Software Heritage: archived
Found in: “Data availability”
Holds: README, license file, environment (pyproject.toml, uv.lock), 1 notebook
Not found: CITATION.cff, tests, continuous integration, documentation
Tools: NumPy (8 files), PyTorch (7 files), imageio (2 files), Matplotlib (1 file), scikit-learn (1 file)
Availability: 1 check, the latest on 29 September 2026: the link answers
  • 29 September 2026: the link answers
15 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:

  • 2 repositories of the authors' code, each at its verified commit, with its license and how the link was found in the paper;
  • 67 scripts, each with its path and the digest of its content;
  • 8 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

Code for reproducing all results from Wake-Sleep-trained models in this study is available here: https://github.com/colinbredenberg/oneirogen-hypothesis, copy archived at Bredenberg, 2024. Code for reproducing results obtained with pretrained VDVAE models is available here: https://github.com/colinbredenberg/vdvae, copy archived at Bredenberg, 2025.

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

Recorded: type, language, journal, volume, pages, dates, 4 authors, 1 keyword, 8 MeSH terms, 2 funders, 118 references.

Cite

This paper

Bredenberg, C., Normandin, F., Richards, B., & Lajoie, G. (2026). Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms. eLife, 14, RP105968. https://doi.org/10.7554/elife.105968

BibTeX

@article{bredenberg2026modeling,
author = {Bredenberg, Colin and Normandin, Fabrice and Richards, Blake and Lajoie, Guillaume},
title = {{Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms}},
journal = {eLife},
year = {2026},
month = apr,
volume = {14},
pages = {RP105968},
publisher = {eLife Sciences Publications, Ltd},
issn = {2050-084X},
doi = {10.7554/elife.105968},
url = {https://doi.org/10.7554/elife.105968},
pmid = {42011872},
pmcid = {PMC13099140}
}

RIS

TY - JOUR
AU - Bredenberg, Colin
AU - Normandin, Fabrice
AU - Richards, Blake
AU - Lajoie, Guillaume
TI - Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms
T2 - eLife
J2 - eLife
PY - 2026
DA - 2026/04/21
VL - 14
SP - RP105968
SN - 2050-084X
PB - eLife Sciences Publications, Ltd
DO - 10.7554/elife.105968
UR - https://doi.org/10.7554/elife.105968
LA - en
ER -

CSL-JSON

{
"id": "10.7554/elife.105968",
"type": "article-journal",
"title": "Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms",
"container-title": "eLife",
"author": [
{
"family": "Bredenberg",
"given": "Colin"
},
{
"family": "Normandin",
"given": "Fabrice"
},
{
"family": "Richards",
"given": "Blake"
},
{
"family": "Lajoie",
"given": "Guillaume"
}
],
"container-title-short": "eLife",
"volume": "14",
"page": "RP105968",
"DOI": "10.7554/elife.105968",
"PMID": "42011872",
"PMCID": "PMC13099140",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://doi.org/10.7554/elife.105968",
"language": "en",
"issued": {
"date-parts": [
[
2026,
4,
21
]
]
}
}

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.7554/elife.105953 [code]
Top-down feedback in deep neural networks leads to functional differences during audiovisual integration.
Journal: eLife
In common: PyTorch Lightning, Pillow, PyTorch, 3 other tools, 5 references, author Blake Richards
[2] doi:10.1038/s41467-026-74460-8 [code]
Spike-based alignment learning solves the weight transport problem.
Journal: Nature communications
In common: PyTorch, scikit-learn, Matplotlib, 1 other tool, 8 references
[3] doi:10.1371/journal.pcbi.1014164 [code]
'Backpropagation and the brain' realized in cortical error neuron microcircuits.
Journal: PLoS computational biology
In common: PyTorch, Matplotlib, NumPy, 7 references
[4] doi:10.1038/s41467-026-74816-0 [code]
Hierarchical optimization predicts plasticity in the macaque inferior temporal cortex following object training.
Journal: Nature communications
In common: PyTorch, scikit-learn, Matplotlib, 1 other tool, 5 references
[5] doi:10.1038/s41467-026-75347-4 [code]
Sleep reveals dynamics integrating and segregating movement and stimulus representations in V1.
Journal: Nature communications
In common: imageio, Pillow, PyTorch, 3 other tools, 3 references
[6] doi:10.1038/s41593-026-02232-0 [code]
Entorhinal cortex represents task-relevant remote locations independently of CA1.
Journal: Nature neuroscience
In common: NetworkX, OpenCV, Pillow, 4 other tools, 2 references
[7] doi:10.1371/journal.pcbi.1014263 [code]
MIRAGE: Robust multi-modal architectures translate fMRI-to-image models from vision to mental imagery.
Journal: PLoS computational biology
In common: PyTorch Lightning, imageio, OpenCV, 5 other tools
[8] doi:10.1038/s41467-026-77318-1 [code]
Offline generative network reconfiguration guides insight-like accelerated learning by assimilation into schema in rats.
Journal: Nature communications
In common: scikit-learn, Matplotlib, 6 references
[9] doi:10.7554/elife.108023 [code]
Challenges in replay detection by TDLM in post-encoding resting state.
Journal: eLife
In common: scikit-learn, Matplotlib, NumPy, 5 references
[10] doi:10.1038/s42003-026-10957-8 [code]
Brain defence by the extracellular matrix protein Cochlin.
Journal: Communications biology
In common: PyTorch Lightning, NetworkX, OpenCV, 5 other tools

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.