https://github.com/berenslab/rfest

A Python 3 toolbox for neural receptive field estimation using splines and Gaussian priors.

https://github.com/berenslab/rfest

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
    Found 2 DOI reference(s) in README
  • Academic publication links
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.7%) to scientific vocabulary

Keywords

evidence-optimization jax matrix-factorization receptive-field splines
Last synced: 5 months ago · JSON representation

Repository

A Python 3 toolbox for neural receptive field estimation using splines and Gaussian priors.

Basic Info
Statistics
  • Stars: 24
  • Watchers: 5
  • Forks: 3
  • Open Issues: 4
  • Releases: 2
Topics
evidence-optimization jax matrix-factorization receptive-field splines
Created almost 8 years ago · Last pushed over 1 year ago
Metadata Files
Readme License

README.md

showcase

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.

```python from rfest import GLM

lnp = GLM(distr='poisson', output_nonlinearity='softplus')

add training data

lnp.adddesignmatrix(Xtrain, dims=[25, ], df=[8, ], smooth='cr', name='stimulus') # use spline for stimulus filter lnp.adddesignmatrix(ytrain, dims=[20, ], df=[8, ], smooth='cr', shift=1, name='history') # use spline for history filter

add validation data

lnp.adddesignmatrix(Xdev, name='stimulus') # basis will automatically apply to dev set lnp.adddesignmatrix(ydev, name='history')

intialize model parameters

lnp.initialize(numsubunits=1, dt=dt, method='random', randomseed=2046)

fit model

lnp.fit(y={'train': ytrain, 'dev': ydev}, numiters=1000, verbose=100, stepsize=0.1, beta=0.01) ```

Evidence Optimization

  • Ridge Regression
  • Automatic Relevance Determination (ARD) [2]
  • Automatic Smoothness Determination (ASD) [3]
  • Automatic Locality Determination (ALD) [4]

```python 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).

python from rfest.MF import KMeans, semiNMF

For more information, see here.

Installation

rfest is available on pypi:

sh 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:

sh 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

sh pip install -U "jax[cuda12]"

Dependencies

numpy
scipy
sklearn
matplotlib
jax
jaxlib

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.

Owner

  • Name: Berens Lab @ University of Tübingen
  • Login: berenslab
  • Kind: organization
  • Email: philipp.berens@uni-tuebingen.de
  • Location: Tübingen, Germany

Department of Data Science at the Hertie Institute for AI in Brain Health, University of Tübingen

GitHub Events

Total
  • Watch event: 1
Last Year
  • Watch event: 1

Dependencies

requirements.txt pypi
  • jax *
  • jaxlib *
  • matplotlib *
  • numpy *
  • scipy *
  • sklearn *
pyproject.toml pypi