# A QoS Classifier Based on Machine Learning for Next-Generation Optical Communication
## 4 ML Evaluation  
In this section, the results of the hypothesis testing, Pearson correlation, VIF and the ML models are revealed. The confusion matrices of both classifiers are revealed. The ROC curves are displayed and discussed for all cases.  
The four classes are compared in terms of the predicted outcome and the actual ones. The actual label value is represented as the true label. Figure 4 shows the confusion matrices for both DT and RF.  
Figure 4: Confusion matrices. (**a**) DT confusion matrix; (**b**) RF confusion matrix.  
As the color of each cell on the matrix diagonal gets brighter, this indicates that a perfect classification performance gets achieved. Figure 4a shows that the DT has misclassified an overall 33 labels while the RF has only 6 misclassifications. Hence, the accuracy of the DT is 94% while the accuracy of the RF is 99%, so the preliminary results show that the RF outperforms the DT. To make sure this is correct, the ROC curves are revealed in Figure 5. Both classifiers are compared side by side during performing the same binary classification problem.  
Figure 5: _Cont._  
The first case in Figure 5a,b is the classification between SPD (both groups) and DD (both groups) where the DT and RF have shown an ideal classification as the area under the curve is nearly maximized. The second case is the classification between all Groups A/D and all Groups B/C where the RF ROC is clearly accurate than DT Figure 5c,d.  
Figure 5e,f are showing that both classifiers achieved ideal ROCs in classifying a specific output that represents the DD of Groups B/C.  
Figure 5: ROC curves. (**a**) DT: SPD vs. DD; (**b**) RF: SPD vs. DD; (**c**) DT: B/C vs. A/D; (**d**) RF: B/C vs. A/D; (**e**) DT: DD (B/C) vs. others; (**f**) RF: DD (B/C) vs. others; (**g**) DT: SPD (B/C) vs. others; (**h**) RF: SPD (B/C) vs. others; (**i**) DT: SPD (A/D) vs. others; (**j**) RF: SPD (A/D) vs. others; (**k**) DT: DD (A/D) vs. others; (**k**) RF: DD (A/D) vs. others; (**l**) RF: DD (A/D) vs. others.  
Figure 5g-j shows the classification of SPD (Groups B/C) and the classification of SPD (Groups A/D), respectively, where the RF has properly classified these cases and has shown promising near-ideal results. The final case of Figure 5k,l shows ideal results for both classifiers RF and DT, so for each particular binary classification of ROC curves, the RF outperforms the DT. Figure 6 shows the decision tree threshold bounding.  
The leaf nodes and decision nodes are revealed after training and validating the model where the maximum depth of the tree is 10. The Gini impurity measure is a method utilized in DT algorithms to decide the optimal split from a root node. For example, in the very first few steps of the DT process, the root node has a Gini index of 0.75 for SNR less than or equal \(-0.155\) for DD (Groups A/B). Then the root node is split into 2 decision nodes: one for BER less than or equal \(-0.408\) and the other for SNR less than or equaling \(-0.135\). The first decision node is split into one leaf node in which the label is decided as SPD (Groups A/D) and the others.  
The procedures complete as mentioned in the very first steps where the leaf and decision nodes are completed and formed based on the threshold of the predictor and the Gini index.  
Figure 6: Decision tree chart.