Neural Network Toolbox |
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
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.
p=[-1.5 -0.58 0.21 -0.96 -0.79; -2.2 -0.87 0.31 -1.4 -1.2]; [pn,meanp,stdp] = prestd(p); [ptrans,transMat] = prepca(pn,0.02);
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
References
Jolliffe, I.T., Principal Component Analysis, New York: Springer-Verlag, 1986.
premnmx | prestd |
© 1994-2005 The MathWorks, Inc.