Skip to content

Commit efb9096

Browse files
committed
Repo structure cleanup, fixing issues in code
1 parent bfe6218 commit efb9096

21 files changed

+766
-1381
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,9 @@ __pycache__/
44
*/.ipynb_checkpoints/*
55
.\ /
66
docs/_build/
7+
output/
8+
saves/
9+
checkpoint/
710

811
# Installer logs
912
pip-log.txt

README.md

Lines changed: 17 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,12 @@ The baseline models, along with the universal count model proposed in our work,
1919

2020

2121
#### 1. cd into ./scripts/
22-
Here is where all the code for fitting models, analysis and plotting is located.
22+
Here is where all the code for fitting models is located.
2323

2424

25-
#### 2. (Optional) Run the synthetic_data notebook to generate data from synthetic populations
26-
This generates the two synthetic populations and saves them into ./data/, both generated spike counts and behaviour as well as the encoding models.
27-
Note that the population data used in the paper has been included in ./data/, running this script will overwrite those files!
25+
#### 2. (Optional) Run synthetic_data.py to generate data from synthetic populations
26+
This script generates the two synthetic populations and saves them into ```./data/```, both generated spike counts and behaviour as well as the encoding models.
27+
Note that the population data used in the paper has been included in ```./data/```, running this script will overwrite those files!
2828

2929

3030
#### 3. Run the scripts to fit models
@@ -36,7 +36,7 @@ python3 validation.py --cv -1 2 5 8 --gpu 0 --modes 0 --datatype 0 --ncvx 2 --lr
3636
```
3737
This runs a model of mode 0 on synthetic data, with `--cv` indicating which cross-validation fold to leave out for validation (-1 indicates using all data) and `--gpu` indicating the GPU device to run on (if available).
3838
Line 188 in validation.py gives the definition of all modes (numbered 0 to 8), in particular the likelihood (1st element of tuple) and the input space (2d element of tuple) are specified.
39-
Note there is a 10-fold split of the data, hence the cv trial numbers can go from -1 to 9.
39+
Note there is a 10-fold split of the data, hence the cv trial integers can range from -1 to 9 (with -1 using all data for training).
4040
`lr` and `lr_2` indicate the learning rates, with `lr_2` for toroidal kernel lengthscales and variational standard deviations of the latent state posterior (lower for latent models as described in the paper).
4141
The flag `--ncvx` refers to the number of runs to do (selecting the best fit model after completion to save).
4242
One can also specify `--batchsize`, which can speed up training when larger depending on the memory capacity of the hardware used.
@@ -49,34 +49,30 @@ Line 108 in HDC.py gives the definition of all modes for the head direction cell
4949
All possible flags and their default values can be seen in the validation.py and HDC.py scripts.
5050
The file models.py defines the encoding models and uses the library code (neuroprob) to implement and run these probabilistic models.
5151

52-
In terms of neural data, the synthetic populatio data used in the paper and the head direction cell data is included in the ./data/ folder.
52+
In terms of neural data, the synthetic populatio data used in the paper and the head direction cell data is included in the ```./data/``` folder.
5353
All required modes in the analysis notebooks can be seen in the code as it loads trained models.
5454
Note that there are separate notebooks for synthetic (validation) and real (HDC) datasets.
55-
All trained models are stored in the ./checkpoint/ folder.
55+
All trained models are stored in the ```./checkpoint/``` folder.
5656

5757

5858
##### Experiments in the paper
59-
Synthetic data:
60-
- regression models `python3 validation.py --cv -1 2 5 8 --gpu 0 --modes 0 1 2 3 --datatype 0 --ncvx 2 --lr 1e-2`
61-
- latent variable models `python3 validation.py --cv -1 2 5 8 --gpu 0 --modes 4 5 6 7 --datatype 0 --ncvx 3 --lr 1e-2 --lr_2 1e-3`
62-
- progressively capturing single neuron variability and noise correlations `python3 validation.py --cv -1 2 5 8 --gpu 0 --modes 0 2 8 --datatype 1 --ncvx 2 --lr 1e-2`
59+
All commands needed for real data and synthetic data experiments are put into bash files ```run_HDC.sh``` and ```run_synthetic.sh``` for convenience.
60+
Inside the bash files, commands are grouped by categories, such as regression models or latent variable models.
61+
If you wish to run different modes or cross-validation runs grouped together above in parallel rather than sequentially, run the respective command with only a single `--modes` or `--cv` argument each time and repeat while looping through the list.
6362

64-
Head direction cell data:
65-
- regression with different likelihoods `python3 HDC.py --cv -1 1 2 3 5 6 8 --gpu 0 --modes 0 1 4 --ncvx 2 --lr 1e-2 --binsize 40`
66-
- regression with different regressors `python3 HDC.py --cv -1 1 2 3 5 6 8 --gpu 0 --modes 2 3 --ncvx 2 --lr 1e-2 --binsize 40`
67-
- joint latent-observed models `python3 HDC.py --cv -1 1 2 3 5 6 8 --gpu 0 --modes 5 6 7 8 --ncvx 3 --lr 1e-2 --lr_2 1e-3 --binsize 40`
68-
- latent variable models `python3 HDC.py --cv -1 1 2 3 5 6 8 --gpu 0 --modes 9 10 11 --ncvx 3 --lr 3e-2 --lr_2 5e-3 --binsize 100`
6963

70-
If you wish to run different modes or cross-validation runs grouped together above in parallel, run the command several times with only a single mode or cv trial each time.
7164

65+
#### 4. cd into ../analysis/
66+
Here one can find all the Jupyter notebooks for analysis and plotting.
7267

73-
#### 4. Run the analysis notebooks to analyze the data
68+
69+
#### 5. Run the analysis notebooks to analyze the data
7470
By running the analysis notebooks, we reproduce the plotting data for figures in the paper.
75-
Intermediate files (pickled) will be stored in the ./checkpoint/ folder.
71+
Intermediate files (pickled) will be stored in the ```./saves/``` folder.
7672

7773

78-
#### 5. Run the plotting notebooks
79-
This loads the analysis results and plots paper figures in .pdf and .svg formats, exported to the ./output/ folder.
74+
#### 6. Run the plotting notebooks
75+
This loads the analysis results and plots paper figures in .pdf and .svg formats, exported to the ```./output/``` folder.
8076

8177

8278

@@ -101,7 +97,6 @@ Input groups can contain observed and latent variables, with different priors on
10197
#### Models implemented
10298

10399
* Linear-nonlinear and GP mappings
104-
* RNNs
105100
* LVMs
106101
- Toroidal latent space priors ([Manifold GPLVM](https://arxiv.org/abs/2006.07429))
107102
- AR(1) temporal prior on latents

0 commit comments

Comments
 (0)