PCA Explained Variance Ratio
~15 mincode completion
Implement explained_variance_ratio(X) returning the d ratios, largest first. Use np.linalg.eigvalsh, which is built for symmetric matrices.
Where this shows up
~15 min
••••••
3 employers weight this skill
2 big tech firms, 1 health and bio company. Top match scores 85.
Python
import numpy as np
def explained_variance_ratio(X):
"""
Share of total variance along each principal component.
Args:
X: array of shape (n, d), n >= 2
Returns:
array of shape (d,): eigenvalue ratios of the covariance, sorted descending
"""
# YOUR CODE HERE
pass