A Network of Biologically Inspired Rectified Spectral Units (ReSUs) Learns Hierarchical Features Without Error Backpropagation
This repository contains the code to implement simulations in "A Network of Biologically Inspired Rectified Spectral Units (ReSUs) Learns Hierarchical Features Without Error Backpropagation".
To install requirements, run the following command:
conda create -n resu python=3.12
conda activate resu
pip install -r requirements.txtThe natural scene dataset is from Meyer et al 2014. The preprocessing of the raw images is decribed in https://elifesciences.org/articles/47579. To replicate the results in this paper
-
Download the MATLAB code from https://github.com/ClarkLabCode/SynapticModel. Before running the code, the
rootDataPathandsceneSourcePathdirectories must be set in theSetConfigurationfunction, or provided as arguments to that function. Then run the commandconfig = SetConfiguration(rootDataPath, sceneSourcePath)to set the paths. Next, runparams = SetModelParametersto get the parameters for the model. -
Download the Meyer 2014 dataset, which is a set of
.rararchives, each containing a set of.matfiles. Extract the .mat files from the archives and copy the resulting.matfiles into a folder namedimageDatawithin thesceneSourcePathroot directory. -
To convert the images into contrast profiles. First run
ConvertNaturalScenesToContrast(config,params)function insideutlildirectory. This will save the constrast as a.matfile within the root directory. Rename this.matfile ascontrast_scene.matand copy it to thedatafolder in this repository.
-
OU process: to simulate an examplar OU process, run the notebok
OU_process.ipynb. The output will be saved in theresultsfolder. Which is used to plot Figure 2B. -
Gaussian processes: to simulate Gaussian processes with different kernels, run the notebok
Gaussian_processes.ipynb. The output will be saved in theresultsfolder. The sectionSwitch of noise levelwill generate Figure S2 in the supplementary material. -
natural scene: to simulate the filters derived from CCA of contrast profiles from natural scenes, run the notebok
filter_natural_scene.ipynb. The output will be saved in theresultsfolder. -
ReSU: to simulate a two-layer ReSU network on natural scenes, run the notebook
ReSU_motion_detection.ipynb. The output will be saved in theresultsfolder.
All the figures in the main text can be reproduced by running the notebok figures_ReSU.ipynb. Note that, you have to run the previous notebooks to generate the data first.
ReSU_SM.pdf is the supplemental material for the main text.