Choose PCA Components by Explained Variance

easy
Unit 7 · Interpretability I0/5 to milestone

Implement components_for_variance(X, threshold): centre X, compute the explained-variance ratio of each principal component (via SVD), and return the smallest number of components whose cumulative ratio is at least threshold.

Also implement explained_variance_ratio(X) returning the full ratio array (sorted descending, summing to 1).

#dimensionality-reduction#pca2 visible + 1 hidden tests
solution.py · Python 3.13
Loading editor…
Run your code to see results. ⌘↵ to run · ⌘⇧↵ to submit
Choose PCA Components by Explained Variance · TechGradify