Documentation of 'jhplot.math.pca.PCA' Java class.
PCA
jhplot.math.pca

Class PCA



  • public final class PCA
    extends java.lang.Object
    The class responsible mainly for preparing the PCA transformation parameters based on training data and executing the actual transformation on test data.
    • Constructor Detail

      • PCA

        public PCA(Matrix data)
        Create the PCA transformation. Use the popular SVD method for internal calculations
        Parameters:
        data - data matrix used to compute the PCA transformation. Rows of the matrix are the instances/samples, columns are dimensions. It is assumed that the matrix is already centered.
      • PCA

        public PCA(Matrix data,
                   boolean center)
        Create the PCA transformation. Use the popular SVD method for internal calculations
        Parameters:
        data - data matrix used to compute the PCA transformation. Rows of the matrix are the instances/samples, columns are dimensions.
        center - should the data matrix be centered before doing the calculations?
      • PCA

        public PCA(Matrix data,
                   CovarianceMatrixEVDCalculator evdCalc)
        Create the PCA transformation.
        Parameters:
        data - data matrix used to compute the PCA transformation. Rows of the matrix are the instances/samples, columns are dimensions. It is assumed that the matrix is already centered.
        evdCalc - method of computing eigenvalue decomposition of data's covariance matrix
      • PCA

        public PCA(Matrix data,
                   CovarianceMatrixEVDCalculator evdCalc,
                   boolean center)
        Create the PCA transformation
        Parameters:
        data - data matrix used to compute the PCA transformation. Rows of the matrix are the instances/samples, columns are dimensions.
        evdCalc - method of computing eigenvalue decomposition of data's covariance matrix
        center - should the data matrix be centered before doing the calculations?
    • Method Detail

      • getEigenvectorsMatrix

        public Matrix getEigenvectorsMatrix()
        Returns:
        matrix where eigenvectors are placed in columns
      • getEigenvalue

        public double getEigenvalue(int dimNo)
        Get selected eigenvalue
        Parameters:
        dimNo - dimension number corresponding to given eigenvalue
      • getInputDimsNo

        public int getInputDimsNo()
        Get number of dimensions of the input vectors
      • getOutputDimsNo

        public int getOutputDimsNo()
        Get number of dimensions of the output vectors
      • transform

        public Matrix transform(Matrix data,
                                PCA.TransformationType type)
        Execute selected transformation on given data.
        Parameters:
        data - data to transform. Rows of the matrix are the instances/samples, columns are dimensions. If the original PCA data matrix was set to be centered, this matrix will also be centered using the same parameters.
        type - transformation to apply
        Returns:
        transformed data
      • belongsToGeneratedSubspace

        public boolean belongsToGeneratedSubspace(Matrix pt)
        Check if given point lies in PCA-generated subspace. If it does not, it means that the point doesn't belong to the transformation domain i.e. it is an outlier.
        Parameters:
        pt - point. If the original PCA data matrix was set to be centered, this point will also be centered using the same parameters.
        Returns:
        true iff the point lies on all principal axes
      • calculateCovarianceMatrix

        public static Matrix calculateCovarianceMatrix(Matrix data)
        Function for JUnit testing purposes only

DMelt 3.0 © DataMelt by jWork.ORG