this is showing an example of -means clustering with of threeand the squares represent data points in scatter plot the circles represent the centroids that the -means clustering algorithm came up withand each point is assigned cluster based on which centroid it' closest to so that' all there is to itreally it' an example of unsupervised learning it isn' case where we have bunch of data and we already know the correct cluster for given set of training dataratheryou're just given the data itself and it tries to converge on these clusters naturally just based on the attributes of the data alone it' also an example where you are trying to find clusters or categorizations that you didn' even know were there as with most unsupervised learning techniquesthe point is to find latent valuesthings you didn' really realize were there until the algorithm showed them to you for examplewhere do millionaires livei don' knowmaybe there is some interesting geographical cluster where rich people tend to liveand -means clustering could help you figure that out maybe don' really know if today' genres of music are meaningful what does it mean to be alternative these daysnot muchrightbut by using -means clustering on attributes of songsmaybe could find interesting clusters of songs that are related to each other and come up with new names for what those clusters represent or maybe can look at demographic dataand maybe existing stereotypes are no longer useful maybe hispanic has lost its meaning and there' actually other attributes that define groups of peoplefor examplethat could uncover with clustering sounds fancydoesn' itreally complicated stuff unsupervised machine learning with clustersit sounds fancybut as with most techniques in data scienceit' actually very simple idea here' the algorithm for us in plain english randomly pick centroids ( -means)we start off with randomly chosen set of centroids so if we have of three we're going to look for three clusters in our groupand we will assign three randomly positioned centroids in our scatter plot assign each data point to the centroid it is closest towe then assign each data point to the randomly assigned centroid that it is closest to recompute the centroids based on the average position of each centroid' pointsthen recompute the centroid for each cluster that we come up with that isfor given cluster that we end up withwe will move that centroid to be the actual center of all those points iterate until points stop changing assignment to centroidswe will do it all again until those centroids stop movingwe hit some threshold value that says okwe have converged on something here predict the cluster for new pointsto predict the clusters for new points that haven' seen beforewe can just go through our centroid locations and figure out which centroid it' closest to to predict its cluster