Skip to content

Instantly share code, notes, and snippets.

@gabriellm1
Last active November 23, 2020 20:17
Show Gist options
  • Save gabriellm1/073cda99fc9eda355d36c3008cfbdc8f to your computer and use it in GitHub Desktop.
Save gabriellm1/073cda99fc9eda355d36c3008cfbdc8f to your computer and use it in GitHub Desktop.
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