# Federated Learning for Surface Roughness
## 4 Results
### Federated Learning Prediction Before and After Data Balancing  
The results indicate that the balance of data distribution plays a critical role in the stability and predictive performance of the model. Figure 12 illustrates the uneven distribution of labels (surface roughness values) in the original training dataset across different value intervals. Using the range of 0.2 to 0.8 \(\upmu\)m as the baseline and dividing it into intervals of 0.1 \(\upmu\)m, the analysis reveals that data points with roughness below 0.4 \(\upmu\)m accounted for only 2.1% of the entire dataset. Such severe data imbalance can lead to model overfitting or underfitting in certain ranges, thereby degrading overall model performance. To address this issue, we used the class with the highest data count as a reference and calculated the ratio of data points in each class relative to this reference. These ratios were then used as scaling factors for data augmentation. Based on the computed factors, we replicated the original training samples within each class and introduced random noise to the duplicated data to expand the dataset. This approach helped balance the number of samples across all classes, resulting in a more uniform training data distribution, as shown in Figure 13. Through this augmentation strategy, we effectively mitigated the original imbalance problem, enabling the federated learning model to learn from each surface roughness range more evenly. Consequently, the model's predictive ability in sparse regions improved, enhancing the overall generalization performance. Figure 11: Comparison of centralized and federated training results. After applying data balancing and augmentation, we retrained the federated learning model. Through data resampling and augmentation techniques, we mitigated the issue of uneven data distribution across different clients, allowing the model to learn from a more diverse range of data scenarios. Figure 14 illustrates the comparison between the predicted values and actual labels on the test dataset after the data balancing process. The corresponding Absolute Error statistics are summarized in Table 3, while the distribution of sample proportions across different Absolute Error ranges is shown in Figure 15. In addition, the RMSE after data balancing decreased to 0.076, indicating an improvement in the model's overall predictive accuracy. Figure 12: Output value distribution of imbalanced data. Figure 13: Output value distribution after data balancing. As shown in Table 3, after applying data balancing, the proportion of samples falling within the high-accuracy range (Absolute Error < 0.1) increased to 70%, which is significantly higher compared to the results obtained from the unbalanced dataset described earlier. Conversely, the proportion of samples with high prediction errors (Absolute Error > 0.1) decreased to 30%, indicating a notable improvement in the model's ability to generalize to sparse data regions. Further analysis of the weight distributions between the centralized training model and the federated learning model reveals differences in their learning behaviors. The weight distribution in the centralized model is narrower, suggesting more consistent and less variable weight updates. This is attributed to the fact that the weights are not affected by the training model. Figure 14: Prediction performance of federated models after data balancing. Figure 15: Comparison of balanced, imbalanced, and original training results. \begin{table}
\begin{tabular}{c c c} \hline \hline
**Absolute Error** & **Sample Proportion** & **Sample** \\ \hline \(<\)0.025 & 26.03 & 76 \\
0.025–0.05 & 15.41 & 45 \\
0.05–0.075 & 11.30 & 33 \\
0.075–0.1 & 17.12 & 50 \\ \(>\)0.1 & 30.14 & 88 \\ \hline \hline \end{tabular}
\end{table} 
Table 3: Federated training results based on balanced data. fact that the model was trained on the entire dataset globally, allowing for more stable convergence.