## 2 Machine Learning and Defect Size: Algorithms
### Process Parameters and Defects in AM Components  
The objective of the present work is to assess the probability associated with a defect with a specific size or the defect size distribution for a given set of process parameters used in the SLM process. Indeed, the defect population is mainly controlled by the set of process parameters adopted to manufacture the components [6; 11]. Given the defect size expected in the component volume, or its probability of occurrence, the component can be reliably designed with the available damage-tolerant approaches employed in the literature. However, the estimation of the defect size in the component volume requires expensive and time-consuming experimental tests or micro-CT inspections, which can only be performed after having manufactured the parts. By employing ML algorithms, the defect distribution can be assessed beforehand, overcoming the above-mentioned criticalities.  
The following process parameters are considered as the input of developed neural networks:  
* _Building orientation_: several experimental results have proved the influence of the building orientation on the defect size and, accordingly, on the fatigue strength. In the following, with 0\({}^{\circ}\) and 90\({}^{\circ}\) the authors refer to a building orientation with the specimen axis parallel and perpendicular to the building platform (horizontal and vertical building orientation), respectively [23; 24].  
Figure 1: Typical defects in AM parts: (**a**) pores; (**b**) lack of fusion defect.  
* _Power_ and _scan speed_: these two parameters are strongly correlated, since the energy per unit length, dependent on both input power and scan speed, controls the formation of pores or lack of fusion defects [25].
* _Hatch distance_: the hatch distance has proven to significantly affect the defect size. Indeed, the defect size tends to reduce as the hatch distance is reduced [9; 26], and large hatch distances can be responsible for the formation of large pores, according to [26].
* _Layer thickness_: this parameter is known to affect the defect density [11; 27].
* _Powder size_: the powder size affects the defect formation. For example, in [28; 29], it has been shown that defects tend to be larger in parts produced with smaller powder, thus affecting the fatigue response. In the following analysis, the average powder size has been considered as the input parameter for the developed ML algorithms.  
These process parameters mainly affect the defect size population and, accordingly, the fatigue response. Together with the process parameters, another important factor to be considered for a damage-tolerant design against fatigue failures is the loaded volume. Indeed, according to [4], the larger the material volume, the larger the probability of more critical defects. In other words, the likelihood of large defects increases in large material volumes. This is a well-known size effect [30]. Accordingly, the loaded volume must necessarily be considered as the input of the developed ML algorithm, since the objective of this work is to assess the most critical defect for the design of components. In the following, the risk-volume, or the V\({}_{90}\), i.e., the material volume subjected to a stress amplitude above 90% of the maximum applied stress, is considered as the loaded volume. This parameter can reliably model the volume at risk of crack nucleation in components subjected to fatigue loads [4]. Indeed, considering the whole component volume can be rather conservative, since it has been shown experimentally that only the region subjected to a stress amplitude close to the maximum stress is at risk of crack nucleation [4] and, moreover, AM components are generally subjected to a non-uniform stress amplitude.