## 4 Conclusions  
This study successfully integrates machine learning (ML) with CFD simulations of the masked cold spray additive manufacturing process. It introduces an ML framework that surpasses conventional models by accurately predicting the localized distributions of particle spatial positions, velocities, and temperatures in masked cold spray processes. Unlike previous approaches that focused on average values, our model combines multiple algorithms to improve the precision of \"local\" particle behavior predictions. The approach employs a two-layer ML framework in which the first layer utilizes a KNN-KDE-based prediction module--enhanced with adaptive bandwidth adjustment, weight assignment based on physical priors, and a projection algorithm to reallocate predictions from dead zones--to accurately capture the spatial distribution of particles on the substrate. After 200 Chatgpt-based optimization trials, this module attains a mean KL divergence of 0.291784 on the test set while constraining local mass balance error, with zero particles erroneously assigned to dead zones. Building on these spatial predictions, the second layer employs a weighted random forest model that precisely predicts key dynamic parameters, notably the normal impact velocity (\(u\)) and temperature (\(T\)) of each particle upon impact. For a test set, the second model reproduced \(u\) and \(T\) with mean absolute errors of 2.21 m s\({}^{-1}\) and 5.45 K, respectively, and the predicted ranges (400-700 m s\({}^{-1}\) for \(u\), 550-820 K for \(T\)) closely matched the CFD ground truth (420-750 m s\({}^{-1}\), 550-820 K). Together, the combined framework effectively replicates both the deposition patterns and the thermal and kinetic characteristics observed in the CFD simulations, thereby significantly reducing computational costs while maintaining high predictive fidelity for both the spatial and dynamic aspects of the process. The ML model is effective in fabricating pin fin geometries on substrates and enhancing nickel-based electrodes for improved electrocatalytic performance in hydrogen evolution reactions. Furthermore, by accelerating the simulation process with acceptable errors, developing this model can be considered an important step toward creating real-time digital twins for cold spray systems. Notably, the model can be slightly modified and simplified to predict particle distribution, normal impact velocity, and temperature in scenarios where deposition occurs on a flat substrate without a mask. In other words, while the current study tackled a more complex scenario, the model can be adapted for applications without a mask.  
**Author Contributions:** Methodology, L.W. and M.J.; validation, L.W.; investigation, L.W. and M.J.; conceptualization, M.J.; writing--original draft, L.W.; writing--review and editing, M.J.; supervision, A.D.; project administration, A.D. All authors have read and agreed to the published version of the manuscript.  
**Funding:** This research received no external funding.  
**Institutional Review Board Statement:** Not applicable.  
**Informed Consent Statement:** Not applicable.  
**Data Availability Statement:** The raw data supporting the conclusions of this article will be made available by the authors upon request.  
**Conflicts of Interest:** The authors declare no conflicts of interest.