You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: ChangeLog.md
+7-1Lines changed: 7 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,8 +1,14 @@
1
1
# Changes
2
2
Versioning follows [semver](https://semver.org/).
3
3
4
-
- v1.2.0:
4
+
- v1.3.0:
5
5
- Add support for using different horizons for neural/behavior data.
6
+
- v1.2.6:
7
+
- Fixes minor error in variable init for trial-based ISID.
8
+
- v1.2.5:
9
+
- Fixes minor `numpy.eye` error that was thrown for unstable learned models.
10
+
- v1.2.0:
11
+
- Adds version with support for external input (i.e., IPSID).
6
12
- v1.1.0:
7
13
- Automatically does the necessary mean-removal preprocessing for input neural/behavior data. Automatically adds back the learned means to predicted signals.
For MATLAB implementation see http://github.com/ShanechiLab/PSID
19
23
20
24
Given signals y_t (e.g. neural signals) and z_t (e.g behavior), PSID learns a dynamic model for y_t while prioritizing the dynamics that are relevant to z_t.
21
25
22
-
# Publication
26
+
IPSID is an extension of PSID that also supports taking a third signal u_t (e.g., task instructions) that is simultaneously measured with y_t. In the learned dynamical model, u_t plays the role of input to the latent states.
27
+
28
+
# Publications
29
+
## PSID
23
30
For the derivation of PSID and results in real neural data see the paper below.
24
31
25
32
Omid G. Sani, Hamidreza Abbaspourazad, Yan T. Wong, Bijan Pesaran, Maryam M. Shanechi. *Modeling behaviorally relevant neural dynamics enabled by preferential subspace identification*. Nature Neuroscience, 24, 140–149 (2021). https://doi.org/10.1038/s41593-020-00733-0
@@ -31,6 +38,11 @@ Original preprint: https://doi.org/10.1101/808154
31
38
You can also find a summary of the paper in the following Twitter thread:
For the derivation of IPSID and results in real neural data see the paper below.
43
+
44
+
Parsa Vahidi*, Omid G. Sani*, Maryam M. Shanechi. *Modeling and dissociation of intrinsic and input-driven neural population dynamics underlying behavior*. PNAS (2024). https://doi.org/10.1073/pnas.2212887121
45
+
34
46
35
47
# Usage guide
36
48
## Installation
@@ -47,12 +59,19 @@ import PSID
47
59
```
48
60
49
61
## Main learning function
50
-
The main function for the Python implementation is [source/PSID/PSID.py](https://github.com/ShanechiLab/PyPSID/blob/main/source/PSID/PSID.py) -> function PSID. A complete usage guide is available in the function. The following shows an example case:
62
+
The main functions for the Python implementation are the follwing:
63
+
- For PSID: [source/PSID/PSID.py](https://github.com/ShanechiLab/PyPSID/blob/main/source/PSID/PSID.py) -> the function called PSID
64
+
- For IPSID [source/PSID/IPSID.py](https://github.com/ShanechiLab/PyPSID/blob/main/source/PSID/IPSID.py) -> the function called IPSID
65
+
66
+
A complete usage guide is available in as comments in each function. The following shows example use cases:
51
67
```
52
-
idSys = PSID.PSID(y, z, nx, n1, i);
68
+
idSys = PSID.PSID(y, z, nx, n1, i)
69
+
# Or, if modeling effect of input u is also of interest
70
+
idSys = PSID.IPSID(y, z, u, nx, n1, i)
53
71
```
54
72
Inputs:
55
73
- y and z are time x dimension matrices with neural (e.g. LFP signal powers or spike counts) and behavioral data (e.g. joint angles, hand position, etc), respectively.
74
+
- IPSID also takes u as an input, which is a time x dimension matrix, containing the measured input data.
56
75
- nx is the total number of latent states to be identified.
57
76
- n1 is the number of states that are going to be dedicated to behaviorally relevant dynamics.
58
77
- i is the subspace horizon used for modeling.
@@ -61,30 +80,34 @@ Output:
61
80
- idSys: an LSSM object containing all model parameters (A, Cy, Cz, etc). For a full list see the code.
62
81
63
82
## Extracting latent states using learned model
64
-
Once a model is learned using PSID, you can apply the model to new data (i.e. run the associated Kalman filter) as follows:
83
+
Once a model is learned using (I)PSID, you can apply the model to new data (i.e. run the associated Kalman filter) as follows:
65
84
```
66
85
zPred, yPred, xPred = idSys.predict(y)
86
+
# Or, for IPSID:
87
+
zPred, yPred, xPred = idSys.predict(y, u)
67
88
```
68
89
Input:
69
90
- y: neural activity time series (time x dimension)
91
+
-[For IPSID] u: input time series (time x dimension)
70
92
71
93
Outputs:
72
94
- zPred: one-step ahead prediction of behavior (if any)
73
95
- yPred: one-step ahead prediction of neural activity
74
96
- xPred: Extracted latent state
75
97
76
98
## Required preprocessing
77
-
A required preprocessing when using PSID is to remove the mean of neural/behavior signals and if needed, add them back to predictions after learning the model. Starting from version 1.1.0, Python and MATLAB PSID libraries automatically do this by default so that users won't need to worry about it. Please update to the latest version if you are using an older version.
99
+
- Repeated data dimensions (e.g., two identical neurons) can cause issues for the learning. Remove repeated data dimensions as a preprocessing and repeat predictions as needed to reproduce prediction of repeated data dimensions.
100
+
- A required preprocessing when using (I)PSID is to remove the mean of neural/behavior/input signals and if needed, add them back to neural/behavior predictions after learning the model. Starting from version 1.1.0, Python (I)PSID and MATLAB PSID libraries automatically do this by default so that users won't need to worry about it. Please update to the latest version if you are using an older version.
78
101
79
102
## Choosing the hyperparameters
80
103
### How to pick the state dimensions nx and n1?
81
-
nx determines the total dimension of the latent state and n1 determines how many of those dimensions will be prioritizing the inclusion of behaviorally relevant neural dynamics (i.e. will be extracted using stage 1 of PSID). So the values that you would select for these hyperparameters depend on the goal of modeling and on the data. Some examples use cases are:
104
+
nx determines the total dimension of the latent state and n1 determines how many of those dimensions will be prioritizing the inclusion of behaviorally relevant neural dynamics (i.e. will be extracted using stage 1 of (I)PSID). So the values that you would select for these hyperparameters depend on the goal of modeling and on the data. Some examples use cases are:
82
105
83
106
If you want to perform dimension reduction, nx will be your desired target dimension. For example, to reduce dimension to 2 to plot low-dimensional visualizations of neural activity, you would use nx=2. Now if you want to reduce dimension while preserving as much behaviorally relevant neural dynamics as possible, you would use n1=nx.
84
107
If you want to find the best fit to data overall, you can perform a grid search over values of nx and n1 and pick the value that achieves the best performance metric in the training data. For example, you could pick the nx and n1 pair that achieves the best cross-validated behavior decoding in an inner-cross-validation within the training data.
85
108
86
109
### How to pick the horizon `i`?
87
-
The horizon `i` does not affect the model structure and only affects the intermediate linear algebra operations that PSID performs during the learning of the model. Nevertheless, different values of `i` may have different model learning performance. `i` needs to be at least 2, but also also determines the maximum n1 and nx that can be used per:
110
+
The horizon `i` does not affect the model structure and only affects the intermediate linear algebra operations that (I)PSID performs during the learning of the model. Nevertheless, different values of `i` may have different model learning performance. `i` needs to be at least 2, but also also determines the maximum n1 and nx that can be used per:
88
111
89
112
```
90
113
n1 <= nz * i
@@ -96,18 +119,27 @@ So if you have a low dimensional y_k or z_k (small ny or nz), you typically woul
96
119
For more information, see the notebook(s) referenced in the next section.
0 commit comments