-
Notifications
You must be signed in to change notification settings - Fork 94
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2dbcd5a
commit 918b822
Showing
1 changed file
with
17 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -18,41 +18,30 @@ dPCA is a linear dimensionality reduction technique that automatically discovers | |
month={Apr} | ||
} | ||
## Use dPCA | ||
🚀 Quickstart | ||
------------- | ||
|
||
Simple example code for surrogate data can be found in [**dpca_demo.ipynb**](http://nbviewer.ipython.org/github/wielandbrendel/dPCA/blob/master/python/dPCA_demo.ipynb) and **dpca_demo.m**. | ||
.. code-block:: bash | ||
### Python package | ||
pip install dpca | ||
The Python package is tested against Python 2.7 and Python 3.4. To install, first make sure that numpy, cython, scipy, sklearn, itertools and numexpr are avaible. Then copy the files from the Python subfolder to a location in the Python search path. | ||
Alternatively, from the terminal you can install the package by running: | ||
🎉 Use dPCA | ||
----------- | ||
Simple example code for surrogate data can be found in [**dpca_demo.ipynb**](http://nbviewer.ipython.org/github/wielandbrendel/dPCA/blob/master/python/dPCA_demo.ipynb) and **dpca_demo.m**. | ||
|
||
``` | ||
$ cd /path/to/dPCA/python | ||
$ python setup.py install | ||
``` | ||
API of dPCA is similar to sklearn. To use dPCA, you should first import dPCA and initialize it before callling the fitting function, | ||
|
||
API of dPCA is similar to sklearn. To use dPCA, you should first import dPCA, | ||
`from dpca import dPCA` | ||
then initialize it, | ||
`dpca = dPCA(labels, n_components, regularizer)` | ||
then call the fitting function on your data to get the latent components Z, | ||
`Z = dpca.fit_transform(X)`. | ||
.. code-block:: python | ||
from dpca import dPCA | ||
dpca = dPCA(labels, n_components, regularizer) | ||
Z = dpca.fit_transform(X) | ||
The required initialization parameters are: | ||
- *X* - A multidimensional array containing the trial-averaged data. E.g. X[n,t,s,d] could correspond to the mean response of the *n*-th neuron at time *t* in trials with stimulus *s* and decision *d*. The observable (e.g. neuron index) needs to come first. | ||
- *labels* - Optional; list of characters with which to describe the parameter axes, e.g. 'tsd' to denote time, stimulus and decision axis. All marginalizations (e.g. time-stimulus) are refered to by subsets of those characters (e.g. 'ts'). | ||
- *n_components* - Dictionary or integer; if integer use the same number of components in each marginalization, otherwise every (key,value) pair refers to the number of components (value) in a marginalization (key). | ||
|
||
More detailed documentation, and additional options, can be found in **dpca.py**. | ||
|
||
### MATLAB package | ||
* **X:** A multidimensional array containing the trial-averaged data. E.g. X[n,t,s,d] could correspond to the mean response of the *n*-th neuron at time *t* in trials with stimulus *s* and decision *d*. The observable (e.g. neuron index) needs to come first. | ||
* **labels:** Optional; list of characters with which to describe the parameter axes, e.g. 'tsd' to denote time, stimulus and decision axis. All marginalizations (e.g. time-stimulus) are refered to by subsets of those characters (e.g. 'ts'). | ||
* **n_components:** Dictionary or integer; if integer use the same number of components in each marginalization, otherwise every (key,value) pair refers to the number of components (value) in a marginalization (key). | ||
|
||
Add the Matlab subfolder to the Matlab search path. | ||
|
||
Example code in `dpca_demo.m` generates surrogate data and provides a walkthrough for running PCA and dPCA analysis and plotting the results. | ||
|
||
### Support | ||
|
||
Email [email protected] (Python) or [email protected] (Matlab) with any questions. | ||
More detailed documentation, and additional options, can be found in **dpca.py**. |