I am confused as I see different ways to implement the elbow method to identify the correct number of clusters in Kmean and they produce slightly different results.
One method is described here Sklearn kmeans equivalent of elbow method
and is using kmeans_inertia_
the other methos is described here https://pythonprogramminglanguage.com/kmeans-elbow-method/
and is using the following command.
distortions.append(sum(np.min(cdist(X, kmeanModel.cluster_centers_, 'euclidean'), axis=1)) / X.shape[0])
I am wondering what does Kmeans_inertia_ does ? and are both implementation correct ?