Page 240 - Ai Book - 10
P. 240
Game Overview:
This game is one of the simplest quiz games in which you can predict the personality of animals on the
basis of several questions and answers. When you complete the quiz, it shows the result based on the
answers which have been selected by you.
K-Nearest Neighbours Algorithms
K-Nearest Neighbours algorithm is one of the key components of supervised learning technique and finds intense
application in pattern recognition, data mining and intrusion detection. This simple algorithm is one of the most
basic yet essential classification algorithms in the field of Machine Learning technique.
KNN can be used for both classification and regression predictive problems. The following two properties would
define KNN in detail:
u Passive learning algorithm − KNN is a passive learning algorithm because it does not have a specialized
training phase and uses all the data for training while classification.
u Non-parametric learning algorithm − KNN is also a non-parametric learning algorithm because it doesn’t
assume anything about the underlying data.
Let us understand more about KNN algorithms with the
help of a simple example. Suppose you want to predict
the sweetness of a potato on the basis of available data
which you have for the other potato. In such a case, you
have three maps to predict the sweetness:
In this figure, green dots are used for “Sweet” taste
whereas blue dots are used for “Not sweet” taste.
Have you noticed the variable X which is used in all
three figures? The variable X is the value which is to be
predicted. Now let us take a descriptive look at each graph one by one:
u Graph 1: 1- Nearest Neighbor
In graph 1, we can consider the value of k as 1 i.e. only 1 nearest neighbour can be considered. The nearest
value to X is a blue one. Thus, 1-nearest neighbour algorithm predicts that the taste of potato is not sweet.
u Graph2: 2- Nearest Neighbor
The graph 2 is complex as 2 nearest neighbors are considered in which one depicts the sweet taste while
the other does not. This condition creates a problem for a machine in predicting the outcome on the basis
of the nearest neighbour. In such a case, machine is not able to give any prediction.
114
114