Mobios v0.91

mobios.index.algorithms
Class PCA

java.lang.Object
  extended by mobios.index.algorithms.PCA

public class PCA
extends Object

Do the Principal Component Analysis (PCA), using the Colt library. PCA no longer supports ShiftSize

Version:
2006.06.23
Author:
Rui Mao

Constructor Summary
PCA()
           
 
Method Summary
static void main(String[] args)
           
static cern.colt.matrix.DoubleMatrix2D pairWiseDistance(Metric metric, List<? extends IndexObject> data)
           
static int[] pivotSelection(Metric metric, List<? extends IndexObject> data, int numPC, int eachPC, boolean print)
          pivot selection by PCA
static int[] pivotSelection(Metric metric, List<? extends IndexObject> data, int numPC, int eachPC, boolean print, double[] eigenValue)
          pivot selection by PCA
static int[] pivotSelectionByPCAResultAngle(cern.colt.matrix.DoubleMatrix2D pcaResult, int numP)
          pivot selection based on the result of PCA.
static int[] pivotSelectionByPCAResultProjection(cern.colt.matrix.DoubleMatrix2D data, cern.colt.matrix.DoubleMatrix2D pcaResult, int numPC, int numP)
          Pivot selection based on the result of PCA.
static cern.colt.matrix.linalg.EigenvalueDecomposition runPCA(cern.colt.matrix.DoubleMatrix2D matrix)
           
static cern.colt.matrix.linalg.EigenvalueDecomposition runPCA(cern.colt.matrix.DoubleMatrix2D matrix, boolean print)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PCA

public PCA()
Method Detail

runPCA

public static cern.colt.matrix.linalg.EigenvalueDecomposition runPCA(cern.colt.matrix.DoubleMatrix2D matrix)

runPCA

public static cern.colt.matrix.linalg.EigenvalueDecomposition runPCA(cern.colt.matrix.DoubleMatrix2D matrix,
                                                                     boolean print)

pairWiseDistance

public static cern.colt.matrix.DoubleMatrix2D pairWiseDistance(Metric metric,
                                                               List<? extends IndexObject> data)

pivotSelectionByPCAResultAngle

public static int[] pivotSelectionByPCAResultAngle(cern.colt.matrix.DoubleMatrix2D pcaResult,
                                                   int numP)
pivot selection based on the result of PCA. Select some of the axes as piovts, no duplicate axes will be selected. It is the user's reponsibility to guarantee that each axis is different from others. Method: relate pc to axes. Start from the 1st axis of each pc, then 2st, until enough number pivots are selected.

Parameters:
pcaResult - PCA result: A DoubleMatrix2D of size [pcNum x (dim +1)], the first column is the variance of each PC in descending order. The remain of each row is a PC
numP - number of pivots to select, should not be greater than the number of columns (dim) of the input PCA result matrix.
Returns:
an int array of column indecies of the pivots in the input data array.

pivotSelectionByPCAResultProjection

public static int[] pivotSelectionByPCAResultProjection(cern.colt.matrix.DoubleMatrix2D data,
                                                        cern.colt.matrix.DoubleMatrix2D pcaResult,
                                                        int numPC,
                                                        int numP)
Pivot selection based on the result of PCA. select the points that are close (large projection) to the PCs. start from the 1st closest points to the given number of largest PCs, then the 2nd, then the 3rd,until required number of points are selected.

Parameters:
data - the data set, each row is a point. Since the PCs are from the origin, the data should already be centerized.
pcaResult - PCA result: A DoubleMatrix2D of size [pcNum x (dim +1)], the first column is the variance (eigenvalue) of each PC in descending order. The remain of each row is a PC
numPC - the number of largest PCs to consider
numP - number of pivots to select, should not be greater than the number of columns (dim) of the input PCA result matrix.
Returns:
an int array of row indecies of the pivots in the input data matrix. At most numP pivots will be returned, probably less.

pivotSelection

public static int[] pivotSelection(Metric metric,
                                   List<? extends IndexObject> data,
                                   int numPC,
                                   int eachPC,
                                   boolean print)
pivot selection by PCA

Parameters:
metric -
data -
numPC - how many Principal Components to check
eachPC - from each PC, how many pivots will be selected by each method. two methods now.
print - whether to print debug information
Returns:
an int array of offsets of the pivots in the input data array.

pivotSelection

public static int[] pivotSelection(Metric metric,
                                   List<? extends IndexObject> data,
                                   int numPC,
                                   int eachPC,
                                   boolean print,
                                   double[] eigenValue)
pivot selection by PCA

Parameters:
metric -
data -
numPC - how many Principal Components to check
eachPC - from each PC, how many pivots will be selected by each method. two methods now.
print - whether to print debug information
eigenValue - an array to store the sums of eigenvalues
Returns:
an int array of offsets of the pivots in the input data array.

main

public static void main(String[] args)
                 throws Exception
Throws:
Exception

Mobios v0.91

(C) 2002 - 2006 The MoBIoS Group