# Towards Explainable Augmented Intelligence (AI) for Crack Characterization
## 3 The AutoNDE Code for Semi-Automatic Crack Characterization
### Signal Processing  
The submodules of the Signal Processing module are used to create 2D images of the tested specimen:  
1. _SurfaceProfiling_ effects profiling by (1) locating for each array element the surface point directly underneath and (2) interpolating the acquired surface points using polynomial regression. The first step is performed by convolving \(h(A)(N\Delta t-t)\), the Hilbert transform of the time inverse of the input pulse with the corresponding pulse scattered by the surface. Only A-scans received by the same transducers that  
Figure 3: A flowchart of AutoNDE. transmitted them are utilized. Hence the maximum number of surface points collected during the first step is K. The regression model used in interpolation is  
\[\mathbf{z}=\mathbf{X}\,\mathbf{b}+\mathbf{e}, \tag{2}\]  
where the response vector \(\mathbf{z}\), the parameter vector \(\mathbf{b}\), the design matrix \(\mathbf{X}\) and the error vector \(\mathbf{e}\) are given, respectively, by  
\[\mathbf{z}=\left[ \begin{array}{c}z_{1}\\ z_{2}\\ \ldots\\ z_{J}\end{array} \right],\ \mathbf{X}=\left[ \begin{array}{c}1\ x_{1}\ x_{1}^{2}\ \ldots\ x_{p}^{p}\\ 1\ x_{2}\ x_{2}^{2}\ \ldots\ x_{2}^{p}\\ \ldots\ \ldots\ \ldots\ \ldots\ \ldots\\ 1\ x_{J}\ x_{J}^{2}\ \ldots\ x_{J}^{p}\end{array} \right],\ \mathbf{b}=\left[ \begin{array}{c}b_{1}\\ b_{2}\\ \ldots\\ b_{p}\end{array} \right],\ \mathbf{e}=\left[ \begin{array}{c}e_{1}\\ e_{2}\\ \ldots\\ e_{J}\end{array} \right] \tag{3}\]
* Originally, the polynomial degree to produce good results with the DPS data has been found by trial and error to be \(p=8\). * In the latest version of AutoNDE the degree \(p\) is selected automatically. There is a number of approaches recommended for this purpose in the literature on machine learning. We have found that the most common of those, the bias-variance trade-off leads to ill-conditioned the Vandermonde matrix \(X^{T}X\) and overfitting of the DPS data. Since for all DPS datasets _SurfaceProfiling_ acquires surface points whose location error is random it is reasonable to assume that their underlying error distribution is normal. Therefore, we attempted and found satisfactory a method that involves the Wald test [18] based on the t-statistic of the leading coefficient. * In order to apply this method we first estimate \(p_{max}\) and \(q_{max}\), where \(p_{max}\) is the highest polynomial degree that can be reliably estimated from the available data and \(q_{max}\) is the maximum number of digits of accuracy on top of what would be lost to the numerical method due to loss of precision from arithmetic methods [19]. A well-known rule-of-thumb suggests that \(p_{max}=J/5\) and the training of AutoNDE on the DPS data suggests that for realistic random surface undulations used in this experiment \(q_{max}=6\). * The suggested method utilizes the algorithm presented in Figure 4. Note that since all \(X_{J/2}\) values are non-zero and distinct for every \(p=p^{\prime}\) all Vandermonde matrices \(X^{T}X\) are invertible [20]. Note too that the t-statistic is normally applied to assess significance of regression parameters, while here \(t_{pr}\) is used to test the null hypothesis that the leading coefficient \(b_{pr}=0\). It follows that the algorithm selects the polynomial of the highest significant degree. The threshold \(t_{p}=1.96\) assures that if the error in location of surface points has a normal distribution, the null hypothesis that the leading coefficient is zero can be rejected at the 95% significance level. The spline method has been tried too but was found to be too sensitive to the choice of smoothing parameters and thus not amenable to automation  
1. _Meshing_ of the specimen is performed by specifying a regular grid of evenly spaced rows and columns, covering the portion of the specimen, which lies underneath the probe. The meshing module also specifies the region of interest.