Discovering clusters with mean shift clustering model

A method similar in terms of finding centers (or maxima of density) is the Mean Shift model. In contrast to the k-means, the method does not require specifying the number of clusters—the model returns the number of clusters based on the number of density centers found in the data.

Getting ready

To estimate this model, you will need pandas and Scikit. No other prerequisites are required.

How to do it…

We start the estimation in a similar way as with the previous models—by reading the dataset in and limiting the number of features. Then, we use findClusters_meanShift(...) to estimate the model (the clustering_meanShift.py file):

def findClusters_meanShift(data): ''' Cluster data using Mean Shift method ...

Get Practical Data Analysis Cookbook now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.