## 3 Methodology
### Modelling
#### 3.4.3 Random Forest  
The random forest (RF) algorithm is based on the decision tree model and is straightforward, flexible, and fast. RF, including nominal, binary can handle different types of data and numerical, and has high predictive capability. RF works by building multiple trees and aggregating trees to generate efficient results [35]. The trees are generated based on seeds. Randomness in seeds generates random trees that are efficient and result in better prediction.  
Similarly, a random and different subset of attributes gives more accurate results on large datasets. The classifications for the new input data are based on each contributed tree's functions for one class. RF then performs prediction by checking the plurality of votes for the new instances. Every internal node tests an attribute, and the test result is represented by edge [36]. RF is based upon the concept of bagging and boosting. In bagging (bootstrapping), a model is constructed again and again, sampling from a large set of examples used for training, and then results are aggregated through a majority vote. So, to construct a good classifier from uncorrelated weak classifiers, boosting is an optimal solution. The tuning of hyperparameters controls the number of features in each tree [37].  
RFs are ensemble learners, which means many weak \"base learners\" contribute their votes for prediction. Base learners are called decision trees in RF, consisting of a branching composite of binary decisions for separating the data into classes. At each node of the tree, the input is separated by choosing threshold t and a single feature d. The resulting split should have minimal impurity (by mean of class labels). Entropy H is presented for two-class learning as explained in Equation (21):  
\[H=-\sum_{c=1}^{2}\ \hat{\pi}_{c}log\ log\ \hat{\pi}_{c} \tag{21}\]  
where c denotes the class and \(\hat{\pi}_{c}\) represents the proportion to the examples in c. Maximisation in information gain is equivalent to minimising entropy. In RF, the number of trees and selection of features are controlled by tuning hyperparameters. An importance matrix can be assigned to the features based on their impact on node impurity, weighted by the importance and worth of the node in classification [38]. In a single tree t, this feature importance \(I_{d,t}\) for feature d is formulated as presented in Equation (22):  
\[I_{d,t}=\sum_{n\in N_{d}}\left[\left(H_{pre,n}-\sum_{s=1}^{2}\ H_{post},n,s \right)\times P_{n}\right] \tag{22}\]  
\(H_{pre}\), denotes the entropy before node splitting, and \(H_{post},n,s\) represents the entropy after the split of child node s. \(N_{d}\) represents the set of all nodes split by feature d. For the given node n, \(P_{n}\) denotes the proportion of samples at that node. The \(I_{d,t}\) scores are overall averages of the \(N_{t}\) built decision tree T for preparation of a resultant \(I_{d}\) importance weighting: \(I_{d}=\frac{1}{N_{t}}\sum_{t\in T^{d},t}\)[39].  
Combining the multiple decision trees to attain better variance reduction results is also important, but there is a potential downside. The RF algorithm selects a fixed number of predicators from the available features in the pool at each split to overcome this. The predicators of all individual decision trees are combined to prepare the final predicator by averaging the majority vote [40]. A few more reasons support the excellent prediction power of the RF algorithm and its wide adoption. One key feature of this algorithm is its stabilisation with fewer iterations than another state-of-the-art ensemble method such as boosting. Secondly, it is working, visualising, and tuning on different inputs that influence and attract users.