In this chapter, we're gonna look at a number of clustering algorithms and compare how they perform on a few different datasets. So the datasets that we're going to use to compare the various clustering algorithms have some interesting properties and so what we wanna do is see how the various algorithms do in all of these different kinds of situations. So, the first one we're gonna look at is essentially two concentric circles. So, probably if we were wanting to cluster this dataset, we probably would want to have each circle cluster together. The second one is similar, it's two moons and so, again, we probably want to cluster each of those moons together. The third one is essentially three blobs and each of them has a different variance. You can see the one in the middle is quite a bit more spread out compared to the other two that are a lot more compact. The other thing that's interesting about this dataset is that they aren't separated like they are in the other dataset examples. Third one is three cigars, so instead of having sort of circular type blob in the dataset, we have these sort of elongated shapes. The third one is just three, quite compact blobs. And then the final one is essentially random noise, so there's no pattern to this final dataset. Okay, so, let's start with mini-batch K-means. we know a little bit already about the K-means algorithm. A way to make it faster is instead of classifying each row of data, every time that the centroids are updated, instead, you can take a sample of the data and update the centroid based on that. So, it's a huge time saver when you are using a large dataset in your clustering problem, although there is a difference between the regular K-means and the mini-batch K-means, it's really sort of quite a slight difference, and so, in the case where you have a large dataset using something like the mini-batch K-means can be really valuable. Here we're going to go into Python and we're going to run this algorithm. So, you can see that I have here, the code is drawing all of these six datasets that we're going to use for the classification and now what I wanna do is three different things. So, first, I want to create my object for running the K-means. Next, I want to fit the data. And then finally, I want to graph the cluster outcomes from the data so that we can see how it works on the different datasets. Okay, so let's see how this works. You can see that our mini-batch K-means does well on our three blobs dataset, but that's really the only one that is classifying in the way that we might want. But remember that K-means looks at the regions around the centroids and so, instead of finding the connected patterns within there, it's looking at which ones are close together within a region and ignoring places where there is a sparsity of data. So you can see it's not finding any of the patterns, in the two circles, for example, it's not finding the patterns with the three cigars and it's only really finding the pattern in the two moons dataset because they are sort of somewhat separated in space already so, it's really sort of a false so-so result in that one. The other thing to definitely notice is that even when we have the three unequal blobs, it's doing a reasonable job of finding those three clusters, but you can see that in the case of the orange cluster, it sort of bleeding into that large middle cluster. So that's something that you should definitely keep in mind when you're using K-means is that it doesn't look at places where the data is sparse in order to form the cluster. It only uses those centroids in order to determine where the clusters start and end and for that reason, you can get a little bit of strange things happening on sort of the outside of those clusters. So now you should have an idea of how mini-batch K-means can work on a few of our example datasets, places where works well and places where it doesn't work as well.