Factor Investing, Dimensionality Reduction, Sklearn, Python.
really trivial. It even takes care of mean centering for you: Explained Variance Ratio pca.explained_variance_ratio_ The first dimension explains about 53% of the variance, while the second explains about 11%. Choosing the Right Number of Dimensions. We could that set n_components= d and run PCA.