transformations
Class PCA

java.lang.Object
  extended by transformations.PCA

public class PCA
extends java.lang.Object


Field Summary
 double[] lambda
           
 double[][] pc
           
 
Constructor Summary
PCA()
           
 
Method Summary
 void computePCA(double[][] data)
          Compute the parameters for the principal components analysis (PCA).
 void computePCA(java.util.List<Sample> data)
          Compute the parameters for the principal components analysis (PCA).
 java.util.ArrayList<Sample> transform(java.util.ArrayList<Sample> in)
          Transform a list of samples using the pre-computed principal components.
 java.util.ArrayList<Sample> transform(java.util.ArrayList<Sample> in, int dim)
          Transform a list of samples using the pre-computed principal components and reduce the dimsions to the given number.
 double[] transform(double[] x)
          Transform a vector using the pre-computed principal components
 double[] transform(double[] x, int dim)
          Transform a vector using the pre-computed principal components and reduce the dimensions to the given number
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lambda

public double[] lambda

pc

public double[][] pc
Constructor Detail

PCA

public PCA()
Method Detail

computePCA

public void computePCA(double[][] data)
Compute the parameters for the principal components analysis (PCA). Note that this requires a prior mean normalization (@see Sample.meanSubstract).

Parameters:
data -

computePCA

public void computePCA(java.util.List<Sample> data)
Compute the parameters for the principal components analysis (PCA). Note that this requires a prior mean normalization (@see Sample.meanSubstract).

Parameters:
data -

transform

public java.util.ArrayList<Sample> transform(java.util.ArrayList<Sample> in)
Transform a list of samples using the pre-computed principal components.

Parameters:
in -
Returns:
new allocated list of (new) samples

transform

public java.util.ArrayList<Sample> transform(java.util.ArrayList<Sample> in,
                                             int dim)
Transform a list of samples using the pre-computed principal components and reduce the dimsions to the given number.

Parameters:
in -
dim - new (smaller) dimension of the samples
Returns:
new allocated list of (new) samples

transform

public double[] transform(double[] x)
Transform a vector using the pre-computed principal components

Parameters:
x -
Returns:
new allocated transformed vector

transform

public double[] transform(double[] x,
                          int dim)
Transform a vector using the pre-computed principal components and reduce the dimensions to the given number

Parameters:
x -
dim - new (smaller) dimension of the output vector
Returns:
new allocated transformed and reduced vector