Skip to main content
. Author manuscript; available in PMC: 2020 Feb 12.
Published in final edited form as: Electronics (Basel). 2020 Jan 3;9(1):10.3390/electronics9010099. doi: 10.3390/electronics9010099

Algorithm 1.

Weighted Random Forest algorithm pseudocode.

input: Number of Trees (Ntree), random subset of the features (mtry), training dataset (D)
output: Random Forest (RF)
1: RF is empty
2: for each j to Ntree do
3: Di = Bootstrap Sample (D)
4: DTi = Random Decision Tree (Di, mtry)
5: RF = RFDTi
6: end
7: for each i to n do
8: Compute wiobs using Formula (5)
9: end
10: for each j to Ntree do
11: θj=f(AUC(wobs)INBj,AUC(wobs)OOBj)
12: end
13: for each j to Ntree do
14: Compute wj using Formula (9)
15: end
16: for each i to n do
17: Compute final prediction ϒ^iRF using Formula (3)
18: end
19: return RF