The clustering methods in scikit-learn have a nice congruent usage that, for the most part, matches the following pseudocode across all the algorithms:
### this is pseudocode. it will not execute ###
# import module and instantiate method object
from sklearn.cluster import Method
clus = Method(args*)
# fit to input data
clus.fit(X_input)
# get cluster assignments of X_input
X_assigned = clus.labels_
The rest of this chapter will cover some common methods used for data clustering. The following is a group of plots comparing different cluster methods and how they assign data points into groups:
Take a minute to study the preceding "Comparing Cluster Methods" screenshot and look for any qualitative trends or patterns before reading the following sections. Your goal should be to read the rest of the chapter looking for validation of your qualitative pattern...