Book Image

Artificial Intelligence and Machine Learning Fundamentals

By : Zsolt Nagy
Book Image

Artificial Intelligence and Machine Learning Fundamentals

By: Zsolt Nagy

Overview of this book

Machine learning and neural networks are pillars on which you can build intelligent applications. Artificial Intelligence and Machine Learning Fundamentals begins by introducing you to Python and discussing AI search algorithms. You will cover in-depth mathematical topics, such as regression and classification, illustrated by Python examples. As you make your way through the book, you will progress to advanced AI techniques and concepts, and work on real-life datasets to form decision trees and clusters. You will be introduced to neural networks, a powerful tool based on Moore's law. By the end of this book, you will be confident when it comes to building your own AI applications with your newly acquired skills!
Table of Contents (10 chapters)
Artificial Intelligence and Machine Learning Fundamentals
Preface

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 the moving points

Due to the nature of the k-means algorithm...