bsoipca: Block Stochastic Orthononal Iteration (BSOI)

Description Usage Arguments Details Value References Examples

Description

The online PCA algorithm of Mitliagkas et al. (2013) is a block-wise stochastic variant of the classical power-method.

Usage

1
bsoipca(x, q, U, B, center, byrow = FALSE)

Arguments

x

data matrix.

q

number of PC to compute.

U

matrix of initial PCs in columns (optional).

B

size of block updates (optional).

center

centering vector (optional).

byrow

are the data vectors in x stored in rows (TRUE) or columns (FALSE)?

Details

The default value of B is floor(n/nblock) with n the number of data vectors in x, d the number of variables, and nblock=ceiling(log(d)) the number of blocks.
If U is specified, q defaults to ncol(U); otherwise the initial PCs are computed from the first block of data and q must be specified explicitly.
Although the algorithm does not give eigenvalues, they can easily be estimated by computing the variance of the data along the PCs.

Value

A matrix with the q first eigenvectors/PCs in columns.

References

Mitliagkas et al. (2013). Memory limited, streaming PCA. Advances in Neural Information Processing Systems.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
## Simulate Brownian Motion
n <- 100 # number of sample paths
d <- 50 # number of observation points
x <- matrix(rnorm(n*d,sd=1/sqrt(d)),n,d)
x <- t(apply(x,1,cumsum)) # dim(x) = c(100,50)

q <- 10 # number of PC to compute
B <- 20 # block size

## BSOI PCA 
U <- bsoipca(x, q, B=B, byrow=TRUE) # PCs
lambda <- apply(x %*% U, 2, var) # eigenvalues 


Search within the onlinePCA package
Search all R packages, documentation and source code

Questions? Problems? Suggestions? or email at ian@mutexlabs.com.

Please suggest features or report bugs with the GitHub issue tracker.

All documentation is copyright its authors; we didn't write any of that.