h2o (version 2.8.4.4)

h2o.prcomp: Principal Components Analysis

Description

Performs principal components analysis on the given data set.

Usage

h2o.prcomp(data, tol = 0, cols = "", max_pc = 5000, key = "", standardize = TRUE, 
retx = FALSE)

Arguments

data
An H2OParsedData object on which to run principal components analysis.
tol
(Optional) A value indicating the magnitude below which components should be omitted. (Components are omitted if their standard deviations are less than or equal to tol times the standard deviation of the first component.) With the default setting t
max_pc
Integer value denoting the number of principle components returned in the output as a R data frame. By default all of the components up to 5000 components will be shown but for much larger number of components it's best to show a subset.
cols
(Optional) A vector of column names or indices indicating the features to perform PCA on. By default, all columns in the dataset are analyzed.
key
(Optional) The unique hex key assigned to the resulting model. If none is given, a key will automatically be generated.
standardize
(Optional) A logical value indicating whether the variables should be shifted to be zero centered and scaled to have unit variance before the analysis takes place.
retx
(Optional) A logical value indicating whether the rotated variables should be returned.

Value

  • An object of class H2OPCAModel with slots key, data, and model, where the last is a list of the following components:
  • standardizedA logical value indicating whether the data was centered and scaled.
  • sdevThe standard deviations of the principal components (i.e., the square roots of the eigenvalues of the covariance/correlation matrix).
  • rotationThe matrix of variable loadings (i.e., a matrix whose columns contain the eigenvectors).

Details

The calculation is done by a singular value decomposition of the (possibly standardized) data set.

See Also

h2o.pcr

Examples

Run this code
library(h2o)
localH2O = h2o.init()
ausPath = system.file("extdata", "australia.csv", package="h2o")
australia.hex = h2o.importFile(localH2O, path = ausPath)
australia.pca = h2o.prcomp(data = australia.hex, standardize = TRUE)
print(australia.pca)

Run the code above in your browser using DataLab