## 4 Results
### Centralized Learning vs. FL Based on Edge-Fog-Cloud Architecture
#### 4.2.2 FL on Edge Layer Performance  
Now, we analyze the results from FL within the edge-fog-cloud architecture. In this analysis, each graph illustrates the progression of devices over multiple rounds (on the x axis), during which they compute the loss function value (on the y axis) associated with their segment of the model training. The initial analysis focuses on assessing the performance of the loss parameter. The performance outcomes of the loss parameter at the edge layer are depicted in Figure 4. The graph comprises five line graphs labeled from A to E, each representing the 'loss trend' for a different 'fog device' (from Device 1 to Device 5) across several rounds of an FL process within an edge-fog-cloud architecture. Each 'fog device' oversees five 'edge devices' involved in the learning process, with the colors in the curves corresponding to different edge devices contributing to the learning process. \begin{table}
\begin{tabular}{c c c} \hline
**No** & **Parameter** & **Result** \\ \hline
1 & Loss & 0.0045648 \\
2 & Accuracy (\%) & 0.9936 \\
3 & Precision (\%) & 0.9955 \\
4 & Recall (\%) & 0.9979 \\
5 & F1-score (\%) & 0.9967 \\
6 & Training time (s) & 4041.07 \\
7 & Average CPU (\%) & 4.7 \\
8 & Average memory (GB) & 40.78 \\
9 & Model size (Kb) & 46 \\ \hline \end{tabular}
\end{table} 
Table 5: Centralized learning detection performance. The loss function serves as a metric for evaluating the model's predictive accuracy against the actual data, with lower values indicating superior performance. The graphs illustrate fluctuations in loss values across rounds, reflecting the iterative process towards improved performance. Among the fog devices, variations in average loss across their respective edge devices are observed. Notably, for Fog Device 1, Edge Device 1 stands out with the lowest average loss of 0.0067, indicating effective learning, while Edge Device 4 exhibits the highest average loss of 0.0102, suggesting potential challenges in model training or data quality. Fog Device 2 generally demonstrates lower average losses, with Edge Device 1 displaying the lowest average loss at 0.0064, though Edge Device 4 shows a slightly higher average loss of 0.0087, indicating varying levels of learning effectiveness. Fog Device 3 consistently maintains efficient learning across its edge devices, all exhibiting low average losses, with Edge Device 5 showcasing the lowest average loss of 0.0063, suggesting slightly better performance. On the other hand, Fog Device 4 displays significant variance in average loss among its edge devices, with Edge Device 2 recording the highest average loss of 0.0118, possibly indicating specific learning challenges or data processing issues, while Edge Device 3 demonstrates a notably lower average loss of 0.0066, implying more effective learning. Lastly, Fog Device 5 and Fog Device 3 demonstrate consistent performance with low average losses across edge devices, with Edge Device 4 leading with the lowest average loss of 0.0061, indicating superior learning efficiency. Figure 4: The loss value trend across the edge layer. Figures (**a**–**e**) present the trend of loss values in edge devices grouped by fog devices. This analysis indicates that while most edge devices perform consistently with low average losses, certain devices (e.g., Edge Device 4 from Fog Device 1 and Edge Device 2 from Fog Device 4) exhibit higher losses, which may highlight areas for potential improvement or investigation into the training data or model parameters. Overall, the FL system appears to perform well, with most devices demonstrating efficient learning capabilities. The subsequent analysis focuses on the accuracy of the proposed system. The performance outcomes concerning the accuracy parameter at the edge layer are depicted in Figure 5.  
Among the edge devices under each fog device, variations in average accuracy are observed.