Book Image

The Applied Artificial Intelligence Workshop

By : Anthony So, William So, Zsolt Nagy
Book Image

The Applied Artificial Intelligence Workshop

By: Anthony So, William So, Zsolt Nagy

Overview of this book

You already know that artificial intelligence (AI) and machine learning (ML) are present in many of the tools you use in your daily routine. But do you want to be able to create your own AI and ML models and develop your skills in these domains to kickstart your AI career? The Applied Artificial Intelligence Workshop gets you started with applying AI with the help of practical exercises and useful examples, all put together cleverly to help you gain the skills to transform your career. The book begins by teaching you how to predict outcomes using regression. You will then learn how to classify data using techniques such as k-nearest neighbor (KNN) and support vector machine (SVM) classifiers. As you progress, you’ll explore various decision trees by learning how to build a reliable decision tree model that can help your company find cars that clients are likely to buy. The final chapters will introduce you to deep learning and neural networks. Through various activities, such as predicting stock prices and recognizing handwritten digits, you’ll learn how to train and implement convolutional neural networks (CNNs) and recurrent neural networks (RNNs). By the end of this applied AI book, you’ll have learned how to predict outcomes and train neural networks and be able to use various techniques to develop AI and ML models.
Table of Contents (8 chapters)
Preface

The K-Nearest Neighbors Classifier

Now that we have our training and testing data, it is time to prepare our classifier to perform k-nearest neighbor classification. After being introduced to the k-nearest neighbor algorithm, we will use scikit-learn to perform classification.

Introducing the K-Nearest Neighbors Algorithm (KNN)

The goal of classification algorithms is to divide data so that we can determine which data points belong to which group.

Suppose that a set of classified points is given to us. Our task is to determine which class a new data point belongs to.

In order to train a k-nearest neighbor classifier (also referred to as KNN), we need to provide the corresponding class for each observation on the training set, that is, which group it belongs to. The goal of the algorithm is to find the relevant relationship or patterns between the features that will lead to this class. The k-nearest neighbors algorithm is based on a proximity measure that calculates the...