# Throughput Prediction of 5G Network Based on Trace Similarity for Adaptive Video
## 3 Theoretical Background
### Clustering  
The purpose of clustering is to group the different segments of network traces based on their implicit similarity. The traces, represented here as time series, can be clustered in many different ways, whose description is beyond the scope of our paper. The most intuitive approach is to compare the whole time series. The series is divided into overlapping segments, which are represented as vectors. Then, each pair of vectors is compared using a distance measure, see Figure 2(a). However, defining a suitable measure for distance between unprocessed time series can be a difficult task. The definition must take into account various factors such as high-dimensional space, noise, varying series lengths, different dynamics, and different scales. Therefore, it is recommended to use a clustering algorithm for an interpretable, extracted feature vector; see Figure 2(b). Feature-based clustering techniques employ a set of global features that summarize the transient characteristics of time series. This approach is more resilient to noisy data and easier to interpret [41]. We apply the features identified in Section 3.2, namely the mean and variance. Clustering should present less computational burden than a single, more complicated model for the whole trace. \begin{table}
\begin{tabular}{l l l l l l} \hline
**Trace** & **Activity** & **Length** & **Average** & **Min and Max** & **Source** \\  & & **(min)** & **(MB/s)** & **(MB/s)** & \\ \hline F1 & Fixed & 260 & 5.6 & 2.7–25 & [38] \\ F2 & Fixed & 600 & 5.1 & 0–37 & Author’s measurements \\ M1 & Mobile & 459 & 2.1 & 0.4–11 & [38] \\ M2 & Mobile & 600 & 1.9 & 0–57 & Author’s measurements \\ \hline \end{tabular}
\end{table} 
Table 2: Network throughput traces used in the experiments. Besides the similarity metrics, the clustering method also affects the result [33]. Hence, we employed three algorithms, namely KMeans, OPTICS, and AutoClass. These algorithms represent different clustering approaches. KMeans is a partition-based algorithm, OPTICS is density-based, and AutoClass is probabilistic. The complexity of the algorithms is similar, increasing the chances of obtaining an independent final prediction and making the experiment easier to reproduce. With this selection, we aimed to compare the algorithms' classes instead of the algorithms themselves. KMeans is a popular partition-based algorithm, where each data point is assigned to a single cluster. The algorithm defines \(k\) centroids, one for each cluster. Then, the centroids absorb nearby data points by applying a specified distance measure. In this process, every point in a dataset is assigned to the centroid closest to it. When all the points have been assigned, the algorithm calculates \(k\) new centroids by taking into account the points that were assigned to them. Once it has found the new centroids, it will reassign all the points to the centroid closest to them. This process is repeated until the centroids no longer move significantly. Figure 4 shows a fragment of the F2 trace with highlighted segments possessing similar statistical characteristics measured by the mean and variance. The segments were selected from a cluster identified by KMeans. The segments have low throughput and variability compared to the rest of the trace. Figure 4: KMeans algorithm applied to the F2 trace. The traffic in the highlighted areas possesses similar statistical characteristics measured by the mean and variance. Figure 3: Finding similarities in a univariate time series. Consecutive sliding windows are represented as the vectors \(\{X_{1},X_{2},\ldots,X_{n}\}\). The vectors are compared (**a**) directly and (**b**) through the computed vectors’ features. Figure 5 presents feature clusters identified by KMeans and extracted from a fragment of the M2 trace. The x-coordinates represent the mean feature, while the y-coordinates represent the variance feature. The groupings have a Y shape.