# Wireless Traffic Prediction Based on a Gradient Similarity Federated Aggregation Algorithm
## 3 Proposed Framework and Methods
### Global Aggregation Based on Gradient Similarity
Algorithm 1 describes the execution process of FedGSA:```
Input: The wireless traffic data \(\left\{x^{\mathrm{k}},y^{\mathrm{k}}\right\}_{k=1}^{\mathrm{K}}\); the clients share the enhanced data and form the globally shared dataset \(D_{s}\); the percentage of selected clients is \(\delta\), and the client learning rate is \(\eta\). Output: Global Model \(\mathrm{w}_{G}\). Obtain \(\mathrm{w}_{\mathrm{Q}}\) by using \(D_{s}\)//Get the quasi-global model \(\mathrm{w}_{\mathrm{Q}}\) and send it down to the client
1 for each round \(t=1,2,...\), do
2\(m\leftarrow\max\left(K\cdot\delta,1\right)\)
3\(S_{t}\leftarrow\)Randomly selected m-base stations
4 for each client \(k\in S_{t}\)do
5\(w_{k}^{t+1}\gets w_{k}^{t}-\eta w^{t}\)//Client local update model
6 endfor
7 Obtain \(w_{k}^{t+1}\)//Get the client local model
8 Obtain \(\widehat{w}_{k}^{t+1}\) by using Equation (5)//First aggregation to obtain personalized models for each client
9 endfor
10 Obtain \(w_{\mathrm{G}}^{t+1}\) byusing Equation (6)//Second aggregation, get the global model
11 Return \(w_{G}\)
```

**Algorithm 1**FedGSA Implementation Process

## 4 Experiments and Conclusions

In this paper, two real datasets were selected to learn and train clients by combining federal learning mechanisms with LSTM long and short-term memory networks. To verify the feasibility and effectiveness of the method in this paper, some traditional network models based on LSTM, Lasso, Support Vector Regression (SVR), and FedAvg traffic prediction methods were selected for comparative analysis. Except for the shallow learning algorithm, the FedAvg algorithm and the structure of this experimental network remained consistent. ### Dataset and Evaluation Metrics

This paper used the Trento and Milano telecommunication activity datasets provided by Telecom Italia in the European \"Big data challenge\" [19; 20], and used the network traffic records of these two regions as the raw data for traffic prediction. The cellular networks for cellular user activity recorded traffic every ten minutes for two months from 11 January 2013 to 1 January 2014. For the experiments in the following subsections, the network traffic was resampled to hourly to avoid data sparsity issues. To evaluate prediction performance, three widely used regression metrics were adopted in this paper, i.e., mean squared error (\(MSE\)), mean absolute error (\(MAE\)), and R-squared score:

1. Mean Absolute Error (\(MAE\)): Is the average of the absolute error, which can better reflect the actual situation of the prediction value error. The range is \([0,+\infty)\), as in Equation (9): \[MAE=\frac{1}{n}\sum_{i=1}^{n}\left|y_{i}-\hat{y}_{i}\right|\] (9)
2. Mean Square Error (\(MSE\)): Is the square of the difference between the true value and the predicted value, and then the average of the summation is used to detect the deviation between the predicted and true values of the model, and its range is as in Equation (10): \[MSE=\frac{1}{n}\sum_{i=1}^{n}\left(y_{i}-\hat{y}_{i}\right)^{2}\] (10) where, in \(MAE\) and \(MSE\), \(\hat{y}_{i}\) denotes the predicted value of wireless traffic at the time \(i\) and \(y_{i}\) denotes the true value at the corresponding time. R-squared score: the R-squared score is applied to regression problems with values between 0 and 1. The closer to 1 indicates a better fit and is generally expressed as \(R^{2}\), as in Equation (11):

\[R^{2}=1-\frac{{(\sum\limits_{\text{i=1}}^{m}{(\hat{y}^{(i)}-y^{(i)})}^{2})}\Bigg{/} m}{{(\sum\limits_{\text{i=1}}^{m}{(y^{(i)}-\overline{y})}^{2})}\Bigg{/}m} \tag{11}\]

The numerator represents the Residual Sum Of Squares (RSS) and the denominator represents the Total Sum of Squares (TSS). ### Experimental Settings and Overall Results

Experiments were conducted with 100 randomly selected cells from each dataset, and eight weeks of traffic data were randomly selected for the experiments, where the traffic of the first seven weeks was used for training the prediction model and the traffic of the last week was used for testing.