Skip to content

Instantly share code, notes, and snippets.

@e-alizadeh
Created December 29, 2020 03:55
Show Gist options
  • Save e-alizadeh/30b94a5e0e265cd1d431f614e660a391 to your computer and use it in GitHub Desktop.
Save e-alizadeh/30b94a5e0e265cd1d431f614e660a391 to your computer and use it in GitHub Desktop.
Plot a PCA correlation circle
from mlxtend.plotting import plot_pca_correlation_graph
from sklearn.preprocessing import StandardScaler
X_norm = StandardScaler().fit_transform(X) # Normalizing the feature columns is recommended (X - mean) / std
fig, correlation_matrix = plot_pca_correlation_graph(
X_norm,
attribute_names,
dimensions=(1, 2),
figure_axis_size=6
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment