# A Real-Time Network Traffic Classifier for Online Applications Using Machine Learning
## 5 Experimental Evaluation
Table 4 compares the KNN, RF, and ANN models in terms of classification accuracy and prediction time across the 53 classes. For instance, the ANN model achieved an overall average classification accuracy of 99.86%. The average prediction time of the model was measured to be 0.25 s. This is evident that administrators can detect any security vulnerability in their networks using a handy web-based GUI in a quarter of a second. Furthermore, we noted that the prediction accuracy of many classes (e.g., Netflix, Dropbox, and WhatsApp) was 100%. This shows that our model is robust and can operate in real-time inference in real-world network settings with high accuracy. Compared to ANN and RF, KNN is considered a significantly slower model in the case of having a large dataset because it needs to scan all the training databases each time a prediction is required; thus, it cannot generalize over the dataset in advance. That is why we believe that the KNN model is not adequate to be used for real-time inference. In contrast, on average, the ANN model requires around 250 ms only to detect a security thread in a traffic flow. To put these numbers in some context, consider a firewall service installed in a gateway router; our ANN model can inspect around four applications' flow streams per second, which would have a negligible latency overhead over the network stream. Figure 9: A snapshot of the classification report of the RF model on the web-based GUI. \begin{table}
\begin{tabular}{c c c c c c c} \hline \hline  & \multicolumn{2}{c}{**Classification Accuracy**} & \multicolumn{2}{c}{**Prediction Time**} \\ \hline
**Class** & **KNN** & **RF** & **ANN** & **KNN** & **RF** & **ANN** \\ \hline AMAZON & 97.01 & 98.79 & 99.57 & 283 & 0.74 & 0.29 \\ \hline APPLE & 86.02 & 98.62 & 100 & 181 & 0.79 & 0.28 \\ \hline APPLE\_ICLOUD & 70.24 & 99.76 & 100 & 190 & 0.7 & 0.28 \\ \hline APPLE\_ITUNES & 97.94 & 99.43 & 100 & 178 & 0.73 & 0.28 \\ \hline CITRIX\_ONLINE & 56.63 & 100 & 97.85 & 92 & 0.01 & 0.05 \\ \hline CLOUDFLARE & 95.01 & 98.61 & 99.97 & 188 & 0.66 & 0.27 \\ \hline FLASH & 99.58 & 99.69 & 100 & 251 & 0.58 & 0.28 \\ \hline DEEZER & 55.5 & 85.14 & 99.99 & 106 & 0.02 & 0.05 \\ \hline DNS & 99.59 & 99.82 & 100 & 220 & 0.53 & 0.3 \\ \hline DROPBOX & 91.92 & 97.35 & 100 & 197 & 0.69 & 0.39 \\ \hline EASYTAXI & 99.3 & 99.6 & 100 & 125 & 0.75 & 0.44 \\ \hline EBAY & 84.51 & 99.33 & 100 & 163 & 0.79 & 0.4 \\ \hline EDONKEY & 72.08 & 90.53 & 100 & 202 & 0.02 & 0.04 \\ \hline FACEBOOK & 98.9 & 98.96 & 100 & 197 & 0.65 & 0.4 \\ \hline FTP\_CONTROL & 49.00 & 88.00 & 99.99 & 144 & 0.01 & 0.09 \\ \hline FTP\_DATA & 99.35 & 99.9 & 100 & 171 & 0.66 & 0.34 \\ \hline GMAIL & 96.3 & 97.38 & 99.92 & 193 & 1.01 & 0.28 \\ \hline GOOGLE & 99.46 & 99.82 & 99.96 & 306 & 0.69 & 0.29 \\ \hline GOOGLE\_MAPS & 94.3 & 99.61 & 100 & 159 & 0.76 & 0.27 \\ \hline H323 & 56.54 & 66.67 & 99.96 & 136 & 0.01 & 0.04 \\ \hline HTTP & 99.24 & 99.63 & 100 & 334 & 0.65 & 0.31 \\ \hline HTTP\_CONNECT & 99.03 & 99.93 & 99.89 & 302 & 0.67 & 0.29 \\ \hline HTTP\_LOAD & 99.79 & 99.72 & 100 & 146 & 0.68 & 0.3 \\ \hline HTTP\_PROXY & 99.45 & 99.81 & 99.95 & 124 & 0.65 & 0.33 \\ \hline INSTAGRAM & 88.52 & 98.45 & 100 & 145 & 0.69 & 0.33 \\ \hline IP\_ICMP & 99.99 & 100 & 100 & 248 & 0.48 & 0.3 \\ \hline MICROSOFF & 98.27 & 98.96 & 99.56 & 274 & 0.68 & 0.28 \\ \hline MQTT & 91.22 & 99.91 & 100 & 168 & 0.6 & 0.27 \\ \hline MSN & 94.92 & 98.16 & 100 & 162 & 0.71 & 0.27 \\ \hline MS\_ONE\_DRIVE & 77.07 & 99.11 & 100 & 149 & 0.79 & 0.28 \\ \hline NETFLIX & 97.27 & 99.32 & 100 & 141 & 0.88 & 0.27 \\ \hline NTP & 99.9 & 100 & 100 & 307 & 0.54 & 0.27 \\ \hline OFFICE\_365 & 88.34 & 98.49 & 100 & 173 & 0.76 & 0.28 \\ \hline SKYPE & 94.98 & 98.25 & 100 & 139 & 0.77 & 0.28 \\ \hline SPOTIFY & 98.75 & 99.26 & 100 & 152 & 0.75 & 0.28 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: The average classification accuracy (%) and prediction time (second) of KNN vs. RF vs. ANN.