# Protocol-Specific and Sensor Network-Inherited Attack Detection in IoT Using Machine Learning
## 3 Methodology
### Modeling Phase in SEMMA
#### 3.5.4 Baseline Model, Parameter Tuning, and ProSenAD Optimization  
The baseline model is used for contextualization of the model results and to perform optimization with reference to the objective to be achieved. For ProSenAD model development, first the LGBM baseline model is built and trained using basic parameters and default values. The model variant-related benchmarks are also trained with multiclass objective for comparison with the proposed model. Both direct multiclass and binary class-based multiclass models are considered to be used for reference. For instance, Ref. [12] have used GOSS boosting method for binary classification of protocol-specific attack. Therefore, the same method has been used in this paper in addition to dart booster for performance comparison. Furthermore, GB, XGBoost, and LGBM with GBDT boosting methods are built. The results of the ProSenAD are presented in the next section along with the comparative performance analysis for both types of benchmarks that are considered in this research. Based on the results obtained from the baseline model, the fine-tuning step is performed for ProSenAD. The important parameters, hyperparameters, and metrics used in ProSenAD for attack detection are presented in Table 5. (3) in Table 5 means that the parameter/metric has been implemented while (7) means that it has not been implemented. \begin{table}
\begin{tabular}{c c c c} \hline \hline
**Parameter Class** & **Parameters/Metrics** & **Baseline** & **ProSenAD** & **Constraints** \\ \hline \multirow{6}{*}{Core} & Task & Training, & Training, & \\  & prediction/testing & prediction/testing & N/A \\ \cline{2-4}  & Objective & Multiclassova (one-vs-all) & Multiclass & N/A \\ \cline{2-4}  & Number of classes & 3 & 3 & N/A \\ \cline{2-4}  & Boosting & Gbdt & Goss, dart & N/A \\ \cline{2-4}  & Iterations & Smallest multiple of classes and number of iterations & ✓ (default = 100) & Greater than or equal to 0 \\ \cline{2-4}  & Learning rate & \(0.1\) & Greater than 0 \\ \cline{2-4}  & Number of leaves & ✗ & ✓ (default = 31) & Greater than 0 and less than or equal to 131,072 \\ \hline \multirow{6}{*}{Tree depth (maximum)} & ✗ & ✓ & \\  & & & (default = \(-\)1) & N/A \\ \cline{2-4}  & Minimal information in one leaf & ✗ & ✓ (default = 20) & Greater than or equal to 0 \\ \cline{2-4}  & Feature fraction & ✓ & ✓ (default = 1) & Greater than 0 and less than or equal to 1 \\ \cline{2-4}  & & & & Greater than 0 and less than or equal to 1 \\ \cline{2-4}  & Bagging fraction & ✗ & ✓ (default = 1) & Greater than 0 and less than or equal to 1 \\ \cline{2-4}  & Bagging frequency & ✗ & ✓ (default = 0) & Greater than 0 and less than or equal to 1 \\ \cline{2-4}  & Early stopping & ✗ & ✓ (when the best & N/A \\ \cline{2-4}  & & & performance is observed) & \\ \hline \hline \end{tabular}
\end{table} 
Table 5: Parameters, hyperparameters, and metrics considerations. Parameter tuning is performed to optimally improve accuracy, handle overfitting, regularization, and reduce the training time, because parameters and hyperparameters determine the overall performance of the model. Therefore, they are classified as: (1) parameters that contribute to improved accuracy, (2) parameters that determine and impact the structural and learning process of the tree, and (3) parameters that handle overfitting issues. These are important to consider for optimization. Therefore, in ProSenAD, each of these categories are addressed in the parameter tuning process. The first category includes learning rate (_lr_), number of iterations (_I_), and number of bins (_Bn_). They are tuned in inverse relation to each other to improve accuracy and avoid overfitting by experimenting with a range of values. The second category consists of structural parameters such as number of leaves (_Ln_), maximum tree depth (_Tdepth_), and minimal information in one leaf (_dmin in Li_). The last parameter of this category is important as it also contributes to resolving regularization and overfitting issues.