# Ensemble Machine Learning Model to Predict the Waterborne Syndrome
## 3 Materials and Methods
### Experimental Setup  
The experiments were run by introducing the ensemble stacking model against the most frequently used classifiers (Naive Bayes, J48, SVM, NN, PART, RF, and LR), which have been determined as the most popular algorithms based on the latest research [11; 12; 13; 14; 15; 16] conducted on waterborne disease prediction and management. Computational approaches were used on the clinical data features, including testing and training. Due to the size of the data sample and to ensure that the performance estimate variations are minimal, ten cross-validations (the default) were used. As a result, 90% of the entire data was used for training, while 10% was used to store validations. In addition, parameter optimization was used to identify which methods produced the best classification results. The most optimal criteria were employed to compare the proposed ensemble model against seven classifications, including the proportion of correctly categorized instances, kappa statistics, and classification time in seconds. The ensemble model comprises of Naive Bayes algorithm based on the conditional probabilistic model. The math behind the algorithm can be given as:  
Given a features vector \(X=(x_{1},x_{2},\ldots,x_{n})\) and a class variable \(y\), Bayes Theorem states that:  
\[P(y|X)=\frac{P(X|y)P(y)}{P(X)} \tag{1}\]  
It is intended to calculate the posterior probability \(P(y|X)\) from the likelihood \(P(X|y)\) and prior probabilities \(P(y)\) and \(P(X)\). Using the chain rule, the likelihood \(P(X|y)\) can be decomposed as:  
\[ \begin{array}{ll}P(X|y)&=P((x_{1},x_{2},\ldots,x_{n})|y)\\ &=P(x_{1}|x_{2},\ldots,x_{n},y)P(x_{2}|x_{3},\ldots,x_{n},y)\ldots P(x_{n}|y) \end{array}  \tag{2}\]  
Nonetheless, due to the assumption of [PERSON]'s conditional independence, the probabilities are independent of each other. Equation (2) will reduce to:  
\[P(X|y)=P((x_{1},x_{2},\ldots,x_{n})|y)=P(x_{1}|y)P(x_{2}|y)\ldots P(x_{n}|y) \tag{3}\]  
Using Equation (3) in Equation (1) will result in:  
\[P(y|X)=\frac{P(x_{1}|y)P(x_{2}|y)\ldots P(x_{n}|y)P(y)}{P(x_{1})P(x_{2})\ldots P (x_{n})} \tag{4}\]  
Here all \(P(x_{i});1\leq i\leq n\) are constants, hence:  
\[P(y|X)\propto P(y)\prod P(P(x_{i});1\leq i\leq n \tag{5}\]  
The Naive Bayes classifier combines this model with a decision rule. One common rule is to pick the most probable hypothesis; this is known as the maximum a posteriori (MAP) decision rule, which can be written as. \[y=\operatorname{argmax}yP(y)\prod P(P(x_{i})) \tag{6}\]  
While the J48 Decision Tree, which has been part of the ensemble modeling, can be written as:  
\[E=-\sum_{i=1}^{n}p_{i}*\log(p_{i}) \tag{7}\]  
Identifying the most relevant model for each classification algorithm is one of the principal test criteria. Based on accurately categorized probabilities, the algorithms' accuracies were calculated. A confusion matrix was used to verify the performances. The sensitivity, also known as recall, was used to analyze the proportion of true positive (TP) values over the entire number of positive cases. The specificity, also known as the negative ratio, was used to determine all the correctly predicted negative values (TN). \[\text{Sensitivity}=\text{TP}/(\text{TP}+\text{FN}) \tag{8}\]  
\[\text{Specificity}=\text{TN}/(\text{TN}+\text{FP}) \tag{9}\]  
The accuracy and F1 scores of the classifiers were measured using the performance metric utilized in this study.