## 3 Methodology
### Proposed Work Flow Model
#### 3.3.1 Traffic Classification Model  
For the purpose of traffic classification, various supervised ML algorithms have been tested to find the best model capable of performing multi-class traffic classification with appreciable accuracy and precision while also keeping the inference time and resource utilization low. Some of the tested algorithms include logistic regression, SVM, K-NN, XGBoost, decision tree (CART), and optics. The ML algorithms were selected based on the \begin{table}
\begin{tabular}{c c c c} \hline
**Forward Packets** & **Forward Average Packets/Second** & **Reverse Packets** & **Traffic Type** \\ \hline
454 & 1.16 & 507 & Voice \\
790 & 0.92 & 1018 & Voice \\
856 & 0.10 & 508 & Data \\
856 & 0.09 & 507 & Video \\
1622 & 0.32 & 507 & Video \\ \hline \end{tabular}
\end{table} 
Table 2: Training dataset sample. findings in [36, 38, 39] to find the best possible algorithm for the classification of data before the operation of load balancing. Since traditional supervised ML produces acceptable outcomes and advanced ML may increase network complexity, we chose this form of traditional supervised ML rather than advanced ML. It is necessary to perform some pre-processing in order to accurately classify the data. The pre-processing procedures include removing null values, separating feature sets and categories, converting traffic type categories from object types in the dataset for further manipulation, normalizing the feature sets to avoid over-fitting, and selecting the best features from the feature sets that are available because the ML classification model is not able to analyze a large number of features in an efficient manner. Based on the feature scores of several features, the features are extracted. The feature scores of the top eight features are utilized in this proposed system for traffic classification tasks. In our system scenario, the main (local) controller performs traffic classification and load balancing while the secondary (local) controllers handle less critical traffic. Here, the proposed model itself collects training datasets using real-world scenarios. The Algorithm 1 initiates with the collection of training datasets. For this, the Ryu controller is initiated in training mode and topology is started. The dataset is created by using a simulation tool known as D-ITG that simulates different types of traffic in a network. The data are extracted as a CSV file, which is then fed to the pre-processing state, where necessary feature sets are extracted and unnecessary features are dropped for easy and efficient manipulation in subsequent states. After pre-processing, the dataset is fed to the traffic classification model, where the model is trained using various ML algorithms for real-time traffic classification in future implementations. ```
1 Initiation of network in training mode
2 Generation of training dataset
3 Data pre-processing
4 Traffic classification model training
5 Send trained model to step 10
6 Obtain real-time traffic from external network
7 Process Network in real time classification mode
8 ifTraffic already not classifiedthen
9 Send Traffic to Main controller for classification
10 ifMain controller classify trafficthen
11 Update flow tables and send traffic to dedicated path based on flow tables
12 Send traffic to switch connected to receiver host
13 else
14 Send traffic directly through switches
15 Traffic received by receiver host
```  
**Algorithm 1**Proposed work flow model  
After training the model, it is ready to classify real-world traffic in real-time. The \"pickle\" library is then used to save the learned model and perform real-time traffic classification. Once it has been suitably trained and evaluated on Google Colab, the Ryu controller is used to run the model in a real-time classification mode. The mininet topology can be resumed after the controller has started running. Following that, when traffic is sent between hosts, the controller classifies it according to its type and presents it with additional data.