Research Article
An Efficient and Fast Model Reduced Kernel KNN for Human Activity Recognition
Algorithm 1
The working process of KNN.
| | Require: input data matrix, ; the target value, ; the parameter of KNN, K; the number of training data, L. | | | Ensure: the forecasting output (). | | | Data Separation: | | (1) | The training features: ; | | (2) | The training labels: ; | | (3) | The testing features: ; | | (4) | The texting labels: ; | | | Loop: | | (5) | fordo | | (6) | fordo | | (7) | Calculate the distance between and by equation (1); | | (8) | end for | | (9) | Sort the distance from smallest to largest value (in ascending order); | | (10) | Pick the top K vectors from the sorted collection as an index; | | (11) | Set the forecasting the class label based on the most frequent class of processed index. | | (12) | end for | | | return |
|