## 7 Classification of the Surveyed AI Techniques
### Machine Learning Techniques
#### 7.1.1 Supervised Learning Techniques  
In supervised learning (SL), algorithms are trained using labeled datasets. During the training process, algorithms evaluate an estimate based on the input dataset and continually updates the estimate until it achieves a predefined degree of accuracy. An SL algorithm adjusts and satisfies a cost function that measures the error between a labeled and predicted output [118]. They are majorly used for classification and regression-based tasks. In classification tasks, data are grouped into a predetermined and distinct number of labeled classes. Popular algorithms include Naive Bayes (NB), K-Nearest Neighbor (KNN), Support Vector Machines (SVM), Decision Trees (DT), Random Forests (RF), Artificial Neural Networks (ANN), and Ensembles. Some algorithms are fast, accurate and easy to implement, e.g., NB, RF which makes them usable on resource-constrained nodes while others like KNN and SVM tend toward computational complexity, especially with large datasets. For example, authors in ref. [119] successfully RF on a constrained node to classify collected data before transmission and further demonstrated that the energy consumption of the AI-based process was three times lower than the normal sense and transmit approach. Other algorithms like DT, ANN and SVM suffer from overfitting when datasets are not well pruned or regularized. Common classification tasks in CS include threat classification [83], device/user classification [120], data and request classification [121]. The operational technique of algorithms, the type of data (size, kind, features, state, etc.) and the CS task influences the choice of a selected algorithm. For example, a Naive Bayes classifier assumes that data attributes are statistically uncorrelated, thus, given a vector of attributes \(\mathbf{t}\), NB evaluates the probability that the vector belongs to a class using the Bayes Theorem in Equation (7)  
\[\mathbf{p}(\mathbf{t}|\mathbf{x}_{1},\ldots,\mathbf{x}_{\mathbf{M}})=\frac{ \mathbf{p}(\mathbf{x}_{1}\ldots\mathbf{x}_{\mathbf{M}}|\mathbf{t})\mathbf{P} (\mathbf{t})}{\mathbf{P}(\mathbf{x}_{1}\ldots\mathbf{x}_{\mathbf{M}})} \tag{7}\]  
It then uses the naive assumption given as  
\[\mathbf{P}(\mathbf{x}_{\mathbf{i}}|\mathbf{t},\mathbf{x}_{\mathbf{1}},\ldots,\mathbf{x}_{\mathbf{i-1}},\mathbf{x}_{\mathbf{i+1}},\ldots,\mathbf{x}_{ \mathbf{M}})=\mathbf{P}(\mathbf{x}_{\mathbf{i}}|\mathbf{t}) \tag{8}\]  
Subsequently, for all \(\mathbf{i}\), this relationship is then simplified as shown in Equation (9) as  
\[\mathbf{P}(\mathbf{t}|\mathbf{x}_{\mathbf{1}},\ldots,\mathbf{x}_{\mathbf{M}})= \frac{\mathbf{P}(\mathbf{t})\prod_{i=1}^{\mathbf{M}}\mathbf{P}(\mathbf{x}_{ \mathbf{i}}|\mathbf{t})}{\mathbf{P}(\mathbf{x}_{1}\ldots\mathbf{x}_{\mathbf{M} })} \tag{9}\]  
This simplified process makes an NB model easy, fast and capable of real-time processing in CS tasks with massive datasets having large or irrelevant features. Given an independent variable, algorithms such as linear regression, SVM and ANN are used to predict a continuous value. Hence, they are useful for forecasting or establishing a relationship between variables of interest. Common prediction-based tasks in CS include data/event prediction [122], energy consumption/availability forecast [17], application load prediction [123], and predicting threats [124]. For an independent variable \(\mathbf{y}\) in Equation (10)  
\[\mathbf{y}=\mathbf{b}_{\mathbf{0}}+\mathbf{b}_{\mathbf{1}}\times\mathbf{x} \tag{10}\]  
the goal of a linear regression algorithm is to find the best value for \(\mathbf{b}_{\mathbf{0}}\) and \(\mathbf{b}_{\mathbf{1}}\). This can be achieved using a minimization problem that minimizes the error between the predicted value and the actual value. The mean squared error (MSE) function is obtained when the error difference is squared and summed over all the data points, then divided by the total number of data points.