Explained variance

Explained variance indicates the share of the total variability of the data carried by each principal component. Its cumulative sum helps choose the number of components to keep, for example those covering 90 or 95% of the variance. It is available through the explained_variance_ratio_ attribute.

Example

PCA().fit(X_s).explained_variance_ratio_.cumsum()

Related concepts

The whole glossary