Skip to content

Instantly share code, notes, and snippets.

@amankharwal
Last active August 11, 2021 07:41
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/7265ad36d34284bb6d08208372ba715e to your computer and use it in GitHub Desktop.
Save amankharwal/7265ad36d34284bb6d08208372ba715e to your computer and use it in GitHub Desktop.
from sklearn.cluster import AgglomerativeClustering
model = AgglomerativeClustering()
model.fit(data)
pred = model.fit_predict(data)
plt.style.use('seaborn-whitegrid')
plt.figure(figsize=(12, 10))
plt.scatter(data["Income"], data["Spending"], c=pred, cmap='rainbow', alpha=0.9)
plt.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment