Research Article
A Bitwise Design and Implementation for Privacy-Preserving Data Mining: From Atomic Operations to Advanced Algorithms
Algorithm 6
The algorithm of kNN classification.
| ā | Input: training data (X, Y, l), test data (x, y), and the number of neighbors, k | | ā | Output: test label | | (1) | Calculate distance with training data (X, Y) and test data (x, y) with absolute value operation. | | (2) | Sort the smallest k distance using conditional swap operation on selection sort algorithm. | | (3) | Output most major label among the labels of nearest k data. |
|