Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GSoC 2021: Support of the simulation-based inference with the model fitting toolbox #64

Merged
merged 128 commits into from
Dec 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
128 commits
Select commit Hold shift + click to select a range
bb63b99
fix tqdm import and add some stylistic improvements
Jun 16, 2021
76ea512
add Inferencer class to __all__
Jun 16, 2021
b05f789
add sbi in requirements
Jun 16, 2021
bf739ae
add sbi as optional dependency
Jun 16, 2021
ad3e8ca
add minor stylistic changes
Jun 16, 2021
0e9de9e
first steps into the development of sbi wrapper class
Jun 16, 2021
e8f91fd
update gitignore with sbi-logs directory
Jun 17, 2021
b7afcdd
Fix the location of sbi_logs in gitignore
Jun 18, 2021
fc9a87f
Add example for simulation-based inference
Jun 18, 2021
c72c0d2
[WIP] Add multi-trace support
Jun 18, 2021
2346e01
Further progress of train method
Jun 19, 2021
5d0917d
add multi-round inference support
Jun 19, 2021
b57b0e2
add support for multiple output variables
Jun 19, 2021
6550855
use tqdm.auto.trange instead of tqdm.trange
Jun 24, 2021
620aa2a
add double backticks instead of single backticks in docstrings
Jun 24, 2021
948088f
add cleaner extraction of recorded values
Jun 24, 2021
8580e42
add seperate method for visualization and add method for generating f…
Jun 24, 2021
d719543
enable train to take a list of functions for summary feature extraction
Jun 24, 2021
eb1e512
update according to changes in Inferencer class
Jun 24, 2021
ba37935
add visualization of fitted traces
Jun 24, 2021
32085fe
fix docstrings to work well with sphinx
Jun 24, 2021
5763c47
rename train to infere and additional refactoring
Jun 25, 2021
49f673e
Remove plt.show from pairplot
mstimberg Jun 25, 2021
1d79aaf
Adapt example to train→infere rename
mstimberg Jun 25, 2021
ceb7348
Moving attributes into Inferencer.__init__
mstimberg Jun 25, 2021
d21ce5e
Merge pull request #49 from brian-team/add_sbi_wrapper_class
mstimberg Jun 25, 2021
f6916c4
add pt and pth files
Jun 27, 2021
ae627e1
add slight changes in API and load/store functionality
Jun 27, 2021
f843194
add changes w.r.t. changes in Inferencer API
Jun 27, 2021
f6913c4
add saved numpy arrays
Jun 28, 2021
6fa9eed
add storing functionality for theta and x
Jun 28, 2021
97f5307
fix minor issues
Jun 29, 2021
b6a394d
fix refactory variable default value
Jul 7, 2021
c250909
added separate methods for storing and loading data + additional refa…
Jul 8, 2021
88a1a39
add small changes due to changes in Inferencer class
Jul 8, 2021
a1eb97a
add integrate-and-fire neuron example
Jul 8, 2021
7ea2098
add advanced example
Jul 8, 2021
19a3cba
clean up
Jul 9, 2021
be02ef3
add better pairplotting
Jul 9, 2021
728ad0e
clean up
Jul 9, 2021
88fc065
add better handling of keyword arguments
Jul 9, 2021
7461b39
minor updates
Jul 10, 2021
9545887
Revert testing change that broke example
mstimberg Jul 13, 2021
be3209e
Merge pull request #52 from brian-team/add_store_load_functionality
mstimberg Jul 13, 2021
c85ce97
implement wrapper funcs for sbi's conditional_pairplot and conditiona…
Jul 17, 2021
6ab9a4b
fix minor issues in cond_corrcoeff
Jul 17, 2021
dd278dc
fix docstrings + change features argument to be optional
Jul 20, 2021
c5eb245
better handling of plotting parameters + additional fixes
Aug 2, 2021
70279b6
x and x_0 shapes fixed
Aug 3, 2021
0d89a8e
fix kwargs forwarding
Aug 3, 2021
4fb82be
adjust for the changes in api
Aug 3, 2021
3031d73
adjust to changes made in api
Aug 3, 2021
0314069
enable multitrace support with or without given list of features
Aug 5, 2021
e09f175
adjust to changes in api
Aug 5, 2021
2762001
Merge pull request #58 from brian-team/enhance_posterior_viz
akapet00 Aug 5, 2021
5167143
change features type to dict instead of list to enable multi output i…
Aug 6, 2021
487612e
fix docstrings + small updates
Aug 6, 2021
0404076
adjust to changes in inferencer class
Aug 6, 2021
6de7ada
rename file and adjust due to changes in inferencer class
Aug 6, 2021
a4be2b1
rename and adjust to new changes in inferencer class
Aug 6, 2021
291edbd
fix docstrings
Aug 6, 2021
a00c63f
rename file and adjust to changes in backend
Aug 6, 2021
7cd1c0a
small updates in visualization
Aug 6, 2021
a9d7047
adjust level values for simulator
Aug 6, 2021
c3e6c6f
rerun
Aug 7, 2021
9f9e29b
fix handling args for multiround inference with snpe
Aug 7, 2021
a9da86c
Merge pull request #59 from brian-team/multiple_output_var_support
mstimberg Aug 7, 2021
3b6a82a
add restart parameter that enables amortized inference in case of a r…
Aug 9, 2021
0465a21
use tqdm instead of manually printing each round number
Aug 9, 2021
92c6703
fix handling of features for different output variables
Aug 10, 2021
4e8533a
add tqdm to feature extraction loops
Aug 10, 2021
385bf88
add spike support
Aug 10, 2021
ba91383
enable inferencer to work without statemonitor
Aug 10, 2021
41b3376
secifiy sbi minimum version
Aug 12, 2021
2bf189c
simplify feature extraction including spikes
Aug 12, 2021
b643226
add key error handling for the state monitor object in generate_trace…
Aug 12, 2021
27370ac
update examples before new PR covering spike support
Aug 12, 2021
ee73d29
remove uncecessary files
Aug 12, 2021
c10397c
add minor updates
Aug 12, 2021
15de949
Merge pull request #60 from brian-team/add_spike_support
akapet00 Aug 13, 2021
3fe11f7
add inferencer api reference
Aug 13, 2021
f121546
update README file
Aug 14, 2021
5f0651b
update the front webpage
Aug 14, 2021
90bfad9
small changes
Aug 14, 2021
8510f1d
add inferencer to api references
Aug 14, 2021
f6ae7aa
update simple examples with Inferencer
Aug 14, 2021
bfb0094
update table of contents in examples
Aug 14, 2021
7d9278e
change the title of the example using Fitter
Aug 14, 2021
ef99912
add placehoders for examples using Inferencer
Aug 14, 2021
b3274fc
update introduction section
Aug 14, 2021
50f7192
small typo fix
Aug 14, 2021
f086c70
placeholder for detailed info on Inferencer
Aug 14, 2021
01ce180
finilize the front page
Aug 14, 2021
0e936cb
double instead of single backticks
Aug 14, 2021
50c6197
enable gpu support
Aug 15, 2021
bfb1305
Merge pull request #61 from brian-team/add_gpu_support
akapet00 Aug 15, 2021
2cb7886
add technical details on sbi
Aug 15, 2021
9c53888
fix typos
Aug 15, 2021
598d9a9
update howitworks page
Aug 15, 2021
98666a6
update docstrings
Aug 16, 2021
590ccb1
sbi example with simple interface
Aug 16, 2021
a7d168f
minor fixes
Aug 16, 2021
4eb23f0
add small changes to examples
Aug 16, 2021
fafcced
fix new data generation in multi-round inference
Aug 17, 2021
55eb009
update examples after multi-round bug has been fixed
Aug 17, 2021
58c9b72
add examples of using the toolbox for simulation-based inferencer
Aug 17, 2021
5aff366
small updates
Aug 17, 2021
ccd8ce6
update advanced features list
Aug 18, 2021
97163b6
fix docstrings for conditional_corrcoeff
Aug 18, 2021
160de3c
fix typos
Aug 18, 2021
a82670b
figures for the sbi tutorial
Aug 20, 2021
f60c278
add tutorial on sbi
Aug 20, 2021
a456097
fix formating issues and resize images
Aug 20, 2021
b562c80
fix ref to Inferencer
Aug 20, 2021
7c73106
remove ref to class from subtitle
Aug 20, 2021
15ac38d
update figures for sbi tutorial
Aug 21, 2021
f4857b5
add reference to sbi lib and rename device to sbi_device in infer
Aug 21, 2021
c79128d
add simulating script for sbi tutorial
Aug 21, 2021
b30cb55
add citation for sbi
Aug 21, 2021
fa40299
revision of the tutorial
Aug 21, 2021
570d570
add doi to sbi ref
Aug 21, 2021
1a7e93f
add citations
Aug 21, 2021
d57b1c5
update gitignore
Aug 22, 2021
2df6dc2
fix docstrings
Aug 22, 2021
2bf03d2
testing inferencer
Aug 22, 2021
0c8776f
update tests
Aug 22, 2021
fbf4d2f
Merge pull request #63 from brian-team/update_tests
akapet00 Aug 22, 2021
cc3c6b1
The last commit for GSoC 2021 project!
Aug 23, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -80,3 +80,19 @@ target/

