Knn traza los clústeres
clusters = range(1, 10)
inertias = []
for k in clusters:
# Create a KMeans model
model = KMean(n_clusters)
# Fit model to data
model.fit(data)
# Append the inertia to the list of inertias
inertias.append(model.inertia_)
# Plot clusters vs inertias
plt.plot(clusters, inertias, '-o')
plt.xlabel('number of clusters, k')
plt.ylabel('inertia')
plt.xticks(clusters)
plt.show()
Fancy Falcon