Modeling the hallucinatory effects of classical psychedelics in terms of replay-dependent plasticity mechanisms.
6 blocks of code here have a permanent identifier (oscr:b:…), listed with the matches below: citable for good, with a page of its own. Select a match and press Cite to copy it. What a block identifier is.
The 8 matches
- [1] § Methods › Model architecture and training ↔ beyond_backprop/algorithms/common/layer.py, lines 281 to 315 · score 0.64 · dendritic branch, batch normalization, affine, nonlinearities, multicompartmental, bias · block
oscr:b:RCWRS8GQ5VW8S-E· Report a mismatch - [2] § Methods › Generating hallucinations in hierarchical variational autoencoders ↔ halluc.ipynb, lines 19 to 68 · score 0.63 · Tiny ImageNet, VDVAE models, trained models, VAEs · Report a mismatch
- [3] § Methods › Classifier training ↔ beyond_backprop/algorithms/image_classification.py, lines 19 to 147 · score 0.59 · cross entropy loss, classifier, phase, algorithm, trained, network · block
oscr:b:E84WC92BXD4P0-O· Report a mismatch - [4] § Results › Mapping the Wake-Sleep algorithm onto cortical architecture ↔ beyond_backprop/algorithms/wake_sleep/rm_wake_sleep.py, lines 37 to 54 · score 0.59 · Wake Sleep algorithm, Wake phase, Sleep phase, inference, architecture, layer · block
oscr:b:D27EVDY9NRM66-N· Report a mismatch - [5] § Methods › Classifier training ↔ beyond_backprop/algorithms/algorithm.py, lines 28 to 95 · score 0.56 · cross entropy loss, phase, class, algorithm, trained, network · block
oscr:b:0R9CE55BY9SN8-T· Report a mismatch - [6] § Methods › Model architecture and training ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 511 to 582 · score 0.55 · inference mode, network activity, Wake Sleep, plasticity, CIFAR10, MNIST · block
oscr:b:5R57J6QC11B27-X· Report a mismatch - [7] § Methods › Quantifying interareal causality through inactivations ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 511 to 582 · score 0.53 · prevent numerical instability, ratio, variances · block
oscr:b:5R57J6QC11B27-X· Report a mismatch - [8] § Results › Effects of psychedelics on single neurons ↔ beyond_backprop/algorithms/wake_sleep/callbacks.py, lines 126 to 192 · score 0.51 · apical plasticity, dose dependent, Wake Sleep, gated, psychedelic, basal · block
oscr:b:6JYPSQ8ZM4V7B-K· Report a mismatch
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
Python · 694 lines · 34 KB · MIT · 3 matches
- """
- Analysis code for processing trained networks
- These are callbacks, called by Pytorch Lightning functionality at various points in training
- Results are stored in the logs folder
- """
- from __future__ import annotations
- from logging import getLogger as get_logger
- from pathlib import Path
- import torch
- from lightning import Callback, Trainer
- from torch import Tensor
- import cv2
- from collections import defaultdict
- from beyond_backprop.algorithms.algorithm import Algorithm
- from beyond_backprop.datamodules.dataset_normalizations import cifar10_unnormalization
- import matplotlib.pyplot as plt
- import numpy as np
- from sklearn.decomposition import PCA
- from torch.distributions.multivariate_normal import MultivariateNormal
- logger = get_logger(__name__)
- basal_color = '#72a6ca'
- apical_color = '#e0474c'
- fontsize = 5
- def generated_image_plot(sample_data, log_dir):
- """
- Plotting function for the GenerativeSamples Callback
- """
- fig, axes = plt.subplots(2, 5, sharey = True, figsize = (7.5, 3))
- fig.suptitle('sample generated image', fontsize = fontsize)
- idx = 0
- shape = sample_data[idx,...].shape
- if shape[0] == 3 and shape[1] == 32:
- cifar10 = True
- else:
- cifar10 = False
- for ii in range(0,2):
- for jj in range(0,5):
- if cifar10:
- axes[ii,jj].imshow(cifar10_unnormalization(torch.tensor(sample_data[idx,...].permute(1,2,0))))
- else:
- axes[ii,jj].imshow(torch.tensor(sample_data[idx,...].permute(1,2,0)), cmap = 'gray', vmin = -1, vmax = 1)
- axes[ii,jj].tick_params(left=False,
- bottom=False,
- labelleft=False,
- labelbottom=False)
- idx = idx + 1
- plt.savefig(str(log_dir / "gen_images.pdf"), format = 'pdf')
- return
- class GenerativeSamples(Callback):
- def __init__(self) -> None:
- """
- Callback that plots generative samples from a trained InfGenNetwork after testing
- """
- super().__init__()
- def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
- pl_module.network.gen_forward()
- sample_data = pl_module.network.gen_ts[-1].gen_output.cpu()
- if trainer is not None:
- # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
- # except maybe during some unit tests where the DataModule is used by itself.)
- log_dir = Path(trainer.log_dir or log_dir)
- generated_image_plot(sample_data, log_dir)
- return
- class SimRecord(defaultdict):
- __getattr__= defaultdict.__getitem__
- __setattr__= defaultdict.__setitem__
- __delattr__= defaultdict.__delitem__
- def default_factory():
- return []
- def inf_gen_loss_plot(record, log_dir):
- """
- Plotting the network inference and generative losses
- """
- fig, axes = plt.subplots(1, 2, sharey = False, figsize = (3,1.5), layout='constrained')
- fig.suptitle('Loss curves', fontsize = fontsize)
- axes[0].plot(torch.tensor(record.inf_loss), color = basal_color)
- axes[0].set_yscale('symlog')
- axes[0].set_title('inf_loss', color = basal_color, fontsize = fontsize)
- axes[1].plot(torch.tensor(record.gen_loss), color = apical_color)
- axes[1].set_yscale('symlog')
- axes[1].set_title('gen_loss', color = apical_color, fontsize = fontsize)
- axes[0].spines.top.set_visible(False)
- axes[0].spines.right.set_visible(False)
- axes[1].spines.top.set_visible(False)
- axes[1].spines.right.set_visible(False)
- plt.savefig(str(log_dir / "loss.pdf"), format = 'pdf')
- return
- class InfGenLossRecord(Callback):
- def __init__(self) -> None:
- """
- Callback that records inference and generative losses for a network during training and generates plots
- """
- super().__init__()
- self.record = SimRecord(default_factory)
- def on_train_batch_end(
- self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int
- ) -> None:
- self.record.inf_loss.append(pl_module.pre_grad_inf.detach())
- self.record.gen_loss.append(pl_module.pre_grad_gen.detach())
- return
- def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
- if trainer is not None:
- # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
- # except maybe during some unit tests where the DataModule is used by itself.)
- log_dir = Path(trainer.log_dir or log_dir)
- inf_gen_loss_plot(self.record, log_dir)
- return
- def plasticity_quant_plot(total_apical_plasticity, total_apical_plasticity_sem, total_basal_plasticity, total_basal_plasticity_sem, apical_cossim, basal_cossim, log_dir):
- """Plotting function for analyzing psychedelic-induced increases in plasticity"""
- if len(total_apical_plasticity) == 11:
- mixing_constant = torch.arange(0,1.1,0.1)
- else:
- mixing_constant = torch.arange(0,1,0.2)
- fig, axes = plt.subplots(1,1, figsize = (3,3))
- axes.errorbar(mixing_constant, total_apical_plasticity, yerr = total_apical_plasticity_sem, color = apical_color, ecolor = apical_color)
- axes.errorbar(mixing_constant, (1-mixing_constant) * total_apical_plasticity, yerr = (1-mixing_constant) * total_apical_plasticity_sem, color = 'k', ecolor = 'k')
- axes.set_title('apical')
- plt.legend(['without gating', 'with gating'])
- axes.set_ylim([0, torch.max(total_apical_plasticity)])
- axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes.set_ylabel('total plasticity', fontsize = fontsize)
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- fig.suptitle('Dose dependence of apical plasticity', fontsize = fontsize)
- fig.savefig(str(log_dir / "Plasticity Quant Apical.pdf"), format = 'pdf')
- fig_2, axes_2 = plt.subplots(1,1, figsize = (3,3))
- axes_2.errorbar(mixing_constant, total_basal_plasticity, yerr = total_basal_plasticity_sem, color = basal_color, ecolor = basal_color)
- axes_2.errorbar(mixing_constant, mixing_constant * total_basal_plasticity, yerr = (mixing_constant) * total_basal_plasticity_sem, color = 'k', ecolor = 'k')
- axes_2.set_title('basal')
- plt.legend(['without gating', 'with gating'])
- axes_2.set_ylim([0, torch.max(total_basal_plasticity)])
- axes_2.set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes_2.set_ylabel('total plasticity', fontsize = fontsize)
- axes_2.spines.top.set_visible(False)
- axes_2.spines.right.set_visible(False)
- axes_2.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes_2.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- fig_2.suptitle('Dose dependence of basal plasticity', fontsize = fontsize)
- fig_2.savefig(str(log_dir / "Plasticity Quant Basal.pdf"), format = 'pdf')
- fig_3, axes_3 = plt.subplots(1,2, figsize = (3,1.5))
- axes_3[0].scatter(mixing_constant, apical_cossim, color = apical_color)
- axes_3[1].scatter(mixing_constant, basal_cossim, color = basal_color)
- axes_3[0].set_title('apical')
- axes_3[1].set_title('basal')
- axes_3[0].set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes_3[0].set_ylabel('cosine sim', fontsize = fontsize)
- axes_3[1].set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes_3[1].set_ylabel('cosine sim', fontsize = fontsize)
- axes_3[0].set_ylim([0,1])
- axes_3[1].set_ylim([0,1])
- axes_3[0].spines.top.set_visible(False)
- axes_3[0].spines.right.set_visible(False)
- axes_3[1].spines.top.set_visible(False)
- axes_3[1].spines.right.set_visible(False)
- axes_3[0].tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes_3[0].tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- axes_3[1].tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes_3[1].tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- fig_3.suptitle('Dose dependence of plasticity cosine sim', fontsize = fontsize)
- fig_3.savefig(str(log_dir / "Plasticity Quant Cosine Sim.pdf"), format = 'pdf')
- return
- def apical_basal_alignment_plot(record, log_dir):
- """Plotting function for analyzing alignment between the apical and basal dendrites"""
- plt.figure()
- fig, axes = plt.subplots(1, 5, figsize = (7.5,1.5))
- basal = torch.vstack(record.basal).cpu()
- apical = torch.vstack(record.apical).cpu()
- fig.suptitle('Apical Basal Alignment', fontsize = fontsize)
- for idx in range(0,4):
- axes[idx].scatter(basal[:, idx], apical[:, idx])
- axes[idx].plot([-1, 1], [-1,1])
- basal_standardized = (basal - torch.mean(basal, axis = 0, keepdim = True))/torch.std(basal, axis = 0, keepdim = True)
- apical_standardized = (apical - torch.mean(apical, axis = 0, keepdim = True))/torch.std(apical, axis = 0, keepdim = True)
- corr = basal_standardized.T @ apical_standardized/ basal_standardized.shape[0]
- diag = torch.diag(corr)
- N = len(diag)
- off_diag = corr.flatten()[1:].view(N-1, N+1)[:,:-1].flatten()
- K = 1
- axes[4].imshow(corr[0:K, 0:K], vmin = -1, vmax = 1)
- axes[4].set_title('apical and basal correlations', fontsize = fontsize)
- axes[4].set_ylabel('basal neuron #', fontsize = fontsize)
- axes[4].set_xlabel('apical neuron #', fontsize = fontsize)
- fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
- axes.boxplot([off_diag, diag], tick_labels = ['rand.', 'same'], showfliers = False)
- axes.set_yticks([-0.5, 0, 0.5, 1])
- axes.set_ylim([-0.5, 1.2])
- axes.set_yticklabels([-0.5, 0, 0.5, 1], fontsize = fontsize)
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.set_ylabel('correlation', fontsize = fontsize)
- plt.tight_layout()
- plt.savefig(str(log_dir / "Apical Basal Alignment.pdf"), format = 'pdf')
- return
- class ApicalBasalAlignment(Callback):
- "Callback for quantifying the degree of apical-basal alignment for a given network"
- def __init__(self) -> None:
- """
- Callback that records network activation variables for a network during training
- """
- super().__init__()
- self.record = SimRecord(default_factory)
- def on_test_batch_end(
- self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int, dataloader_idx = 0
- ) -> None:
- pl_module.network.forward(pl_module.x)
- self.record.basal.append(pl_module.network.ts[2].output)
- pl_module.network.gen_log_prob()
- self.record.apical.append(pl_module.network.ts[2].predicted_activity_gen[0])
- return
- def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
- if trainer is not None:
- # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
- # except maybe during some unit tests where the DataModule is used by itself.)
- log_dir = Path(trainer.log_dir or log_dir)
- apical_basal_alignment_plot(self.record, log_dir)
- return
- def fig2rgb_array(fig):
- fig.canvas.draw()
- buf = fig.canvas.tostring_rgb()
- ncols, nrows = fig.canvas.get_width_height()
- return np.fromstring(buf, dtype=np.uint8).reshape(nrows, ncols, 3)
- def figure_to_array(fig):
- fig.canvas.draw()
- fig_array = fig2rgb_array(fig)
- fig_array = fig_array[:,:,[2,1,0]]
- return fig_array
- def dynamic_mixed_samples_pyplot(sample_data, log_dir):
- """Function for storing a hallucination sequence as a video"""
- sample_data[torch.where(sample_data < 0)] = 0
- sample_data[torch.where(sample_data > 1)] = 1
- file_handle = 'Dynamic mixed samples image.mp4'
- filename = str(log_dir / file_handle)
- frame_size = (1000, 1000)
- output = cv2.VideoWriter(filename, cv2.VideoWriter_fourcc(*'mp4v'), 60, frame_size)
- T = sample_data.shape[2]
- fig, axes = plt.subplots(6, 6, sharey = True, sharex = True, figsize = (10, 10))
- for tt in range(0,T):
- for ii in range(0,6):
- for jj in range(0,6):
- idx_j = jj * 2
- axes[ii,jj].imshow(sample_data[ii,idx_j,tt,...], cmap = 'gray', vmin = -1, vmax = 1)
- axes[ii,jj].tick_params(left=False,
- bottom=False,
- labelleft=False,
- labelbottom=False)
- if ii == 0:
- axes[ii,jj].set_title(r'$\alpha : %1.2f$' %(idx_j*0.2), fontsize = fontsize)
- fig_array = figure_to_array(fig)
- output.write(fig_array)
- output.release()
- cv2.destroyAllWindows()
- def classifier_output_quant(mixed_samples, reference_data, y, network):
- """Utility function for quantifying the classifier output accuracy and variability for hallucination data"""
- if torch.cuda.is_available():
- mixed_samples = mixed_samples.to(torch.cuda.current_device())
- reference_data = reference_data.to(torch.cuda.current_device())
- y = y.to(torch.cuda.current_device())
- classifier_logits = network.classifier(mixed_samples)
- reference_logits = network.classifier(reference_data)
- class_predictions = torch.argmax(classifier_logits, dim = -1)
- accuracy = torch.sum(class_predictions[:,-1] == y)/len(y)
- variability = torch.mean(torch.var(classifier_logits, axis = 1))
- classifier_corr = torch.corrcoef(classifier_logits.flatten(end_dim = 1).permute(1,0))
- reference_corr = torch.corrcoef(reference_logits.flatten(end_dim = 1).permute(1,0))
- dist = 1 - torch.corrcoef(torch.stack([classifier_corr.flatten(), reference_corr.flatten()]))[0,1]
- return accuracy, variability, dist
- def classifier_output_plot(classifier_accuracy, classifier_variability, log_dir):
- """Plotting function for the classifier accuracy"""
- mixing_constant = torch.arange(0,1.1,0.1)
- fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
- axes.scatter(mixing_constant, classifier_accuracy, color = apical_color)
- plt.title('Classifier Accuracy')
- axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes.set_ylabel('Proportion correct', fontsize = fontsize)
- axes.set_ylim([0,1])
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- fig.savefig(str(log_dir / "classifier accuracy.pdf"), format = 'pdf')
- fig, axes = plt.subplots(1,1, figsize = (1.5,1.5))
- axes.scatter(mixing_constant, classifier_variability, color = apical_color)
- plt.title('Classifier Output Variability')
- axes.set_xlabel(r'$\alpha$', fontsize = fontsize)
- axes.set_ylabel('Variability', fontsize = fontsize)
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- fig.savefig(str(log_dir / "classifier variability.pdf"), format = 'pdf')
- def dynamic_stim_cond_var(mixed_outputs, reference):
- """Utility function for computing the change in stimulus-conditioned variability averaged over a batch of stimuli, for hallucinated network activity"""
- var = torch.var(mixed_outputs, dim = 0)
- ref_var = torch.var(reference, dim = 0)
- delta_var = torch.mean(var - ref_var)
- sem_var = torch.std(var - ref_var)/np.sqrt(var.shape[0])
- return delta_var, sem_var
- def dynamic_across_stim_var(mixed_outputs, inact_mixed_outputs):
- """Utility function for computing the change in across-stimulus variability for hallucinated network activity"""
- var_ratio_eps = 1e-3
- var = torch.var(mixed_outputs[[-1],...], dim = (0,1))
- inact_var = torch.var(inact_mixed_outputs[[-1],...], dim = (0,1))
- mean_var_ratio = torch.mean((inact_var + var_ratio_eps)/(var + var_ratio_eps))
- sem_var_ratio = torch.std((inact_var + var_ratio_eps)/(var + var_ratio_eps))/np.sqrt(var.shape[0])
- return mean_var_ratio, sem_var_ratio
- def dynamic_stim_cond_var_plot(mean_stimulus_conditioned_variance, sem_stimulus_conditioned_variance, log_dir, indicator = ""):
- """Plotting function for quantifying stimulus-conditioned variability"""
- #generate plots
- fig, axes = plt.subplots(1,1,figsize = (1.5,1.5))
- plt.bar(torch.arange(0,12), mean_stimulus_conditioned_variance, yerr = sem_stimulus_conditioned_variance)
- 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)
- plt.title("Dose Dependence of Stimulus-Conditioned Variance", fontsize = fontsize)
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- path = "Delta Dynamic Stimulus Conditioned Variance" + indicator + ".pdf"
- plt.savefig(str(log_dir / path), format = 'pdf')
- return
- def dynamic_across_stim_var_plot(mean_var_ratio, std_var_ratio, log_dir, indicator = ""):
- """Plotting function for quantifying across-stimulus variability"""
- fig, axes = plt.subplots(1,1,figsize = (1.5,1.5))
- plt.errorbar(torch.arange(0,11), mean_var_ratio, yerr = std_var_ratio)
- plt.plot(torch.arange(0,11), torch.ones(11), 'k')
- 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)
- plt.title("Dose Dependence of Across-Stim Variance", fontsize = fontsize)
- axes.spines.top.set_visible(False)
- axes.spines.right.set_visible(False)
- axes.tick_params(axis = 'both', which = 'major', labelsize=fontsize)
- axes.tick_params(axis = 'both', which = 'minor', labelsize = fontsize)
- plt.tight_layout()
- path = "Delta Variance" + indicator + ".pdf"
- plt.savefig(str(log_dir / path), format = 'pdf')
- return
- def dynamic_image_plot(sample_data, log_dir, indicator = ""):
- """Plotting function for stimulus-layer hallucination snapshots"""
- fig, axes = plt.subplots(6, 11, sharey = True, figsize = (7.5, 3))
- fig.suptitle('sample generated image', fontsize = fontsize)
- idx = 0
- shape = sample_data[idx,...].shape
- if shape[0] == 3 and shape[1] == 32:
- cifar10 = True
- else:
- cifar10 = False
- for ii in range(0,6):
- for jj in range(0,11):
- if cifar10:
- axes[ii,jj].imshow(cifar10_unnormalization(torch.tensor(sample_data[ii,jj,...].permute(1,2,0))))
- else:
- axes[ii,jj].imshow(torch.tensor(sample_data[ii,jj,...].permute(1,2,0)), cmap = 'gray', vmin = -1, vmax = 1)
- axes[ii,jj].tick_params(left=False,
- bottom=False,
- labelleft=False,
- labelbottom=False)
- idx = idx + 1
- path = indicator + "_dynamic_images.pdf"
- plt.savefig(str(log_dir / path), format = 'pdf')
- return
- def dynamic_corr_calc(activity):
- """Utility function for computing within-layer correlations"""
- flat_activity = activity
- return torch.corrcoef(flat_activity.T)
- def dynamic_corr_comparisons_plot(corr_list, log_dir, indicator = ""):
- """Plotting function for comparing correlation matrices across different hallucination levels"""
- mixing_constant = np.arange(0,1,0.2)
- fig, axes = plt.subplots(1, 11, sharey = True, sharex = True, figsize = (15,1.5))
- fig_2, axes_2 = plt.subplots(1, 11, sharey = True, sharex = True, figsize = (15,1.5))
- fig_3, axes_3 = plt.subplots(1,1, figsize = (1.5,1.5))
- fig.suptitle('Across stimulus correlation matrices', fontsize = fontsize)
- K = 20
- mixing_constant = np.arange(0,1.1,0.1)
- corr_vec = torch.zeros(len(mixing_constant))
- for jj in range(0,len(mixing_constant)):
- corr_full = corr_list[jj,...]
- corr = corr_full[0:K,0:K]
- if jj == 0:
- corr_0 = corr
- corr_0_full = corr_full
- im = axes[jj].imshow(corr - torch.eye(*corr.shape), vmin = -1, vmax = 1)
- fig.colorbar(im, ax = axes[jj])
- axes[jj].set_title(r'$\alpha : %1.2f$' %(jj*0.1), fontsize = fontsize)
- axes[jj].tick_params(left=False,
- bottom=False,
- labelleft=False,
- labelbottom=False)
- axes_2[jj].scatter(corr_0.flatten(), corr.flatten())
- axes_2[jj].set_xlabel(r'$\alpha = 0$ correlation', fontsize = fontsize)
- axes_2[jj].set_ylabel(r'$\alpha = %1.2f$ correlation' %(jj*0.1), fontsize = fontsize)
- corr_vec[jj] = torch.corrcoef(torch.stack([corr_0_full.flatten(), corr_full.flatten()]))[0,1]
- axes_3.scatter(mixing_constant[jj], corr_vec[jj])
- path_1 = indicator + "Correlation matrices.pdf"
- path_2 = indicator + "Correlation matrix scatterplots.pdf"
- fig.savefig(str(log_dir / path_1), format = 'pdf')
- fig_2.savefig(str(log_dir / path_2), format = 'pdf')
- axes_3.set_ylabel('corr sim')
- axes_3.set_title('Dose Dependence of Correlation similarity')
- axes_3.set_ylim([0,1])
- 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)
- plt.tight_layout()
- path_3 = indicator + "Correlation similarity metric.pdf"
- fig_3.savefig(str(log_dir / path_3), format = 'pdf')
- return
- def cosine_similarity(vec_1, vec_2):
- """Utility function for computing cosine similarity"""
- norm_1 = vec_1.flatten()
- norm_1 = norm_1/torch.linalg.norm(norm_1)
- norm_2 = vec_2.flatten()
- norm_2 = norm_2/torch.linalg.norm(norm_2)
- return torch.dot(norm_1, norm_2)
- def explained_var_calc(data, n_components):
- """Utility function for computing the proportion explained variance of different principal components"""
- pca = PCA(n_components=n_components)
- pca.fit(data.flatten(start_dim = 1))
- return pca.explained_variance_ratio_
- def explained_var_plot(explained_var, log_dir):
- """Plotting function for the proportion explained variance for different principal components across different hallucination levels"""
- fig, ax = plt.subplots(1,1, figsize = (3, 3))
- ax.plot(explained_var[0,:])
- ax.plot(explained_var[5,:])
- ax.plot(explained_var[-1,:])
- ax.set_xlabel('PC #')
- ax.set_ylabel('Proportion explained variance')
- plt.legend((r'$\alpha = 0$', r'$\alpha = 0.5$', r'$\alpha = 1$'))
- plt.tight_layout()
- fig.savefig(str(log_dir / "explained variance ratio analysis.pdf"), format = 'pdf')
- class DynamicMixedSampler(Callback):
- def __init__(self) -> None:
- """
- The primary callback for generating and analyzing hallucinatory activity in trained networks
- """
- super().__init__()
- self.record = SimRecord(default_factory)
- def on_test_batch_end(
- self, trainer: Trainer, pl_module: Algorithm, outputs, batch: tuple[Tensor, Tensor], batch_idx: int, dataloader_idx = 0
- ) -> None:
- self.record.x.append(pl_module.x)
- self.record.y.append(pl_module.y)
- return
- def on_test_end(self, trainer: Trainer, pl_module: Algorithm) -> None:
- """Run on a fully trained network at the end of training"""
- with torch.inference_mode(False),torch.set_grad_enabled(True):
- if trainer is not None:
- # Use the Trainer's log dir if we have a trainer. (NOTE: we should always have one,
- # except maybe during some unit tests where the DataModule is used by itself.)
- log_dir = Path(trainer.log_dir or log_dir)
- mixing_constant = np.arange(0,1.1,0.1)
- T = 800 #number of simulation timesteps
- plasticity_eps = 1e-2 #constant to prevent numerical instability in plasticity calculations
- sample_data = torch.zeros(6,11,T, *pl_module.x[0,...].permute(1,2,0).shape)
- #Initialize all storage variables
- x = pl_module.x
- y = pl_module.y
- timescale = 0.1
- shape = x[0,...].shape
- sample_data_im_analysis = torch.zeros(x.shape[0],11, *pl_module.x[0,...].permute(1,2,0).shape)
- sample_data_closed_eyes = torch.zeros(6,11,*pl_module.x[0,...].permute(1,2,0).shape)
- if shape[0] == 3 and shape[1] == 32:
- cifar10 = True
- inaturalist = False
- mnist = False
- elif shape[0] == 3 and shape[1] == 224:
- inaturalist = True
- cifar10 = False
- mnist = False
- else:
- mnist = True
- cifar10 = False
- inaturalist = False
- classifier_accuracy = torch.zeros(11)
- classifier_variability = torch.zeros(11)
- classifier_dist = torch.zeros(13)
- corr_N = np.prod(pl_module.network.ts[1].output.shape[1::])
- corr = torch.zeros(11,corr_N, corr_N)
- pc_num = 20
- explained_var = torch.zeros(11, pc_num)
- mean_stimulus_conditioned_variance = torch.zeros(12)
- std_stimulus_conditioned_variance = torch.zeros(12)
- mean_var_ratio = torch.zeros(11)
- sem_var_ratio = torch.zeros(11)
- mean_var_ratio_apical = torch.zeros(11)
- sem_var_ratio_apical = torch.zeros(11)
- total_apical_plasticity = torch.zeros(11)
- total_apical_plasticity_sem = torch.zeros(11)
- apical_cosine_sim = torch.zeros(11)
- total_basal_plasticity = torch.zeros(11)
- total_basal_plasticity_sem = torch.zeros(11)
- basal_cosine_sim = torch.zeros(11)
- gen_opt, inf_opt, _ = pl_module.optimizers()
- if mnist:
- multiplier = -1.
- else:
- multiplier = 0.
- if torch.cuda.is_available():
- x_closed_eyes = multiplier*torch.ones(pl_module.x.shape, device = torch.cuda.current_device())
- else:
- x_closed_eyes = multiplier*torch.ones(pl_module.x.shape)
- for jj in range(0,11): # loop through hallucination magnitudes
- data = x
- #Store network activity for layers 0 and 1 while under hallucinatory dynamics
- 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)
- #Generate plasticity based on hallucinatory network activity
- gen_opt.zero_grad()
- total_likelihood_gen_rm = - pl_module.network.gen_log_prob(mixed_output = True)
- pre_grad_gen = torch.mean(total_likelihood_gen_rm)
- pre_grad_gen.backward()
- gen_grad_list = []
- gen_grad_var_list = []
- gen_grad_dim_list = []
- gen_cosine_sim = []
- if jj == 0:
- baseline_grad_list_gen = []
- ctr = 0
- #Quantify plasticity based on hallucinatory network activity
- for param in pl_module.network.gen_group.parameters():
- if not(param.grad is None):
- if jj == 0:
- baseline_grad_list_gen.append(param.grad)
- gen_grad_list.append(torch.mean(pl_module.hp.backward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
- gen_grad_dim_list.append(torch.prod(torch.tensor(param.grad.shape)))
- gen_grad_var_list.append(torch.var(pl_module.hp.backward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
- gen_cosine_sim.append(cosine_similarity(param.grad, baseline_grad_list_gen[ctr]))
- ctr += 1
- total_apical_plasticity[jj] = torch.mean(torch.tensor(gen_grad_list))
- total_gen_param_num = torch.sum(torch.tensor(gen_grad_dim_list))
- #have to reweight the variances by the number of parameters in each tensor
- 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)
- apical_cosine_sim[jj] = torch.mean(torch.tensor(gen_cosine_sim))
- inf_opt.zero_grad()
- total_likelihood_inf = -pl_module.network.log_prob(mixed_output = True)
- pre_grad_inf = torch.mean(total_likelihood_inf)
- pre_grad_inf.backward()
- inf_grad_list = []
- inf_grad_dim_list = []
- inf_grad_var_list = []
- inf_cosine_sim = []
- if jj == 0:
- baseline_grad_list_inf = []
- ctr = 0
- for param in pl_module.network.inf_group.parameters():
- if not(param.grad is None):
- if jj == 0:
- baseline_grad_list_inf.append(param.grad)
- inf_grad_list.append(torch.mean(pl_module.hp.forward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
- inf_grad_dim_list.append(torch.prod(torch.tensor(param.grad.shape)))
- inf_grad_var_list.append(torch.var(pl_module.hp.forward_optimizer.lr * torch.abs(param.grad) / (torch.abs(param.data) + plasticity_eps)))
- inf_cosine_sim.append(cosine_similarity(param.grad, baseline_grad_list_inf[ctr]))
- ctr +=1
- total_basal_plasticity[jj] = torch.mean(torch.tensor(inf_grad_list))
- total_inf_param_num = torch.sum(torch.tensor(inf_grad_dim_list))
- #have to reweight the variances by the number of parameters in each tensor
- 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)
- basal_cosine_sim[jj] = torch.mean(torch.tensor(inf_cosine_sim))
- im_data = data[0].cpu().permute(1,0,3,4,2)
- lesion_idx = 0
- #generate inactivation data (inactivate highest network layer)
- 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)
- #generate apical inactivation data (cut off apical inputs to the stimulus layer)
- apical_lesion_idx = len(pl_module.network.gen_ts) - 1
- 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)
- im_data_inactivation = data_inactivation[0].cpu().permute(1,0,3,4,2)
- im_data_apical_inactivation = data_apical_inactivation[0].cpu().permute(1,0,3,4,2)
- data_closed_eyes = pl_module.network.dynamic_mixed_forward(x_closed_eyes, T, mixing_constant = 1-mixing_constant[jj], timescale = timescale, idxs = [0])
- im_data_closed_eyes = data_closed_eyes[0].cpu().permute(1,0,3,4,2)
- if jj == 0:
- class_data_ref = data[1].cpu().permute(1,0,2)
- class_data = data[1].cpu().permute(1,0,2)
- corr[jj,...] = dynamic_corr_calc(class_data[:,-1,...])
- explained_var[jj,:] = torch.from_numpy(explained_var_calc(class_data[:,-1,...], pc_num))
- sample_data[:,jj,...] = im_data[0:6,...] #
- sample_data_closed_eyes[:,jj,...] = im_data_closed_eyes[0:6,-1,...]
- sample_data_im_analysis[:,jj,...] = im_data[:,-1,...]
- if cifar10:
- sample_data[:,jj,...] = cifar10_unnormalization(sample_data[:,jj,...])
- elif inaturalist:
- sample_data = sample_data
- if jj == 0:
- reference_data = im_data.permute(1,0,2,3,4)
- if jj == 0:
- 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)
- mean_stimulus_conditioned_variance[jj], std_stimulus_conditioned_variance[jj] = dynamic_stim_cond_var(im_data.permute(1,0,2,3,4), reference_data)
- 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))
- 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))
- classifier_accuracy[jj], classifier_variability[jj], classifier_dist[jj] = classifier_output_quant(class_data, class_data_ref, y, pl_module.network)
- if mnist:
- sample_data = (sample_data + 1)/2 #now mnist data lies between 0 and 1
- sample_data = sample_data.repeat(1,1,1,1,1,3) #convert [28,28,1] shape to [28,28,3] shape
- #generate plots based on analyzed data
- dynamic_stim_cond_var_plot(mean_stimulus_conditioned_variance, std_stimulus_conditioned_variance, log_dir)
- 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)
- explained_var_plot(explained_var, log_dir)
- dynamic_across_stim_var_plot(mean_var_ratio, sem_var_ratio, log_dir, indicator = "")
- dynamic_across_stim_var_plot(mean_var_ratio_apical, sem_var_ratio_apical, log_dir, indicator = " apical inact")
- classifier_output_plot(classifier_accuracy, classifier_variability, log_dir)
- dynamic_image_plot(sample_data[:,:,-1,...].permute(0,1,4,2,3), log_dir, indicator = "mixed")
- dynamic_image_plot(sample_data_closed_eyes.permute(0,1,4,2,3), log_dir, indicator = "closed_eyes")
- dynamic_corr_comparisons_plot(corr, log_dir, indicator = "dynamic_")
- dynamic_mixed_samples_pyplot(sample_data[:,:,0:500,...], log_dir) #video functionality. Runtime can be significantly reduced by commenting out this line
- return
callbacks.py at commit 40dbd6d, under MIT · at the source
Overview
- Mila - Quebec AI Institute, Montreal, Canada
- University of Montreal, Montreal, Canada
- McGill University, Montreal, Canada
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
40dbd6de2ca131ebe291b47fd7ff7ff786a38f34, 11 September 2024Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
56 files
- beyond_backprop/
__init__.py , Python, 1 line - beyond_backprop/
algorithms/ , Python, 32 lines__init__.py - beyond_backprop/
algorithms/ , Python, 95 lines, 1 matchalgorithm.py - beyond_backprop/
algorithms/ , Python, 339 linesalgorithm_test.py - beyond_backprop/
algorithms/ , Python, 126 linesbackprop.py - beyond_backprop/
algorithms/ , Python, 10 linesbackprop_test.py - beyond_backprop/
algorithms/ , Python, 1 linecommon/ __init__.py - beyond_backprop/
algorithms/ , Python, 32 linescommon/ graph_utils.py - beyond_backprop/
algorithms/ , Python, 361 lines, 1 matchcommon/ layer.py - beyond_backprop/
algorithms/ , Python, 147 lines, 1 matchimage_classification.py - beyond_backprop/
algorithms/ , Python, 93 linesimage_classification_tes t.py - beyond_backprop/
algorithms/ , Python, 1 linewake_sleep/ __init__.py - beyond_backprop/
algorithms/ , Python, 694 lines, 3 matcheswake_sleep/ callbacks.py - beyond_backprop/
algorithms/ , Python, 216 lineswake_sleep/ inf_gen_network.py - beyond_backprop/
algorithms/ , Python, 198 lines, 1 matchwake_sleep/ rm_wake_sleep.py - beyond_backprop/
algorithms/ , Python, 287 lineswake_sleep/ wake_sleep_layered_model s.py - beyond_backprop/
configs/ , Python, 1 line__init__.py - beyond_backprop/
configs/ , Python, 51 linesconfig.py - beyond_backprop/
configs/ , Python, 144 linesdatamodule/ __init__.py - beyond_backprop/
configs/ , Python, 37 lineslr_scheduler/ __init__.py - beyond_backprop/
configs/ , Python, 54 linesoptimizer/ __init__.py - beyond_backprop/
datamodules/ , Python, 6 lines__init__.py - beyond_backprop/
datamodules/ , Python, 129 linescifar10_datamodule.py - beyond_backprop/
datamodules/ , Python, 33 linesdatamodule.py - beyond_backprop/
datamodules/ , Python, 42 linesdataset_normalizations.p y - beyond_backprop/
datamodules/ , Python, 95 linesfashion_mnist_datamodule .py - beyond_backprop/
datamodules/ , Python, 54 linesimage_classification.py - beyond_backprop/
datamodules/ , Python, 352 linesimagenet32.py - beyond_backprop/
datamodules/ , Python, 42 linesimagenet32_test.py - beyond_backprop/
datamodules/ , Python, 172 linesinaturalist.py - beyond_backprop/
datamodules/ , Python, 73 linesinaturalist_test.py - beyond_backprop/
datamodules/ , Python, 96 linesmnist_datamodule.py - beyond_backprop/
datamodules/ , Python, 239 linesvision_datamodule.py - beyond_backprop/
experiment.py , Python, 139 lines - beyond_backprop/
networks/ , Python, 27 lines__init__.py - beyond_backprop/
networks/ , Python, 114 linesconv_architecture.py - beyond_backprop/
networks/ , Python, 53 linesconv_architecture_test.p y - beyond_backprop/
networks/ , Python, 164 linesfcnet.py - beyond_backprop/
networks/ , Python, 105 linesinvertible.py - beyond_backprop/
networks/ , Python, 136 lineslayers.py - beyond_backprop/
networks/ , Python, 88 lineslenet.py - beyond_backprop/
networks/ , Python, 10 lineslenet_test.py - beyond_backprop/
networks/ , Python, 48 linesnetwork.py - beyond_backprop/
networks/ , Python, 88 linesnetwork_test.py - beyond_backprop/
networks/ , Python, 186 linesresnet.py - beyond_backprop/
networks/ , Python, 31 linesresnet_test.py - beyond_backprop/
networks/ , Python, 89 linessimple_vgg.py - beyond_backprop/
networks/ , Python, 10 linessimple_vgg_test.py - beyond_backprop/
utils/ , Python, 1 line__init__.py - beyond_backprop/
utils/ , Python, 102 lineshydra_utils.py - beyond_backprop/
utils/ , Python, 48 linestypes.py - beyond_backprop/
utils/ , Python, 172 linesutils.py - main.py, Python, 135 lines
- main_test.py, Python, 137 lines
- LICENSE, License, 21 lines
- README.md, Text, 85 lines
colinbredenberg/vdvae
919a2360c6df9cb429a13570a12deb5cdf647d9b, 6 October 2025Availability: 1 check, the latest on 29 September 2026: the link answers
- 29 September 2026: the link answers
15 files
- halluc.ipynb, Jupyter, 345 lines, 1 match
- halluc_vae.py, Python, 102 lines
- pretrain/
data.py , Python, 214 lines - pretrain/
files_to_npy.py , Python, 14 lines - pretrain/
hps.py , Python, 159 lines - pretrain/
setup_cifar10.sh , Shell, 2 lines - pretrain/
setup_ffhq1024.sh , Shell, 13 lines - pretrain/
setup_ffhq256.sh , Shell, 12 lines - pretrain/
setup_imagenet.sh , Shell, 28 lines - pretrain/
train_helpers.py , Python, 274 lines - pretrain/
utils.py , Python, 148 lines - pretrain/
vae.py , Python, 252 lines - pretrain/
vae_helpers.py , Python, 165 lines - LICENSE.md, License, 7 lines
- README.md, Text, 38 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:
- 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://
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://
BibTeX
@article{bredenberg2026m
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/
url = {https://
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/
VL - 14
SP - RP105968
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 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":
"volume": "14",
"page": "RP105968",
"DOI": "10.7554/
"PMID": "42011872",
"PMCID": "PMC13099140",
"ISSN": "2050-084X",
"publisher": "eLife Sciences Publications, Ltd",
"URL": "https://
"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.76384 [code]
- Learning cortical representations through perturbed and adversarial dreaming.Journal: eLifeIn common: PyTorch, scikit-learn, Matplotlib, 1 other tool, 12 references
- [2] doi:10.7554/elife.105953 [code]
- Top-down feedback in deep neural networks leads to functional differences during audiovisual integration.Journal: eLifeIn common: PyTorch Lightning, Pillow, PyTorch, 3 other tools, 5 references, author Blake Richards
- [3] doi:10.1038/s41597-023-02214-y [code]
- Responses of pyramidal cell somata and apical dendrites in mouse visual cortex over multiple days.Journal: Scientific dataIn common: imageio, NetworkX, OpenCV, 5 other tools, 3 references, author Blake Richards
- [4] doi:10.1523/jneurosci.1009-23.2023 [code]
- Responses to Pattern-Violating Visual Stimuli Evolve Differently Over Days in Somata and Distal Apical Dendrites.Journal: The Journal of neuroscience : the official journal of the Society for NeuroscienceIn common: NetworkX, OpenCV, Pillow, 4 other tools, 4 references, author Blake Richards
- [5] doi:10.1038/s41467-026-74460-8 [code]
- Spike-based alignment learning solves the weight transport problem.Journal: Nature communicationsIn common: PyTorch, scikit-learn, Matplotlib, 1 other tool, 8 references
- [6] doi:10.1038/s41467-025-56297-9 [code]
- Dendrites endow artificial neural networks with accurate, robust and parameter-efficient learning.Journal: Nature communicationsIn common: PyTorch, scikit-learn, Matplotlib, 1 other tool, 7 references
- [7] doi:10.1038/s41467-023-40651-w [code]
- Sequence anticipation and spike-timing-dependent plasticity emerge from a predictive learning rule.Journal: Nature communicationsIn common: PyTorch, Matplotlib, NumPy, 8 references
- [8] doi:10.1038/s41467-024-44900-4 [code]
- Connectome-based reservoir computing with the conn2res toolbox.Journal: Nature communicationsIn common: imageio, NetworkX, OpenCV, 4 other tools, author Guillaume Lajoie
- [9] doi:10.1371/journal.pcbi.1010233 [code]
- Sequence learning, prediction, and replay in networks of spiking neurons.Journal: PLoS computational biologyIn common: Pillow, PyTorch, scikit-learn, 2 other tools, 6 references
- [10] doi:10.1038/s41593-023-01460-y [code]
- The combination of Hebbian and predictive plasticity learns invariant object representations in deep sensory networks.Journal: Nature neuroscienceIn common: PyTorch Lightning, OpenCV, PyTorch, 3 other tools, 5 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: 2 repositories of the authors' code, each at its verified commit and with its license, 67 scripts, and 8 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:2dfb8e5b935e625a…
Add the badge to the code's README
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 -->
[](https://openscicode.org/badge/doi/10.7554/elife.105968)
<!-- oscr-badge:end -->reStructuredText
.. oscr-badge:start
.. image:: https://openscicode.org/badge/doi/10.7554/elife.105968.svg
:target: https://openscicode.org/badge/doi/10.7554/elife.105968
:alt: OSCR
.. oscr-badge:endHTML
<!-- oscr-badge:start -->
<a href="https://openscicode.org/badge/doi/10.7554/elife.105968"><img src="https://openscicode.org/badge/doi/10.7554/elife.105968.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.
