Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Artificial Intelligence and Machine Learning Fundamentals

You're reading from   Artificial Intelligence and Machine Learning Fundamentals Develop real-world applications powered by the latest AI advances

Arrow left icon
Product type Paperback
Published in Dec 2018
Publisher
ISBN-13 9781789801651
Length 330 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Zsolt Nagy Zsolt Nagy
Author Profile Icon Zsolt Nagy
Zsolt Nagy
Arrow right icon
View More author details
Toc

The k-means Algorithm

The k-means algorithm is a flat clustering algorithm. It works as follows:

  • Set the value of K.
  • Choose K data points from the dataset that are initial centers of the individual clusters.
  • Calculate the distance of each data point to the chosen center points, and group each point in the cluster whose initial center is the closest to the data point.
  • Once all of the points are in one of the K clusters, calculate the center point of each cluster. This center point does not have to be an existing data point in the dataset; it is just an average.
  • Repeat this process of assigning each data point into the cluster that has a center closest to the data point. Repetition continues until the center points no longer move.

To make sure that the k-means algorithm terminates, we need the following:

  • A maximum level of tolerance when we exit in case the centroids move less than the tolerance value
  • A maximum number of repetitions of shifting...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $19.99/month. Cancel anytime
Banner background image