Skip to content

Code and tutorials for fitting generalized linear models (GLM) in Tensorflow 2

License

Notifications You must be signed in to change notification settings

sytseng/GLM_Tensorflow_2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

55 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GLM_Tensorflow_2

Code and tutorials for fitting generalized linear models (GLM) in Tensorflow 2.

Written by Shih-Yi Tseng from the Harvey Lab at Harvard Medical School, with special acknowledgements to Matthias Minderer and Selmaan Chettih.

Structure of this repository:

  • The Python script glm_class.py in the code folder contains GLM class definitions and utility functions for fitting GLM in Tensorflow 2.
  • The two notebooks Tutorial_for_using_GLM_class.ipynb and Tutorial_for_fitting_neural_calcium_imaging_data_with_GLM.ipynb in the tutorial folder contain tutorials for how to use the GLM_class code and how to fit neural calcim imaging data with GLMs, respectively.
  • The Pickle file example_data_glm.pkl in the data folder contains example calcium imaging data used in the second tutorial.
  • The PDF file A guide for fitting generalized linear models in Tensorflow.pdf in the presentation folder contains slides for a short presentation of how to use the code and fit neural calcium imaging data with GLMs.

Software requirements

The code was developed with the following Python packages:

  • numpy version 1.21.6
  • scipy version 1.7.3
  • sklearn version 1.0.2
  • tensorflow version 2.8.2
  • keras version 2.8.0
  • matplotlib version 3.2.2

It works most efficiently on a GPU. Note that eager execution for Tensorflow must be enabled to run the code.

References:

  • Tseng, S.-Y., Chettih, S.N., Arlt, C., Barroso-Luque, R., and Harvey, C.D. (2022). Shared and specialized coding across posterior cortical areas for dynamic navigation decisions. Neuron 110, 2484–2502.e16. [link]
  • Minderer, M., Brown, K.D., and Harvey, C.D. (2019). The spatial structure of neural encoding in mouse posterior cortex during navigation. Neuron 102, 232–248.e11. [link]

About

Code and tutorials for fitting generalized linear models (GLM) in Tensorflow 2

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published