Learn R Programming

h2o (version 2.4.3.11)

h2o.prcomp: Principal Components Analysis

Description

Performs principal components analysis on the given data set.

Usage

h2o.prcomp(data, tol = 0, cols = "", 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
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.
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(ip = "localhost", port = 54321, startH2O = TRUE)
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