clustering algorithms mean shift algorithm introduction to mean-shift algorithm as discussed earlierit is another powerful clustering algorithm used in unsupervised learning unlike -means clusteringit does not make any assumptionshence it is nonparametric algorithm mean-shift algorithm basically assigns the datapoints to the clusters iteratively by shifting points towards the highest density of datapoints cluster centroid the difference between -means algorithm and mean-shift is that later one does not need to specify the number of clusters in advance because the number of clusters will be determined by the algorithm data working of mean-shift algorithm we can understand the working of mean-shift clustering algorithm with the help of following stepsstep firststart with the data points assigned to cluster of their own step nextthis algorithm will compute the centroids step in this steplocation of new centroids will be updated step nowthe process will be iterated and moved to the higher density region step at lastit will be stopped once the centroids reach at position from where it cannot move further implementation in python it is simple example to understand how mean-shift algorithm works in this examplewe are going to first generate dataset containing different blobs and after that will apply mean-shift algorithm to see the result %matplotlib inline import numpy as np from sklearn cluster import meanshift import matplotlib pyplot as plt from matplotlib import style style use("ggplot"from sklearn datasets samples_generator import make_blobs centers [[ , , ],[ , , ],[ , , ]x_ make_blobs(n_samples centers centerscluster_std