Stage 1: Geometric Elimination |
q ← proportion of the number features to be dropped each time; |
p ← number of features in data; |
; /* number of iterations, minimum dimension 4*/ |
initialize rknn_list[m]; /* stores feature supports for each Random KNN */ |
initialize acc[m]; /* stores accuracy for each Random KNN */ |
for i from 1 to ni do
|
if i == 1 then
|
rknn ← compute supports via Random KNN from all variables of data; |
else
|
|
rknn ← compute supports via Random KNN from p top important variables of rknn; |
end if
|
rknn list[i] ← rknn;
|
acc[i] ← accuracy of rknn; |
end for |
|
pre_max = max - 1; |
rknn ← knn_list[pre_max]; /* This Random KNN goes to stage 2 */ |
Stage 2: Linear Reduction |
d ← number features to be dropped each time; |
p ← number of variables of rknn; |
; /* number of iterations */ |
for i from 1 to ni do
|
if i ≠ 1 then
|
p ← p - d; |
end if
|
rknn ← compute supports via Random KNN from p top important variables of rknn; |
acc[i] ← accuracy of rknn; |
rknn_list[i] ←rknn;
|
end for |
|
best_rknn ← rknn_list[best]; /* This gives final random KNN model */ |
return best_rknn; |