Matlab comes with Princomp (PCA dimensionality reduction method)

Source: Internet
Author: User

There is no doubt about the function that comes with MATLAB.

Princomp:principal componet Analysis (PCA).

[Coeff,score,latent,tsquare]=princomp (X);

Parameters:

%%%%%%%%%%%%%%%%%%

INPUT:X is the data: N*p, where n is the number of samples and P represents the feature dimension

%%%%%%%%%%%%%%%%%%

OUTPUT:

Coeff: Covariance p*p, projection matrix

Score: The data after the projection. If the number of Samples <= the feature dimension, there is an interesting

Phenomenon: Score (:, n:p), latent (n:p) are zero. Why is it? Please use a total of two

Data points as an example. That is n=2,p=3; when a projection axis is selected, select a

Orthogonal pumping, found that no matter how to choose, they will overlap after projection, that is, 0.

Latent: After the calculation is not the weight of the principal component normalization. If necessary, use the following code:

Cumsum (latent)./sum (latent);

It is important to note that:

The covariance matrix is calculated from the training sample. If we come up with a test set, we can't go back to

Computes a covariance matrix. Because that would cause the training set and the test set to be projected into different spaces,

The resulting feature space is inconsistent and the trained parameters are meaningless.

Matlab comes with Princomp (PCA dimensionality reduction method)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.