marytts.util.math

Class PCA

• ```public class PCA
extends Object```
Principal component analysis solve PCA using eigenvectors decomposion and singular value decomposition (SVD). Ref: Jonathon Shlens, "A tutorial on principal component analysis", (Dated: April 22, 2009; Version 3.01) http://www.snl.salk.edu/~shlens/pca.pdf
Author:
marcela
• Constructor Summary

Constructors
Constructor and Description
`PCA()`
• Method Summary

Methods
Modifier and Type Method and Description
`void` ```eigenPCA(Jama.Matrix data, boolean scale, boolean debug)```
Solving PCA using eigenvector decomposition
`double[][]` `getCovariance()`
`double[][]` ```getDataProjected(Jama.Matrix data, boolean debug)```
`double[]` `getImportanceOfComponents()`
`double` `getImportanceOfComponents(int numPC)`
`double[][]` `getPC()`
`double[]` `getV()`
`static void` `main(String[] args)`
`void` ```principalComponentAnalysis(String fileName, boolean eigen, boolean scale)```
PCA
`void` ```principalComponentAnalysis(Vector<Double> data, int rows, int cols, boolean eigen, boolean scale)```
perform principal component analysis
`void` `printImportanceOfComponents()`
`void` `printPricipalComponents()`
`void` ```printPricipalComponents(String[] factors, int numPCA)```
`void` `printPricipalComponents(Vector<String> factors)`
`void` ```svdPCA(Jama.Matrix data, boolean scale, boolean debug)```
Solving PCA using singular value decomposition (SVD) (more general solution)
• Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`
• Constructor Detail

• PCA

`public PCA()`
• Method Detail

• getCovariance

`public double[][] getCovariance()`
• getV

`public double[] getV()`
• getPC

`public double[][] getPC()`
• getDataProjected

```public double[][] getDataProjected(Jama.Matrix data,
boolean debug)```
• printPricipalComponents

`public void printPricipalComponents()`
• printPricipalComponents

`public void printPricipalComponents(Vector<String> factors)`
• printPricipalComponents

```public void printPricipalComponents(String[] factors,
int numPCA)```
Parameters:
`factors` - linguistic factors
`numPCA` - number of PC, between 1 and Max num PCs
• printImportanceOfComponents

`public void printImportanceOfComponents()`
• getImportanceOfComponents

`public double[] getImportanceOfComponents()`
• getImportanceOfComponents

`public double getImportanceOfComponents(int numPC)`
• principalComponentAnalysis

```public void principalComponentAnalysis(Vector<Double> data,
int rows,
int cols,
boolean eigen,
boolean scale)```
perform principal component analysis
Parameters:
`data` - a vector of doubles
`rows` - number of rows, trials or examples
`cols` - number of cols, dimensions or factors
`eigen` - if true use eigenvalues, if false use SVD (singular value decomposition)
`scale` - if true use znormalisation, if false just remove the mean from each dimension
• eigenPCA

```public void eigenPCA(Jama.Matrix data,
boolean scale,
boolean debug)```
Solving PCA using eigenvector decomposition
Parameters:
`data` - Matrix with M rows corresponding to dimensions or factors and N columns corresponding to trials or examples
`scale` - if true : applying zscore normalisation if false: just removing the mean
`debug` - debug
• svdPCA

```public void svdPCA(Jama.Matrix data,
boolean scale,
boolean debug)```
Solving PCA using singular value decomposition (SVD) (more general solution)
Parameters:
`data` - Matrix with M rows corresponding to dimensions or factors and N columns corresponding to trials or examples * @param scale if true : applying zscore normalisation if false: just removing the mean
`scale` - scale
`debug` - debug
• principalComponentAnalysis

```public void principalComponentAnalysis(String fileName,
boolean eigen,
boolean scale)```
PCA
Parameters:
`fileName` - data one column per dimension or linguistic factor
`eigen` - if true use eigenvalues, if false use svd (recomended)
`scale` - if true use z-normalisation (recomended), if false substract off the mean for ecah dimension
• main

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