Machine Learning, Data Science, Healthcare, Biology.
terms, as a function of the number of clusters. ks = range(1, 10) inertias = [] for k in ks: # Create a KMeans instance with k clusters: model model = KMeans(n_clusters=k) # Fit model to samples model.fit(PCA_components.iloc[:,:3]) # Append the inertia to the list of inertias