O'Reilly logo

Practical Predictive Analytics by Ralph Winters

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

The k-means algorithm

The k-means algorithm is based upon an iterative process.

First, we decide how many clusters we desire. The number of clusters can be determined by a number of methods, but bear in mind that there is really no correct number of clusters. Typically, between 3 and 20 clusters can be used as a range.

As an initial step, cluster members are randomly assigned to one of the three clusters that have been specified. In the following example, we have 12 observations (in gray), and three centroids (solid colors) which have been randomly generated. For this example lets make believe we have only two variables, lets say there were age, and height. We will represent them on an x and y axis but we wont label them:

The next step is ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required