Python code for the paper "Equivariant Dimensionality Reduction on Stiefel Manifolds" by Andrew Lee, Harlin Lee, Jose Perea, Nikolas Schonsheck, and Madeleine Weinstein.
For the easiest example,
git clone https://github.com/HarlinLee/PSC.git
cd PSC
python demo.py
You may be asked to install certain packages, such as
pip install pymanopt==2.2.0
pip install autograd==1.6.2
pip install geomstats==2.6.0
The PSC/
package contains:
-
projections.py
: Our PSC algorithm including manopt gradient descent and$\pi_\alpha$ . -
utils.py
: Helper code including calculation of projection error. -
comparison.py
: Helper functions for PGA comparison. -
plots.py
: Plotting functions for PGA comparison.
The experiments/
folder contains code to recreate experiments and figures produced in the paper. The Jupyter notebooks were tested in Google Colab, so if you appropriately edit the variable DRIVE_PATH and output_folder, every experiment should be reproducible in either Google Colab or your local machine.
-
low_dim.ipynb
: Low-dimensional example with$k=1, n=2, N=3$ for PSC demonstration. Figureslowdim-opt.pdf
,lowdim_piy_0.8.pdf
,lowdim_y_0.8.pdf
,lowdim_yhat_0.8.pdf
are outputs of this code with noise level$\epsilon=0.8$ . -
variance_comparison.ipynb
: Comparison with PGA.var_data.pkl
is saved output. Checkcomparison.py
andplots.py
for more details. -
brain.ipynb
: Brain connectivity matrix experiment. Uses matlab data saved in the folderconnectivity_matrices
and saves the plotbrain_projected.pdf
. -
neuron/
-
create_neural_response.ipynb
: A Julia file that generates data according to the neuronal stimulus space model. It uses auxilary functions injulia_utilities.jl
. This makes files such asneurons.h5
,random_walk.h5
(or100_neurons_13k_steps_nonuniform_half_random_walk.h5
), andresponse_matrix.h5
.centered_normalized_response_matrix_100_neurons_13k_steps_nonuniform_half_random_walk.h5
is the centered and$\ell_2$ -normalized response matrix (see code at top ofstimulus_space_model.ipynb
). -
stimulus_space_model.ipynb
: Applies PSC, MDS, and persistent cohomology on the response matrix. Since MDS takes a while,MDS_script.py
can be used as an alternative for running MDS inside the Jupyter notebook. Figurespsc_angle.pdf
,psc_path.pdf
,comparisons-others.pdf
,comparisons-path.pdf
are generated, and dimensionality reduction resultscirc_coords.h5
,mds.h5
,PSC.pkl
are saved.
-
-
video/
-
video-clustering.ipynb
: Video clustering experiment.
-