RFEst is a Python3 toolbox for neural receptive field estimation, featuring methods such as spline-based GLMs, Empirical Bayes with various Gaussian priors, and a few matrix factorization methods.
Supported Methods
Spline-based GLMs [1]
splineLG, splineLNP and splineLNLN use natural cubic regression splines and others to approximate spatio-temporal RFs.
Given a stimulus design matrix (X) and the corresponding response (y), an optimized RF is calculated with respect to the dimension of the RF dims=[nT, nX, nY] :
from rfest import splineLG
spl = splineLG(X, y, dims=[5, 20, 15], df=[4, 9, 7], smooth='cr')
spl.fit(num_iters=500, alpha=1, beta=0.025, verbose=100)Evidence Optimization
- Ridge Regression
- Automatic Relevance Determination (ARD) [2]
- Automatic Smoothness Determination (ASD) [3]
- Automatic Locality Determination (ALD) [4]
from rfest import ASD
asd = ASD(X, y, dims=[5, 20, 15]) # nT, nX, nY
p0 = [1., 1., 2., 2., 2.] # sig, rho, 𝛿t, 𝛿y, 𝛿x
asd.fit(p0=p0, num_iters=300)Matrix Factorization
A few matrix factorization methods have been implemented as a submodule (MF).
from rfest.MF import KMeans, semiNMFFor more information, see here.
Installation
RFEst uses JAX for automatic differentiation and JIT compilation to GPU/CPU, so you need to install JAX first.
To install CPU-only version for Linux and MacOS, simply clone this repo into a local directory and install via pip:
git clone https://github.com/berenslab/RFEst
pip install -e RFEstTo enable GPU support on Linux, you need to consult the JAX install guide. For reference purpose, I copied the relevant steps here, but please always check the JAX README page for up-to-date information.
# install jaxlib
PYTHON_VERSION=cp37 # alternatives: cp36, cp37, cp38
CUDA_VERSION=cuda100 # alternatives: cuda100, cuda101, cuda102, cuda110
PLATFORM=manylinux2010_x86_64 # alternatives: manylinux2010_x86_64
BASE_URL='https://storage.googleapis.com/jax-releases'
pip install --upgrade $BASE_URL/$CUDA_VERSION/jaxlib-0.1.50-$PYTHON_VERSION-none-$PLATFORM.whl
pip install --upgrade jax # install jaxA Note For Windows Users
JAX has no native Windows support yet, but can be installed on CPU via the Windows Subsystem for Linux (Windows 10 only, and make sure that the pip version is the latest pip install --upgrade pip).
Dependencies
numpy
scipy
sklearn
matplotlib
jax
jaxlib
Tutorial
Tutorial notebooks can be found here: https://github.com/huangziwei/notebooks_RFEst
Reference
[1] Huang, Z., & Berens, P. (2020). Efficient high dimensional receptive field inference using a flexible spline basis. Cosyne Abstracts 2020, Denver, CO. [abstract] [poster]
[2] MacKay, D. J. (1994). Bayesian nonlinear modeling for the prediction competition. ASHRAE transactions, 100(2), 1053-1062.
[3] Sahani, M., & Linden, J. F. (2003). Evidence optimization techniques for estimating stimulus-response functions. In Advances in neural information processing systems (pp. 317-324).
[4] Park, M., & Pillow, J. W. (2011). Receptive field inference with localized priors. PLoS computational biology, 7(10), e1002219.

Formed in 2009, the Archive Team (not to be confused with the archive.org Archive-It Team) is a rogue archivist collective dedicated to saving copies of rapidly dying or deleted websites for the sake of history and digital heritage. The group is 100% composed of volunteers and interested parties, and has expanded into a large amount of related projects for saving online and digital history.

