PCA

Trains a model to project vectors to a low-dimensional space using PCA.

This operation is ported from Spark ML.

For a comprehensive introduction, see Spark documentation.

For scala docs details, see org.apache.spark.ml.feature.PCA documentation.

Since: Seahorse 1.0.0

Input

Port Type Qualifier Description
0DataFrameThe input DataFrame.

Output

Port Type Qualifier Description
0DataFrameThe output DataFrame.
1TransformerA Transformer that allows to apply the operation on other DataFrames using a Transform.

Parameters

Name Type Description
input column SingleColumnSelector The input column name.
output SingleChoice Output generation mode. Possible values: ["replace input column", "append new column"]
k Numeric The number of principal components.

Example

Parameters

Name Value
input column "features"
output append new column
output column "pca_features"
k 3.0

Input

features
[0.0,1.0,0.0,7.0,0.0]
[2.0,0.0,3.0,4.0,5.0]
[4.0,0.0,0.0,6.0,7.0]

Output

features pca_features
[0.0,1.0,0.0,7.0,0.0] [1.6485728230883807,-4.013282700516296,-5.524543751369388]
[2.0,0.0,3.0,4.0,5.0] [-4.645104331781534,-1.1167972663619026,-5.524543751369387]
[4.0,0.0,0.0,6.0,7.0] [-6.428880535676489,-5.337951427775355,-5.524543751369389]