score or cost function for AgglomerativeClustering
I am learning AgglomerativeClustering using sklearn. It is fairly easy to use for example:
# create clusters
hc = AgglomerativeClustering(n_clusters=10, affinity = 'euclidean', linkage = 'ward')
# save clusters for chart
y_hc = hc.fit_predict(points)
In my case,n_clusters is dynamic within a range, say from 9-15. I would like to run some cost function or score function, so I can plot a chart and then pick one there.
However, seems AgglomerativeClustering doesn't have a score function, unlike Kmeans, which I can either use inertia_ or score to plot.
So is there a way I can plot a chart and justify my n_clusters choice?
Topic scikit-learn clustering
Category Data Science