August 2018
Intermediate to advanced
522 pages
12h 45m
English
The first method we are going to consider is based on the assumption that an appropriate number of clusters must produce a small inertia. However, this value reaches its minimum (0.0) when the number of clusters is equal to the number of samples. Therefore, we can't look for the minimum, but for a value that is a trade-off between the inertia and a reasonable number of clusters.
Let's suppose we have a dataset of 1,000 elements (such as the one employed in the previous example):
nb_samples = 1000X, _ = make_blobs(n_samples=nb_samples, n_features=2, centers=3, cluster_std=1.5, random_state=1000)
We can compute and collect the inertias (scikit-learn stores these values in the inertia_ instance variable) for a different ...
Read now
Unlock full access