Class PCAModel

Object
org.apache.spark.mllib.feature.PCAModel
All Implemented Interfaces:
Serializable, VectorTransformer

public class PCAModel extends Object implements VectorTransformer
Model fitted by PCA that can project vectors to a low-dimensional space using PCA.

param: k number of principal components. param: pc a principal components Matrix. Each column is one principal component.

See Also:
  • Method Details

    • explainedVariance

      public DenseVector explainedVariance()
    • k

      public int k()
    • pc

      public DenseMatrix pc()
    • transform

      public Vector transform(Vector vector)
      Transform a vector by computed Principal Components.

      Specified by:
      transform in interface VectorTransformer
      Parameters:
      vector - vector to be transformed. Vector must be the same length as the source vectors given to PCA.fit().
      Returns:
      transformed vector. Vector will be of length k.