# Applying Machine Learning to Preselective Weighing of Moving Vehicles
## 4 Vehicle Weight Estimation Model Using Machine Learning Algorithm
### Development of a Model for Vehicle Weight Estimation Using the XGBoost Algorithm
Additionally, the MAPE results, representing the average percentage error of the model in estimating vehicle weight, are approximately 12% in both cases, which is surprisingly low, considering the model inputs. RMSE is significantly lower for the Osowiec location compared to Grodziec, suggesting a considerably lower number of outlier predictions in the former. These differences in model prediction variances may indicate variations in data distributions between locations, which could pose challenges for generalization across different areas. Investigating these generalization capabilities could be an interesting direction for future research. In both locations, the model showed high performance, with R\({}^{2}\) = 0.941 for Grodziec and R\({}^{2}\) = 0.956 for Osowiec. These results mean that the model represents the variability of actual vehicle weight values very well, confirming the effectiveness of the XGBoost algorithm used. The lower RMSE value for Osowiec (3.123) compared to Grodziec (8.289) means that the model better predicts the weight of vehicles in Osowiec. This may be due to the larger number of training samples in Osowiec, which allowed the model to better adapt to the data. A MAPE of 12.5% for Grodziec and 11.7% for Osowiec indicates little difference in model performance between locations. The model in Osowiec is minimally more accurate, suggesting that the data at this location may be more homogeneous or less susceptible to noise. The better results in Osowiec may suggest that more training samples or a more homogeneous dataset improves prediction quality. Further research will focus on optimizing the model for more diverse road conditions, which could improve accuracy in locations with more complex data structures. The results presented in the article show the high efficiency of the XGBoost model applied in the context of weigh-in-motion (WIM) systems. The scalability and speed of XGBoost calculations are key advantages in the context of processing large datasets. Neural networks (deep learning), especially deep networks (DNNs), are known for their ability to detect complex patterns in data. In cases where data are highly nonlinear or features have complex relationships, neural networks can outperform other ML techniques in terms of accuracy. Neural networks require large computational resources and longer training times. In addition, they are prone to overfitting, especially when the dataset is limited or contains noise. For WIM systems, neural networks can be a redundant tool, especially when the data are well structured. Support vector machines (SVMs) work well with smaller and high-dimensional datasets. This technique is effective for classification and regression, especially when the problem is linearly separable or has a small number of nonlinear relationships. The main limitation of SVM is its lack of scalability for large datasets such as those used in the article (millions of records). Compared to XGBoost, SVMs can be less efficient and more time-consuming in processing large amounts of data. Applied XGBoost combines the advantages of both neural networks and SVMs, eliminating many of their disadvantages. The algorithm copes with processing billions of records thanks to parallel and distributed processing optimizations. The results show that XGBoost achieves very high fit rates (R\({}^{2}\)) and low prediction errors (MAPE), demonstrating its effectiveness in modeling the mass of moving vehicles. The model easily adapts to complex data structures thanks to its ability to fine-tune hyperparameters. XGBoost is optimized for speed, making it an ideal choice for applications requiring fast data analysis, such as WIM systems. A comparison of XGBoost with other machine learning techniques confirms its superiority in the context of WIM applications. Although neural networks could achieve similar accuracy, their computational cost and risk of overfitting make them a less practical choice.