## 4 Results
### Model Parameters
#### 4.2.9 Ensemble Method  
The VotingClassifier from the scikit-learn library was implemented to train an ensemble model that utilizes the predictions of multiple classifiers using both hard and soft voting schemes. The VotingClassifier is initialized with a list of estimators (i.e., the individual classifiers) and a voting type. The fit method is used to train the ensemble model on the training data. The score method is used to evaluate the performance of the ensemble model on the test data. The ensemble model is trained using seven different classifiers: model 1 (a decision tree), model 2 (a Naive Bayes classifier), model 3 (a logistic regression classifier), model 4 (a KNN classifier), model 5 (a random forest classifier), model 6 (a gradient boosting classifier), and model mlp (a multi-layer perceptron classifier). The hard voting scheme means that the ensemble model will make a prediction based on the majority vote among the individual classifiers, while the soft voting analyzes the average of class probabilities. Algorithm 2 explains the hybrid voting ensemble technique, which implements both the hard and soft voting techniques from the classifiers involved in the ensemble process.  
```
0: Training data \(D=(x_{1},y_{1})\), \((x_{2},y_{2})\),..., \((x_{n},y_{n})\), test data \(T=x^{\prime}_{1}\), \(x^{\prime}_{2}\),..., \(x^{\prime}_{m}\)
0: Ensemble predictions \(\hat{y}=\hat{y}_{1}\), \(\hat{y}_{2}\),..., \(\hat{y}_{m}\)
1: Train K models on the training data \(D\): \(M=M_{1}\), \(M_{2}\),..., \(M_{K}\)
2:for each test instance \(x^{\prime}_{i}\)do
3:for each model \(M_{j}\in M\)do
4: Make a prediction \(\hat{y}_{ij}=M_{j}(x^{\prime}_{i})\)
5:endfor
6: Compute the average of class probabilities \({}^{avg}(y)=(1/K)\sum_{j}={}^{K}p_{ij}(y)\), where \(p_{ij}(y)\) is the probability estimate for class \(y\) given by model \(M_{j}\) for instance \(x^{\prime}_{i}\)
7: Compute the majority vote prediction \(\hat{y}_{i}^{\text{vote}}=argmax_{y}\ \Sigma_{j}={}^{K}[y_{ij}]=y\)
8: Compute the average prediction confidence \(C_{i}{}^{avg}=(1/K)\ ^{*}\Sigma_{j}={}^{K}\max_{y}p_{ij}(y)\)
9: Set a threshold \(\alpha\in[0,1]\)
10:if the average prediction confidence \(C_{i}{}^{avg}\geq\alpha\)then
11: Set the ensemble prediction to be the average prediction: \(\hat{y}_{1}=\arg\max_{y}p^{*}_{i}{}^{avg}(y)\)
12:else
13: Set the ensemble prediction to be the majority vote prediction: \(\hat{y}_{1}=\hat{y}^{\text{vote}}_{i}\)
14:endif
15:endfor
16:return\(\hat{y}=0\)
```  
**Algorithm 2** Hybrid Voting Ensemble using Hard and Soft Voting  
In this research, while the employment of a machine learning model for binary classification relies solely on the generated dataset, utilizing its top 10 and 20 features, the concept of multiclass classification involves merging the two datasets of the generated dataset with the BoT-IoT dataset, each with a size of 3 gigabytes, for the purpose of conducting the analysis. Cross-evaluation of datasets was utilized with similar sizes of data to avoid biased results and ensure that the model generalizes well to new data. It is important to comprehend that using datasets of equal size can help prevent overfitting to a particular dataset or set of features. The binary and multiclass classification approaches are implemented with distinct sets of parameters, which are enumerated in Table 7.