# Installation and auto-generated files
brian2modelfitting.egg-info

# sbi logs
examples/sbi-logs/
brian2modelfitting/tests/sbi-logs/

# other sbi and torch stuff
examples/*.pt
examples/*.pth
brian2modelfitting/tests/*.pt
brian2modelfitting/tests/*.pth

# numpy files
examples/*.npy
examples/*.npz
brian2modelfitting/tests/*.npy
brian2modelfitting/tests/*.npz
32 changes: 21 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,28 +1,38 @@
brian2modelfitting
==================

Model fitting toolbox for Brian 2 simulator.

Model Fitting Toolbox for Brian 2 simulator, to allow the user to find the best fit of the parameters for recorded traces and spike trains.
[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4601961.svg)](https://doi.org/10.5281/zenodo.4601961)

By default, we support a range of global derivative-free optimization methods, that include popular methods for model fitting, such as: Differential Evolution, Particle Swarm Optimization and Covariance Matrix Adaptation (provided by the Nevergrad) as well as Bayesian Optimization for black box functions (provided by Scikit-Optimize).

Documentation for Brian2modelfitting can be found at http://brian2modelfitting.readthedocs.org

Brian2modelfitting is released under the terms of the CeCILL 2.1 license.
The package [`brian2modelfitting`](https://brian2modelfitting.readthedocs.io) allows the user to find the best fit of the unknown free parameters for recorded traces and spike trains. It also supports simulation-based inference, where instead of point-estimated parameter values, a full posterior distribution over the parameters is computed.

Please report issues at the github issue tracker (https://github.com/brian-team/brian2modelfitting/issues) or at the brian discussion forum (https://brian.discourse.group)
By default, the toolbox supports a range of global derivative-free optimization methods, that include popular methods for model fitting: differential evolution, particle swarm optimization and covariance matrix adaptation (provided by the [`Nevergrad`](https://facebookresearch.github.io/nevergrad/), a gradient-free optimization platform) as well as Bayesian optimization for black box functions (provided by [`scikit-optimize`](https://scikit-optimize.github.io/stable/), a sequential model-based optimization library). On the other hand, simulation-based inference is the process of finding parameters of a simulator from observations by taking a Bayesian approach via sequential neural posterior estimation, likelihood estimation or ration estimation (provided by the [`sbi`](https://www.mackelab.org/sbi/)), where neural densitiy estimator, a deep neural network allowing probabilistic association between the data and underlying parameter space, is trained. After the network is trained, the approximated posterior distribution is available.

[![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.4601961.svg)](https://doi.org/10.5281/zenodo.4601961)
Documentation
-------------
[![Documentation Status](https://readthedocs.org/projects/ansicolortags/badge/?version=latest)](https://brian2modelfitting.readthedocs.io)

The full documentation is available at http://brian2modelfitting.readthedocs.org.

Testing status
--------------
[![Build Status](https://github.com/brian-team/brian2modelfitting/workflows/Tests/badge.svg)](https://github.com/brian-team/brian2modelfitting/actions)
[![Coverage Status](https://coveralls.io/repos/github/brian-team/brian2modelfitting/badge.svg?branch=master)](https://coveralls.io/github/brian-team/brian2modelfitting?branch=master)

Installation
------------
Module can be installed with pypi:
Install `brian2modelfitting` from the Python package index via pip:
```
pip install brian2modelfitting
```

License
-------
The model fitting toolbox is released under the terms of the CeCILL 2.1 license and is available [here](https://github.com/brian-team/brian2modelfitting/blob/master/LICENSE).

Testing status
--------------
[![Build Status](https://github.com/brian-team/brian2modelfitting/workflows/Tests/badge.svg)](https://github.com/brian-team/brian2modelfitting/actions)
[![Coverage Status](https://coveralls.io/repos/github/brian-team/brian2modelfitting/badge.svg?branch=master)](https://coveralls.io/github/brian-team/brian2modelfitting?branch=master)
Use
---
Please report issues at the GitHub [issue tracker](https://github.com/brian-team/brian2modelfitting/issues) or at the [Brian 2 discussion forum](https://brian.discourse.group).
4 changes: 3 additions & 1 deletion brian2modelfitting/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

from .tests import run as run_test
from .fitter import *
from .inferencer import Inferencer
from .optimizer import *
from .metric import *
from .simulator import *
Expand All @@ -16,4 +17,5 @@
'Simulator', 'RuntimeSimulator', 'CPPStandaloneSimulator',
'MSEMetric', 'Metric', 'GammaFactor', 'FeatureMetric',
'SpikeMetric', 'TraceMetric', 'get_gamma_factor', 'firing_rate',
'Fitter', 'SpikeFitter', 'TraceFitter', 'OnlineTraceFitter']
'Fitter', 'SpikeFitter', 'TraceFitter', 'OnlineTraceFitter',
'Inferencer']
Loading