Skip to main content
. 2021 Jul 15;21(14):4821. doi: 10.3390/s21144821
Algorithm 2 WC Feature Selection method
1. Set Mpop, Msr, dimax, Max_Iteration.
2. Execute Equations (11) and (12)//to determine the number of streams flowing into rivers and sea
3. k = Features (WSN-DS)
4. Mpop (1:k) = random initial population
5. Set the classifier algorithm (DT, KNN, SVM, DL, NB)
6. Calculate the fitness function for Mpop (1:k) using Equation (10)
7. Sort fitness values in descending order
8. F_sea = best fitness for initial populations
9. F_river = best next fitness after the F_sea
10. F_stream = Execute Equation (13)//to determine the number of streams flow to their corresponding rivers and sea, which is considered the best fitness after F_river
11. t = 0
12. while (t < Max_Iterration) do
13. for i = 1: Mpop do
14.   new_stream = Execute Equations (15) and (16)//to find new stream flows
15.    F_new_stream = Execute Equation (10) for new_stream
16.   if F_new_stream < F_river then
17.    River = new_stream
18.   if F_new_stream < F_sea then
19.    Sea = new_stream
20.   end if//line 16
21.   end if//line 18
22.   new_river = Execute Equation (17)//to find new river flows
23.    F_new_river = Execute Equation (10) for new_river
24.   if F_new_river < F_sea then
25.    Sea = new_river
26.    end if//line 24
27.   end for//line 13
28.  for i = 1: Msr do
29.   if (distance (Sea and River) < dimax) or (rand < 0.1) then
30.   New_stream = Execute Equation (18)
31.   end if//line 29
32.  end for//line 28
33. t = t + 1
34. end while
35. print the performance accuracy and number of selected features