How to evaluate the K-Modes Clusters? K-modes algorithm is available here

I want to do clustering of my binary dataset. I need to specify the number of clusters that I need as an output:

KModes (n_clusters, init, n_init, verbose)


My dataset contains 1000 lines and 1000 rows, I want to calculate the distance between my clusters in order to know the exact number of cluster that I need to choose. I don't know how to compare between them. Probably I want to use the hamming distance because it is the most suitable distance to compare between binary data.

Any recommendations that you can give are welcomed.
The are some techniques to choose the number of clusters K.

The most common ones are The Elbow Method and The Silhouette Method.

Elbow Method

In this method, you calculate a score function with different values for K. You can use the Hamming distance like you proposed, or other scores, like dispersion.

Then, you plot them and where the function creates "an elbow" you choose the value for K.



Silhouette Method

This method measure the distance from points in one cluster to the other clusters. Then visually you have silhouette plots that let you choose K.

Observe:

K=2, silhouette of similar heights but with different sizes. So, potential candidate.


K=3, silhouettes of different heights. So, bad candidate.


K=4, silhouette of similar heights and sizes. Best candidate.