Git Product home page Git Product logo

neulvm's Introduction

DOI

This is python code collection for the publication:

Mesoscopic modeling of hidden spiking neurons

Contact: [email protected]

Installation:

conda create -n neuLVM python=3.8
conda activate neuLVM
conda install pip
pip install -r requirements.txt

Usage:

The main results (multi-pops winner-take-all experiment) of the publication can be replicated with the main script train_meso.py.

One example training dataset (11 s-long) is saved in dataset/3pop_noinput_small. To train a neuLVM, one can run the bash script 3pop_neuLVM.sh, in which we do five runs of train_meso.py with different initialized parameters. The results will be saved in result/3pop example/data11/train{i}/, including:

E{EMstep}_est_param: to retrieve the inferred pop. activity
minimizor_result_{EMstep}: to retrieve the fitted model/ parameters

E_{EMstep}_{GDstep}.png: visualization of the initial estimate of pop. activity
init_param: initialization of the model/ parameters
Eloss.png

What happened in train_meso.py

This code fits a winner-take-all circuit of three homegenenous populations of LIF neurons to the spike trains of nine recorded neurons. This code was used to produce the Figure 4 from our paper. For simplicity, the correct partitioning of the nine recorded neurons into three groups is given since it can be reliably obtained (more details are available in the paper). The fitting procedures (the function train in the file train_meso.py) contains 3 steps: initialization, E and M which we describe below.

[Data-driven initialization]: Since the sum over the observed neurons from population already provides a rough estimate of the latent population activity, the E-Step of the first iteration is replaced by an empirical estimation of the population activity from the observed spike trains (the function init_model in the file src/helper.py). And the EM iterations will start with the M-step. In the Figure below we show the population activity resulting from the initialization. initial estimate of pop. act.

[M-step $\widehat{\Theta}^{n} = \operatorname{argmax}_\Theta \log p(\mathbf{y^o},\widehat{\mathbf n}^{n}| \Theta)$]: Parameters (since there are not so many) are estimated with scipy.optimize.minimize (the function scipy_Mstep in the file train_meso.py). M-step optimizes Eq (4b) of the paper:

the probability (part a) of the observed spikes given the past observed spike activity and the past population activity (left part) is computed by the function fast_lossy in the file src/fast_np.py; and the probability (part b) of the population activity given the past population activity (right part) is computed by the function fast_lossZ in the file src/fast_np.py.

[E-step $\widehat{\mathbf n}^{n} = \operatorname{argmax}_\mathbf n \log p(\mathbf{y^o},\mathbf n| \widehat{\Theta}^{n-1})$]: Pop. act. are estimated with Adam algorithm (the function tf_EGDstep in the file train_meso.py). Losses are computed in the same way as above, only in the language of TensorFlow (src/LIFmesoCell.py).

In the Figure below we show the inferred population activity after EM iterations. inferred pop. act.

Free simulations

To simulate trials with trained model/parameters, one can run the python file simulate_with_trainedparams.py. In the Figure below we show the free simulations of the trained model. Free simulations

neulvm's People

Contributors

realwsq avatar jbrea avatar

Stargazers

Mauro Risonho de Paula Assumpção avatar

Watchers

 avatar

Forkers

huimiaochen

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.