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