This code generates the analyses in the paper "Structured random receptive fields enable informative sensory encodings" (biorxiv preprint), published in PLoS Comp Bio.
Summary: In this work, we describe an approach to model receptive fields of biological neurons as samples from Gaussian Processes (GP). We successfully model receptive fields datasets in two disparate sensory regions, insect mechanosensors and mammalian primary visual cortex (V1). Using our models, we also show a novel initialization scheme that improves the learning efficiency of artificial neural networks (ANNs).
The steps below use either uv or plain pip. We have tested Python 3.10.
-
Do a clean download of the repository. Go inside the repo.
-
Make a virtual environment, unless you want to install into the base environment.
uv pip uv venv --python 3.10python3 -m venv .venv -
Activate the new environment
source .venv/bin/activate -
Install the package and the notebook tools.
uv pip uv pip install -e .pip install -e .uv pip install -r requirements.txtpip install -r requirements.txt -
Download all the datasets and preprocess.
uv pip make data PIP="uv pip"make data -
Run the notebooks in notebooks/reports folder.
Choosing a torch build: install the desired torch and torchvision before step 4, since
requirements.txt otherwise installs the default build. The later -e . install leaves them untouched.
# pip
pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121 # or .../cpu
# uv
uv pip install torch torchvision --index-url https://download.pytorch.org/whl/cu121
With uv you can instead pass its backend flag at install time: uv pip install -e . --torch-backend cpu
(other values: cu126, auto, ...).
The data for our analyses can be found in this Google drive folder.
-
The source code is in the /structured_random_features folder. The jupyter notebooks in /notebooks/reports folder show the analyses used in the paper.
-
Notebooks 1--5 show how we fit our covariance models to biological data. We plot these results in Notebooks 16.0--16.4.
-
Notebooks 6 and 7 show the results on the time-series classification tasks. We plot these results in Notebook 16.5.
-
Notebooks 8--11 show the results on the digit classification tasks. We plot these results in Notebook 16.6.
-
Notebooks 12--15 show our classification performance when initializing networks with structured random features. We plot these results in Notebook 16.7 and 16.8
-
Notebooks 16.xx are used to plot the figures shown in the paper. They assume that you have run the relevant notebooks and saved the results.
