# Intelligent Data-Enabled Task Offloading for Vehicular Fog Computing
## 4 Proposed Technique
### ANN Prediction Model Results  
The results of the ANN prediction model are presented in this subsection.  
* Training Phase: In the training phase of the ANN model for link connectivity time, the learning rate \(\eta\) is taken as 0.01. The value of momentum is adaptively changed by the Adam optimization algorithm and is finally set to 0.9 for optimal results. The number of training samples is taken as 100,000. The number of neurons in the hidden layer is taken as \([30,20,1]\)), which provides the best model results in terms of all four evaluation error scores (\(RMSE=3.5598\), \(MABE=1.9919\), \(MAPE=8.6981\) and \(R^{2}=0.9854\)). In the computation availability time ANN model, the same parameters are used, except that the number of hidden layer neurons is taken as \([20,20,1]\) to provide the best results. The error scores for this model are calculated as \(RMSE=1.7857\), \(MABE=1.0189\), \(MAPE=8.8644\) and \(R^{2}=0.9853\).
* Testing Phase: After describing the details of the training data, the data samples are subjected to the testing phase. The prediction is performed based on both models and the time values \(T_{1}\) and \(T_{2}\) are taken as 1, 2 and 3 s. Generally, \(T_{1}\), which is associated with link connectivity time, is higher than \(T_{2}\) as link connectivity is needed once the task is computed and returned to the source vehicle.  
The one-second-ahead prediction is shown in Figure 4, in which the x-axis represents the number of testing samples and the y-axis gives the link connectivity time in seconds. We utilize 20,000 values to test the prediction model. In Figure 4, we show the results of the first 5000 testing samples. It can be seen from the graph that the actual and predicted link connectivity times show similar results, with a high level of accuracy. Accordingly, the prediction results at two seconds and three seconds ahead are also presented in Figure 5 and Figure 6, respectively.  
The error scores of the link connectivity model for all predictions are given in Table 4. The general trend is that the prediction accuracy reduces as the prediction time ahead increases.  
For the computation availability model, the predicted and actual results are illustrated in Figures 7-9. Similar to the previous model, we use 100,000 samples for training and 20,000 samples for testing. In the graphs, we show the prediction results of the first 5000 samples. It can be seen that the actual and predicted values of computation availability time are quite close in all cases.  
Table 5 lists the error scores for the computation availability model. With these results, it can be concluded that the ANN model can accurately predict computation availability time a few seconds ahead of the current time.  
Figure 4: One- second-ahead prediction of link connectivity time.  
Figure 5: Two-seconds-ahead prediction of link connectivity time.  
Figure 6: Three-seconds-ahead prediction of link connectivity time.  
\begin{table}
\begin{tabular}{l l l l} \hline \hline
**Error** & **One-Second-Ahead Prediction** & **Two-Seconds-Ahead Prediction** & **Three-Seconds-Prediction** \\ \hline RMSE & 3.9839 & 6.0147 & 7.4742 \\ \hline MABE & 2.3066 & 3.2745 & 4.4182 \\ \hline \(R^{2}\) & 0.9838 & 0.9631 & 0.9430 \\ \hline MAPE & 5.7767 & 8.8480 & 11.4301 \\ \hline \hline \end{tabular}
\end{table}
Table 4: Error scores of link connectivity model.  
Figure 8: Two-seconds-ahead prediction of computation availability.  
Figure 7: One- second-ahead prediction of computation availability.