Skip to content

Latest commit

History

21 Commits

Folders and files

NameName
Last commit message
Last commit date

Repository files navigation

GCCA

This repository is implementation of Generalized Canonical Correlation Analysis(GCCA). CCA can use only 2 data but GCCA can use more than 2 data.

CCA

CCA is the method to transform 2 data to one joint space. See example graph:

CCA Plot Result

CCA inplementation contains PCCA (Probablistic Canonical Correlation Analysis) transformation that is assumed that there is latent space in 2 data.

GCCA

GCCA is the method to transform multiple data to one joint space. See example graph:

GCCA Plot Result

You can give GCCA any number of data.

Installation

You can use 'git clone' command to install

Dependencies

You have to install python dependent libraries in advance as follow:

numpy==1.9.1
scipy==0.14.1
matplotlib==1.4.2
h5py==2.4.0

Usage of CCA

fromccaimportCCAimportloggingimportnumpyasnp# set log levellogging.root.setLevel(level=logging.INFO)
# create data in advancea=np.random.rand(50, 50)
b=np.random.rand(50, 60)
# create instance of CCAcca=CCA()
# calculate CCAcca.fit(a, b)
# transformcca.transform(a, b)
# transform by PCCAcca.ptransform(a, b)
# savecca.save_params("save/cca.h5")
# loadcca.load_params("save/cca.h5")
# plotcca.plot_pcca_result()

Usage of GCCA

fromgccaimportGCCAimportloggingimportnumpyasnp# set log levellogging.root.setLevel(level=logging.INFO)
# create data in advancea=np.random.rand(50, 50)
b=np.random.rand(50, 60)
c=np.random.rand(50, 70)
d=np.random.rand(50, 80)
e=np.random.rand(50, 90)
f=np.random.rand(50, 100)
g=np.random.rand(50, 110)
h=np.random.rand(50, 120)
i=np.random.rand(50, 130)
j=np.random.rand(50, 140)
k=np.random.rand(50, 150)
# create instance of GCCAgcca=GCCA()
# calculate GCCAgcca.fit(a, b, c, d, e, f, g, h, i, j, k)
# transformgcca.transform(a, b, c, d, e, f, g, h, i, j, k)
# savegcca.save_params("save/gcca.h5")
# loadgcca.load_params("save/gcca.h5")
# plotgcca.plot_gcca_result()

That's it!

About

Generalized Canonical Correlation Analysis

Resources

Stars

52 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages