Skip to content

Instantly share code, notes, and snippets.

@cast42
Created June 4, 2015 20:44
Show Gist options
  • Save cast42/20b991f5d04a8307075f to your computer and use it in GitHub Desktop.
Save cast42/20b991f5d04a8307075f to your computer and use it in GitHub Desktop.
Plot N clusters after PCA
# from https://github.com/ogrisel/parallel_ml_tutorial/blob/master/rendered_notebooks/05%20-%20Model%20Selection%20and%20Assessment.ipynb
from itertools import cycle
colors = ['b', 'g', 'r', 'c', 'm', 'y', 'k']
markers = ['+', 'o', '^', 'v', '<', '>', 'D', 'h', 's']
for i, c, m in zip(np.unique(y), cycle(colors), cycle(markers)):
plt.scatter(X_pca[y == i, 0], X_pca[y == i, 1],
c=c, marker=m, label=i, alpha=0.5)
_ = plt.legend(loc='best')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment