RFEst v2 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]
The new GLM module unified both vanilla and spline GLMs.
from rfest import GLM
lnp = GLM(distr='poisson', output_nonlinearity='softplus')
# add training data
lnp.add_design_matrix(X_train, dims=[25, ], df=[8, ], smooth='cr', name='stimulus') # use spline for stimulus filter
lnp.add_design_matrix(y_train, dims=[20, ], df=[8, ], smooth='cr', shift=1,
name='history') # use spline for history filter
# add validation data
lnp.add_design_matrix(X_dev, name='stimulus') # basis will automatically apply to dev set
lnp.add_design_matrix(y_dev, name='history')
# intialize model parameters
lnp.initialize(num_subunits=1, dt=dt, method='random', random_seed=2046)
# fit model
lnp.fit(y={'train': y_train, 'dev': y_dev},
num_iters=1000, verbose=100, step_size=0.1, beta=0.01)
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, semiNMF
For more information, see here.
Installation
rfest is available on pypi:
pip install rfest
This will install rfest with CPU support.
Alternative, you can clone this repo into a local directory and install via pip editable mode:
git clone https://github.com/berenslab/RFEst
pip install -e RFEst
If you want GPU support, follow the instructions on the JAX github repository to install JAX with GPU support (before installing rfest). For example, for NVIDIA GPUs, run
pip install -U "jax[cuda12]"
Dependencies
Declared in pyproject.toml and installed with rfest: numpy, scipy,
scikit-learn, matplotlib and jax. Contour area measurements in
rfest.check additionally need opencv-python, available as an extra:
pip install "rfest[contours]"
Tutorial
Tutorial notebooks can be found here: https://github.com/huangziwei/notebooks_RFEst
Reference
[1] Huang, Z., Ran, Y., Oesterle, J., Euler, T., & Berens, P. (2021). Estimating smooth and sparse neural receptive fields with a flexible spline basis. Neurons, Behavior, Data Analysis, and Theory, 5(3), 1–30. https://doi.org/10.51628/001c.27578
[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.
Metadata
Release files for rfest 2.2.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| rfest-2.2.0.tar.gz | 71.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| rfest-2.2.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 152.5 kB
Release files / rfest-2.2.0.tar.gz
| Download URL | rfest-2.2.0.tar.gz |
|---|---|
| Size | 71.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
b98e09671d708add531e0b2aa3ffd4b6cfc191768ba72a84508be66fa5192071
|
|
BLAKE2b-256 checksum How to use checksums |
48286318f00bc6531feae2cf111a3754ebedb33ccc91706922adf462de115e13
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency logRelease files / rfest-2.2.0-py3-none-any.whl
| Download URL | rfest-2.2.0-py3-none-any.whl |
|---|---|
| Size | 81.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7306b266e4711ff9f2e833f2dec398da63e75e666e6c2c0de9efd38a0b409063
|
|
BLAKE2b-256 checksum How to use checksums |
b2bac3a8112b1a124901af954d1dcaa64462619856dcf6bcc8fa15f97e502d6e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 18, 2026.
Transparency log