pca()

Description:

Perform PCA on a matrix and return data for dimensionality reduction

Syntax:

pca(A,n)  Perform PCA (Principal Component Analysis) on matrix A and return data for dimensionality reduction; n is the number of principal components

pca(A,F)  Reduce dimensionality for another matrix having same number of columns

Parameters:

A

A matrix

n

Number of principal components

F

The PCA fiiting object returned by pca(A,n)

Options:

@r

Enable returning the result of demenionality reduction on matrix A, which is a matrix of n columns, directly

Return value:

A PCA fitting object or a sequence

Example:

 

A

 

1

[[1,2,3,4],[2,3,1,2],[1,1,1,-1],[1,0,-2,-6]]

 

2

=pca(A1,2)

3

=pca@r(A1,2)

4

[[4,6,2,4],[2,3,1,2],[1,1,1,-1]]

 

5

=pca(A4,A2)