Can you specify a rotation in h2o's PCA function?

17 Views Asked by At

I'm running PCA in h2o (R version) and was wondering whether it's possible to specify/apply a rotation (like oblimin or promax). I'm looking for the rotated loadings, and the reason I'm using h2o instead of other common packages for that (like "psych") is that my data set is huge (100000 columns) so I need to take advantage of h2o's nice parallel computing in Windows. The code I'm using currently is:

library(h2o)

h2o.init(nthreads=64)

x <- read.csv("file_with_100000_columns.csv")

for (i in 1:ncol(x)) {x[,i] <- as.factor(x[,i])}

x <- as.h2o(x)

mod <- h2o.prcomp(training_frame=x,k=5,use_all_factor_levels=TRUE)

Thanks!

1

There are 1 best solutions below

1
Wendy On

Currently PCA does not support any rotation. All it does is to decompose your datasets into factors and its corresponding coefficients in those factor directions.

Given a dataset A of m rows by n predictors (or coordinates), PCA will do the following

A = X*D where X is m by k, D is k by n and k < n.

I assume when you say you want to specify a rotation, you really wanted

A = Y*E where Y is m by k, E is k by n and E is given.

I believe you can solve the problem by doing the following: :

  1. you can use H2O PCA to find: A = X*D.
  2. given E, use any conventional software (Matlab, R, Octave or Python packages), you can find D = R * E (R = D * inverse(E)).
  3. Substitue into A=X * D in terms of R and E: A = X * R * E = (X*R)*E
  4. Set Y = X * R and you will get your desired answer A = Y*E.

Hope this helps.