Skip to main content

Table 1 Computing feature supports using Random KNN bidirectional voting

From: Random KNN feature selection - a fast and stable alternative to Random Forests

/* Generate n KNN classifiers using m features and compute accuracy acc for each KNN */
/* Return support for each feature */
p ← number of features in the data set;
m ← number of features for each KNN;
r ← number of KNN classifiers;
F i ← feature list for ithKNN classifier;
C ← build r KNNs using m feature for each;
Perform query from base data sets using each KNN;
Compare predicted values with observed values;
Calculate accuracy, acc, for each base KNN;
F i = 1 r F i ; {F is the list of features that appeared in r KNN classifiers};
for each f F do
   C(f) ← list of KNN classifiers that used f;
    s u p p o r t ( f ) 1 | C ( f ) | k n n C ( f ) a c c ( k n n ) ;
end for