Research Article
Paddy Crop and Weed Discrimination: A Multiple Classifier System Approach
Algorithm 2
Algorithm for the selection of final Class for MCS-2.
| (1) | Input | | (2) | Train set-1 Train data set with class labels | | (3) | Test-set Test data | | (4) | k Number of classes | | (5) | n Number of classifiers | | (6) | W [n] [k] Weight of each class of each classifier | | (7) | Output | | (8) | Y [ ] Class labels | | (9) | len ⟵ length of Test set | | (10) | Y [ ] ⟵ NULL | | (11) | for i ⟵ 1 to n do | | (12) | Train Ci on Train set-1 | | (13) | end for | | (14) | for i ⟵ 1 to len do | | (15) | p Predict probability of classes for sample Si using C1, where Si Є Test-set | | (16) | q Predict probability of classes for sample Si using C2, where Si Є Test-set | | (17) | end for | | (18) | for i ⟵ 1 to len do | | (19) | for j ⟵ 0 to k − 1 do | | (20) | p[i] [j] ⟵ W [1][j] + p[i][j] | | (21) | q[i][j] ⟵ W[2][j] + q[i][j] | | (22) | end for | | (23) | end for | | (24) | for i ⟵ 1 to len do | | (25) | max1 ⟵ 0 | | (26) | max2⟵0 | | (27) | index1 ⟵ 0 | | (28) | index2 ⟵ 0 | | (29) | for j 0 to k − 1 do | | (30) | if p[i][j] > max1 then | | (31) | max1 ⟵ p[i][j] | | (32) | index1 ⟵ j | | (33) | end if | | (34) | if q[i][j] > max2 then | | (35) | max2 q[i][j] | | (36) | index2 j | | (37) | end if | | (38) | end for | | (39) | if max1 > max2 then | | (41) | Y [i] ⟵ index1 | | (42) | else | | (43) | Y [i] ⟵ index2 | | (44) | end if | | (45) | end for |
|