Last active
November 23, 2020 20:17
-
-
Save gabriellm1/073cda99fc9eda355d36c3008cfbdc8f 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
from sklearn.cluster import DBSCAN | |
db_default = DBSCAN(eps = 0.008, min_samples = 10).fit(df_principal) | |
labels = db_default.labels_ | |
colours = {} | |
colours[0] = 'r' | |
colours[1] = 'g' | |
colours[2] = 'b' | |
colours[3] = 'y' | |
colours[4] = 'c' | |
colours[5] = 'm' | |
colours[6] = 'tab:pink' | |
colours[7] = 'tab:orange' | |
colours[8] = 'tab:olive' | |
colours[9] = 'tab:brown' | |
colours[-1] = 'k' | |
cvec = [colours[label] for label in labels] | |
plt.scatter(df_principal['P1'], df_principal['P2'], c = cvec) | |
plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment