5 Machine Learning for IoT
281
Original dataset
Under sampling
(Samples of majority class)
Over sampling
(Copies of the minority class)
Fig. 5.32 Undersampling and oversampling techniques to address the problem of imbalanced
datasets
Fig. 5.33 A simple example
of KNN classification
What is the label of
this input?
K=3
K=5
With K=3,
With K=5,
?
5.4.3 K-Nearest Neighbor (KNN)
k-nearest neighbors (KNN) is one of the simplest yet popular classification techniques that was first described in the early 1950s. KNN algorithm can be summarized as follows (see Fig. 5.33):
• First, we need to define K.
• Next, we calculate the distance between the given input (which should be
classified) and all samples of the training set.
281
Original dataset
Under sampling
(Samples of majority class)
Over sampling
(Copies of the minority class)
Fig. 5.32 Undersampling and oversampling techniques to address the problem of imbalanced
datasets
Fig. 5.33 A simple example
of KNN classification
What is the label of
this input?
K=3
K=5
With K=3,
With K=5,
?
5.4.3 K-Nearest Neighbor (KNN)
k-nearest neighbors (KNN) is one of the simplest yet popular classification techniques that was first described in the early 1950s. KNN algorithm can be summarized as follows (see Fig. 5.33):
• First, we need to define K.
• Next, we calculate the distance between the given input (which should be
classified) and all samples of the training set.
