Created
November 23, 2020 08:09
-
-
Save yuyasugano/6e17ae53b59995d93ea10bfb7d5b201d to your computer and use it in GitHub Desktop.
3 ways to do dimensional reduction techniques in Scikit-learn
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import matplotlib.pyplot as pltf | |
fig = plt.figure(figsize=(8, 4)) | |
plt.imshow(pca.components_, interpolation = 'none', cmap = 'plasma') | |
feature_names = list(data.feature_names) | |
plt.gca().set_xticks(np.arange(-.5, len(feature_names))); | |
plt.gca().set_yticks(np.arange(0.5, 2)); | |
plt.gca().set_xticklabels(feature_names, rotation=90, ha='left', fontsize=12); | |
plt.gca().set_yticklabels(['First PC', 'Second PC'], va='bottom', fontsize=12); | |
plt.colorbar(orientation='horizontal', ticks=[pca.components_.min(), 0, | |
pca.components_.max()], pad=0.65); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment