## 2 Materials and Methods
### Regression Analysis
#### 2.3.2 Segmented Nonlinear Regression  
Segmented nonlinear regression--also known as piecewise regression--is a regression analysis method that partitions the independent variable data into segments, and fits each segment using linear regression methods. Dynamic programming (DP) [11] and greedy merging [12; 13; 14; 15] are the existing approaches for finding the breakpoint locations of the input data and fit line equations for each segment. Although DP [11] has shown promising results, it is not practical for implementation on massive data points, due to its quadratic running time, \(O(n^{2})\)[13; 14]. In this paper, here we implement a greedy merging approach by [PERSON] et al. [14] that has achieved efficient computation with the tradeoff of a slight decrease in precision. Algorithm 1 is the pseudocode for the entire process of segmented nonlinear regression with greedy merging. The algorithm initially makes a partition of \(n\) number of data points into \(n\) segments with a length of 1. Then, it performs the least square method to calculate the loss of a linear function for merging neighboring pairs of segments. [PERSON] et al. have defined the error of merging two adjacent segments \(S_{2c-1}\) and \(S_{2c}\) as:  
\[\epsilon_{c}=\|y_{c}-X_{c}\alpha_{c}\|_{2}^{2}-s^{2}|S_{2c-1}\cup S_{2c}| \tag{9}\]  
where \(c\) is the index for the two segments, \(y_{c}\) is the true value of the data points of the two segments, \(X_{c}\) are the input data points of the two segments, \(\alpha_{c}\) is the weight of least square fit, \(X_{c}\alpha_{c}\) is the prediction, and \(S\) is the set of all segments. In simple terms, the merging error is the mean-squared error of the pair of segments subtracted by variance \(s^{2}\) times the length of the pair of segments. Consequently, Algorithm 1 merges the pairs when the pairs are not one of the \(\tau\)-largest errors, where \(\tau\) is a hyperparameter. The merging processes continue until they met the target number of segments \(T\). ``` FunctionGreedyMerging(\(s\),\(T\), \(X_{n},y_{n}\)): /* Perform partition of \(n\) data points into segments of length 1 */ \(S\leftarrow\{\{1\},\{2\},...,\{n\}\}\) \(i\gets 0\) /* Merge the segments in a greedy way with \(T\) as the target number of segments. */ while\(|S_{i}|>T\)do  Let \(m_{i}\) be the current number of segments. for\(c\in\{1,2,...,\frac{m_{i}}{2}\}\)do /* Calculate the least squares \(LS\) fit. */ \(\alpha_{c}\gets LS(X,y,S_{2c-1}\cup S_{2c})\) /* Calculate the merging errors */ \(\epsilon_{c}=\|y_{c}-X_{c}\alpha_{c}\|_{2}^{2}-s^{2}|S_{2c-1}\cup S_{2c}|\)  end for  Let \(A\) be the set of indices \(c\) with the \(\tau\)-largest errors \(\epsilon_{c}\). Let \(B\) be the set of the other indices. /* Keep the segments unmerged with large merging errors. */ \(S_{i+1}\leftarrow\cup\limits_{c\in A}\{S_{2c-1},S_{2c}\}\) /* Merge the other segments. */ \(S_{i+1}\gets S_{i+1}\cup\{S_{2c-1}\cup S_{2c}|c\in B\}\) \(i\gets i+1\)  end for return\(S\) // the least squares fit to the data on every segment in

## 3 Experiment Details

### Data Preprocessing

In the experiment to evaluate our approach, we have gathered data from four crack sensors in two different facilities. We label the data from the first position of the first facility as Crack A1, and the data from the second position of the first facility as Crack A2. Similarly, we put labels to the data from the second facility at respective positions as Crack B1 and Crack B2. We perform data collection for each crack sensor at a distinct time frame. Specifically, we have collected Crack A1 and Crack A2 data from 25 February 2019 to 31 August 2019, and from 1 June 2019 to 31 July 2019, respectively. As for Crack B1 and Crack B2, we have accumulated them from 21 June 2019 to 31 August 2019 and from 13 June 2019 to 31 August 2019, respectively. We discover two issues from the sensor data at all facilities. The first issue is that the sampling rates are not consistent, and the second issue is that there are many missing values.