-
-
Save aialenti/41071139ac320bc76154759a8f884788 to your computer and use it in GitHub Desktop.
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 pandas as pd | |
#import matplotlib | |
cluster_centers = clust.cluster_centers_ | |
cluster_centers_rgb = cluster_centers * 255 | |
# Save the prototypes in HSV color space for sorting | |
cluster_centers_hsv = matplotlib.colors.rgb_to_hsv(cluster_centers) | |
clusters_centers_df = pd.DataFrame() | |
# Save HSV | |
clusters_centers_df['H'] = cluster_centers_hsv[:, 0] | |
clusters_centers_df['S'] = cluster_centers_hsv[:, 1] | |
clusters_centers_df['V'] = cluster_centers_hsv[:, 2] | |
# Save RGB | |
clusters_centers_df['R'] = cluster_centers_rgb[:, 0].astype(np.int) | |
clusters_centers_df['G'] = cluster_centers_rgb[:, 1].astype(np.int) | |
clusters_centers_df['B'] = cluster_centers_rgb[:, 2].astype(np.int) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment