- When you perform PCA using the "eig" algorithm, MATLAB computes the full eigenvalue decomposition of the data’s covariance matrix. This method produces a complete set of principal components, and the percentage of variance each component explains is calculated by dividing its corresponding eigenvalue by the sum of all eigenvalues. Even if you request only one component, the reported “explained” variance represents just that component’s fraction of the total variance present in the data.
- In contrast, the "als" algorithm takes an iterative approach to approximate your data with a low-rank model. When you specify a single component using "als", the algorithm finds the best one-dimensional approximation by minimizing reconstruction error. In doing so, it normalizes the variance within that approximation. As a result, because the model is forced to use only one component, it reports that this component accounts for 100% of the variance of the approximated data—even though it might not capture 100% of the total variance from the original dataset.
- Computes a full decomposition of the covariance matrix.
- Variance explained is based on the complete variance distribution across all components.
- The reported percentage for a single component shows its share relative to the total variance in the original data.
- Uses an iterative method to derive a low-rank approximation.
- When limited to one component, the algorithm normalizes the variance within the approximated subspace.
- It then reports that the single component explains 100% of the variance in that approximation, not the full data.
- pca: https://www.mathworks.com/help/stats/pca.html
- eig: https://www.mathworks.com/help/matlab/ref/eig.html
