The downside to using PCA to visualize your data is that some variance will likely be removed. To help get a sense for the integrity of your low dimensional visualizations, we built the describe_pca function, which computes the covariance (samples by samples) of both the raw and reduced datasets, and plots their correlation. The function repeats this analysis from 2:N dimensions until the correlation reaches a local maximum. Often times this will be less than the total number of dimensions because the PCA model is whitened.
# Code source: Andrew Heusser
# License: MIT
# import
import hypertools as hyp
import numpy as np
# load example data
data = hyp.tools.load('weights_sample')
# plot
hyp.tools.describe_pca(data)
Total running time of the script: ( 0 minutes 6.870 seconds)