Giter Site home page Giter Site logo

r_ajiveparallel's Introduction

ajive: Angle based Joint and Individual Variation Explained

Author: Iain Carmichael
License: MIT

Additional documentation, examples and code revisions are coming soon. For questions, issues or feature requests please reach out to Iain: [email protected].

Overview

Angle based Joint and Individual Variation Explained (AJIVE) is a dimensionality reduction algorithm for the multi-block setting i.e. (K) different data matrices, with the same set of observations and (possibly) different numbers of variables. AJIVE finds joint modes of variation which are common to all (K) data blocks as well as modes of individual variation which are specific to each block. For a detailed discussion of AJIVE see Angle-Based Joint and Individual Variation Explained.

A python version of this package can be found here.

Installation

The ajive package is currently available using devtools

# install.packages('devtools')
devtools::install_github("idc9/r_jive")

Example

Consider the following two block toy example: the first block has 200 observations (rows) and 100 variables; the second block has the same set of 200 observations and 500 variables (similar to Figure 2 of the AJIVE paper).

library(ajive)

# sample a toy dataset with true joint rank of 1
blocks <- sample_toy_data(n=200, dx=100, dy=500)

data_blocks_heatmap(blocks, show_color_bar=FALSE)

After selecting the initial signal ranks we can compute the AJIVE decomposition using the ajive function.

initial_signal_ranks <- c(2, 3) # set by looking at scree plots
jive_results <- ajive(blocks, initial_signal_ranks, 
                      n_wedin_samples = 100, n_rand_dir_samples = 100)

# estimated joint rank
jive_results$joint_rank
#> [1] 1

The heatmap below shows that AJIVE separates the joint and individual signals for this toy data set.

decomposition_heatmaps(blocks, jive_results)

Using notation from Section 3 of the AJIVE paper (where u means scores and v means loadings) we can get the jive data out as follows

# common normalized scores
dim(jive_results$joint_scores)
#> [1] 200   1

# Full matrix representation of the joint signal for the first block
dim(jive_results$block_decomps[[1]][['joint']][['full']])
#> [1] 200 100

# joint block specific scores for the first block
dim(jive_results$block_decomps[[1]][['joint']][['u']])
#> [1] 200   1

# joint block specific loadings for the first block
dim(jive_results$block_decomps[[1]][['joint']][['v']])
#> [1] 100   1

# individual block specific scores for the second block
dim(jive_results$block_decomps[[2]][['individual']][['u']])
#> [1] 200   2

Help and Support

Additional documentation, examples and code revisions are coming soon. For questions, issues or feature requests please reach out to Iain: [email protected].

Documentation

The source code is located on github: https://github.com/idc9/r_jive. Currently the best math reference is the AJIVE paper.

Testing

Testing is done using the testthat package.

Contributing

We welcome contributions to make this a stronger package: data examples, bug fixes, spelling errors, new features, etc.

Citation

A Journal of Statistical Software paper is hopefully coming soon…

r_ajiveparallel's People

Contributors

idc9 avatar nik-shvetsov avatar

Watchers

James Cloos avatar paper2code - bot 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.