Kmeans Flashcards

1
Q

train a model with n clusters, using df ‘x’

A

kmeans = KMeans(n)

kmeans.fit(x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

see which cluster each data point in ‘x’ is assigned

A
identified_clusters = kmeans.fit_predict(x)
df['Cluster'] = identified_clusters
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

what is the measure to use to determine number of k? what is it called? What’s the code?

A

kmeans.inertia_

How well did you know this?
1
Not at all
2
3
4
5
Perfectly