We may find the optimal number of clusters by using K-means algorithm and observing the Elbow graph.
import numpy as np
from sklearn.cluster import KMeans
import matplotlib.pyplot as plt
clusters = np.load("example.npy")
# specify the range of the number of clusters
K = range(1, 10)
distortions = []
for i in K:
kmeans = KMeans(n_clusters=i)
kmeans.fit(clusters)
distortions.append(kmeans.inertia_)
plt.plot(K, distortions)
plt.xlabel("Number of clusters")
plt.ylabel("Distortion")
Seeing the output graph, the last point where the distortion (or inertia) drops sharply may be the optimal number of clusters.