Explained Variance Ratio for PCA

Decomposition & Spectral Methods DS practice problem on Onlearn.

Difficulty: medium.

Topics: Understanding Dimensionality Reduction and Principal Component Analysis, Spectral Decomposition, Variance Normalization, Singular Value Decomposition, Feature Scaling, Orthogonal Projection, Linear Algebra, Statistical Analysis, Matrix Decomposition, Feature Engineering, Multivariate Statistics, Covariance Matrix, Eigenvalues and Eigenvectors, Principal Component Analysis, Dimensionality Reduction, Data Centering.

Given a standardized numerical dataset (represented as a 2D numpy array), write a function that calculates the explained variance ratio for each principal component. The explained variance ratio represents the proportion of the dataset's total variance that lies along the axis of each principal component.