Neural Network Toolbox Previous page   Next Page
prepca

Principal component analysis

Syntax

[ptrans,transMat] = prepca(P,min_frac)

Description

prepca preprocesses the network input training set by applying a principal component analysis. This analysis transforms the input data so that the elements of the input vector set will be uncorrelated. In addition, the size of the input vectors may be reduced by retaining only those components which contribute more than a specified fraction (min_frac) of the total variation in the data set.

prepca(P,min_frac) takes these inputs

and returns

Examples

Here is the code to perform a principal component analysis and retain only those components that contribute more than two percent to the variance in the data set. prestd is called first to create zero mean data, which is needed for prepca.

Since the second row of p is almost a multiple of the first row, this example will produce a transformed data set that contains only one row.

Algorithm

This routine uses singular value decomposition to compute the principal components. The input vectors are multiplied by a matrix whose rows consist of the eigenvectors of the input covariance matrix. This produces transformed input vectors whose components are uncorrelated and ordered according to the magnitude of their variance.

Those components that contribute only a small amount to the total variance in the data set are eliminated. It is assumed that the input data set has already been normalized so that it has a zero mean. The function prestd can be used to normalize the data.

See Also

prestd, premnmx

References

Jolliffe, I.T., Principal Component Analysis, New York: Springer-Verlag, 1986.



Previous page  premnmx prestd Next page

© 1994-2005 The MathWorks, Inc.