Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Created March 15, 2021 07:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save amankharwal/8bff217ffecf20ba6177624f2ff013d8 to your computer and use it in GitHub Desktop.
Save amankharwal/8bff217ffecf20ba6177624f2ff013d8 to your computer and use it in GitHub Desktop.
from sklearn.cluster import Birch
model = Birch(branching_factor=30, n_clusters=5, threshold=2.5)
model.fit(data)
pred = model.predict(data)
plt.scatter(data["Income"], data["Spending"], c=pred, cmap='rainbow', alpha=0.5, edgecolors='b')
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment