**5.2 K-nearest neighbors (KNN) classifier**

The KNN classifier is a non-parametric, non-linear, and simple method that is used to classify the features. In this algorithm, the classification of test data is executed by finding a majority vote of the known class, and the input data will attain the class that is most common among its k-nearest neighbors [30, 31]. It is obtained using a distance metric such as Euclidean distance between the training and test data set which is calculated by

$$D\_{\epsilon}(\mathbf{x}\_{1}, \mathbf{x}\_{2}) = \sqrt{\sum\_{i=1}^{n} (\mathbf{x}\_{1i} - \mathbf{x}\_{2i})^{2}} \tag{4}$$

where, *x*<sup>1</sup> ¼ ð Þ *x*11, *x*12, … , *x*1*<sup>n</sup>* and *x*<sup>2</sup> ¼ ð Þ *x*21, *x*22, … , *x*2*<sup>n</sup>* .

The test data is assigned to a class based on closest k-datasets for training based on resemblance measures, subsequently, the majority vote of the case neighbors is determined to categorize the case [32, 33].

The textural color features, median temperature and interquartile range forms the feature sets for detection of the diabetic foot using SVM and KNN classifier. The different grouping of feature sets which are extracted from the control and DM group was investigated in this study as follows:


In all the combination, 80% of features are used to train and the remaining 20% of features are used to test the performance of the classifier. In this study, the classification is carried out using the SVM classifier and K-Nearest Neighbors (KNN) classifier for automatic classification of the plantar thermal images into two classes. The performance evaluation metrics of SVM and KNN classifiers for the detection of diabetic foot are shown in **Figure 11**. It was realized that the SVM classifier has obtained a higher classification accuracy of 92.86%, a sensitivity of 96.55%, specificity of 84.62%, a precision of 93.33%, and an F1-score of 94.92% for Group 1 (RBT) features combination than other combinations of feature set.

*Detection of Diabetic Foot Using Statistical Features DOI: http://dx.doi.org/10.5772/intechopen.106457*

#### **Figure 11.**

*Performance of SVM and KNN classifier in various combinations of feature set.*
