Skip to Content
Practical Data Analysis Cookbook
book

Practical Data Analysis Cookbook

by Tomasz Drabas
April 2016
Beginner to intermediate content levelBeginner to intermediate
384 pages
8h 36m
English
Packt Publishing
Content preview from Practical Data Analysis Cookbook

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 ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Python Data Analysis Cookbook

Python Data Analysis Cookbook

Ivan Idris
Practical Simulations for Machine Learning

Practical Simulations for Machine Learning

Paris Buttfield-Addison, Mars Buttfield-Addison, Tim Nugent, Jon Manning

Publisher Resources

ISBN: 9781783551668Supplemental Content