## 4 Cause Estimation Algorithm
### Linear Discriminant Analysis  
LDA [39] is a method used to find a linear combination of features that can be used to differentiate two events. The results of such analysis are used in the machine learning classification algorithm. It transforms the features into lower dimension and maximizes the ratio of the between-class variance to the within-class variance; therefore, maximum separation of the classes is guaranteed [22]. LDA spheres the data based on the common covariance and classifies the data to the closest class centroid in the transformed space. To achieve this, the separability between different classes, which is the distance between the mean of different classes (also known as the between-class covariance), is calculated. Thereafter, the distance between the mean and the samples of each class (also known as within-class covariance) is also computed. From this, the lower-dimensional space which maximizes the between-class covariance and minimizes the within-class covariance is constructed. These properties are unknown beforehand and they are estimated from the training data before being applied to the linear discriminant equation known as discriminant function. The LDA is given as in Equation (5), where \(T\) is the transpose matrix consisting of the rotation of a datum (e.g., vector \(\mathbf{x}\) and \(\widehat{\mathbf{\mu}}_{k}\)). \(\widehat{\mathbf{P}}^{-1}\) is the inverse of the pooled covariance matrix, \(\widehat{\mathbf{\mu}}_{k}\) is the mean vector of features in the group \(k\), and \(\log\widehat{\Pi}_{k}\) is the natural log of the prior probability. The pooled covariance matrix is given as in Equation (6), where \(\mathbf{x}_{i}\) is a sample of scan response result, \(i\) is the index of the sample, \(N\) is the total number of samples, and \(K\) is the total number of group. The prior probability \(\widehat{\Pi}_{k}\) is the probability that a sample datum belongs to a group, and is given as in Equation (7), where \(N_{k}\) is the number of samples in a group \(k\). \[\delta_{k}(x)=\mathbf{x}^{T}\widehat{\mathbf{P}}^{-1}\widehat{\mathbf{\mu}}_{k}-\frac{1}{2 }\widehat{\mathbf{\mu}}_{k}^{T}\widehat{\mathbf{P}}^{-1}\widehat{\mathbf{\mu}}_{k}+\log \widehat{\Pi}_{k}, \tag{5}\]  
\[\widehat{\mathbf{P}}=\frac{\Sigma_{k=1}^{K}\Sigma_{gi=k}(\mathbf{x}_{i}-\widehat\mathbf{{\mu}}_{k})(\mathbf{x}_{i}-\widehat{\mathbf{\mu}}_{k})^{T}}{(N-1)}, \tag{6}\]  
\[\widehat{\Pi}_{k}=(N_{k}/N), \tag{7}\]  
\[\widehat{\mathbf{\mu}}_{k}=\Sigma_{gi=k}\mathbf{x}_{i}/N_{K}. \tag{8}\]  
Using the discriminant function as stated above, for an unknown data sample \(x\), the discriminant score \(D_{s}\) can be calculated for each class, as explained later. The data sample \(x\) is classified into the class having the highest score. To create a model using the standard LDA, first, the training data are separated into different groups based on the number of scenarios we want to estimate. To separate the training data into different groups, the data samples are divided into equal sizes corresponding to the number of scenarios we wanted to estimate (i.e., 3--normal, low SNR, and congestion). Thereafter, the mean of each group is calculated. Then, the global mean of the whole data and the prior probability of each group are calculated. If the total number of samples of each scenario to be estimated is not known, then the prior probability is estimated by assuming that the total number of samples of each scenario is equal. The next step is to calculate the pooled covariance, as described above. Lastly, the pooled covariance is used to generate the inverse of the pooled covariance. Each variable is then applied to the discriminant function as in Equation (5). \begin{table}
\begin{tabular}{c c c} \hline \hline
**Rank** & **Features** & **Weight Score** \\ \hline
1 & Scan maximum RTT & 0.32 \\
2 & Scan jitter & 0.29 \\
3 & Scan minimum RTT & 0.25 \\
4 & Unsuccessful scan rate & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: An example of features ranking table.