Giter Club home page Giter Club logo

gcca's Introduction

Install

This is a python 3 verson of Rupy's GCCA.

Install: pip install git+https://github.com/rjadr/GCCA

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

from gcca.cca import CCA
import logging
import numpy as np

# set log level
logging.root.setLevel(level=logging.INFO)

# create data in advance
a = np.random.rand(50, 50)
b = np.random.rand(50, 60)

# create instance of CCA
cca = CCA()
# calculate CCA
cca.fit(a, b)
# transform
cca.transform(a, b)
# transform by PCCA
cca.ptransform(a, b)
# save
cca.save_params("save/cca.h5")
# load
cca.load_params("save/cca.h5")
# plot
cca.plot_pcca_result()

Usage of GCCA

from gcca.gcca import GCCA
import logging
import numpy as np

# set log level
logging.root.setLevel(level=logging.INFO)

# create data in advance
a = 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 GCCA
gcca = GCCA()
# calculate GCCA
gcca.fit(a, b, c, d, e, f, g, h, i, j, k)
# transform
gcca.transform(a, b, c, d, e, f, g, h, i, j, k)
# save
gcca.save_params("save/gcca.h5")
# load
gcca.load_params("save/gcca.h5")
# plot
gcca.plot_gcca_result()

That's it!

gcca's People

Contributors

rjadr avatar rupy avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.