Git Product home page Git Product logo

miprest's Introduction

Author : Kevin S. Brown ([email protected], github.com/thelahunginjeet), Ameya Akkalkotkar

A python package that can be used for Mixed ICA/PCA via the MIPReSt algorithm.  See
A. Akkalkotkar and K. S. Brown, "An algorithm for separation of mixed sparse and Gaussian sources",
Plos ONE, 12(4) e0175775. This package depends on the following additional packages (in addition to
standard stuff like numpy, scipy, etc.), all available and actively maintained at github.com/thelahunginjeet:

pycar
pyica

If you use:

pip install -r requirements.txt

These packages will be installed automatically when miprest is installed.

Example usage of the entire pipeline (data to decompose should be in an Nmixtures x Nsamples matrix X):

# import necessary modules
>>from miprest import miprest,plotting,stopping,pca

# initializes with default options (default directory location and options for ica)
>>mip = MIPReSt() # uses default options

# you can run the parent and decimated decompositions in either order
# this block will run 100 2-fold decimations of the input data
>>mip.parent_decomposition(X)
>>mip.decimated_decomposition(X,dfactor=2,ndec=100)

# if you haven't run BOTH decimations, this function will print an error and return (None,None)
>>R,deltaij = mip.compute_R_delta() # works on stored reproducibility data

# make the R-delta plot and inspect it to determine nsparse
>>fig = plotting.plot_R_delta(R,deltaij)
>>fig.show()

At this point, you should have inspected the R/delta plot and be able to determine
the dimension of the sparse subspace, which I will call nsparse in what follows.

# project out the sparse subspace
>>Xtilde = mip.project_sparse(X,nsparse)

# to harvest the sparse signals, use
>>Asparse,Ssparse = mip.return_sparse(nsparse)

# eigenvalue stopping rules can tell you the dimension of the Gaussian subspace
# there are many rules to choose from (see stopping.py); I'm using broken stick here.
>>stop = stopping.StoppingRule(Xtilde)
>>ng = stop.broken_stick()

# finally, you can construct a basis for the Gaussian subspace (and the 'signals')
# via principal components
>>W,S = pca.pca(Xtilde,ng) # PCA on the matrix of Gaussian components

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.