I'm using PCA in the sklearn
python package, and I was wondering how to simply return how much variation each dimension in the data explains, in order. For example, the following code
data = [[3,1,5],[3,3,5],[4,6,4],[3,10,5],[3,8,4]]
pca_all = PCA()
l = pca_all.fit_transform(data)
print(pca_all.explained_variance_ratio_)
prints the following:
[0.96655579 0.02743557 0.00600865]
I assume this means that the dimension of the data which explains the most variation explains ~96.7% of that variation, the dimensions which explains the second most explains ~2.7%, etc. However, I want to return the percent variation explained in the same order as the dimensions in the data, like so:
[0.00600865 0.96655579 0.02743557]
since in the data, the second entry of each row varies the most, the first varies the least, etc. How can I return the percent variance explained in this order?