## 2 Materials and Methods
### Regression Analysis
#### 2.3.2 Segmented Nonlinear Regression
We conjecture that these problems happen due to either transmission error or device glitch. We perform downsampling to establish a consistent sampling rate, which decreases the original sampling rate into hourly intervals and computes the mean value in each hour. To address the missing values, we apply linear interpolation between two data points where the gap happens. Figure 2 shows the results of preprocessed data with the interpolation of Crack A1 data. Overall, we preprocess the data into 4513 data points for Crack A1, 1465 data points for Crack A2, 1729 data points for Crack B1, and 1907 data points for Crack B2. Since we are dealing with time-series data, we split them such that the first 90% sequences are a training set and the last 10% are a test set. Figure 3 illustrates the general data splitting strategy used in this paper. We will detail this strategy in the next section. Figure 3: Illustration of training and test data split of time-series data. Figure 2: Preprocessed data: the blue line shows the data points after linear interpolation filled the gap of missing values in the Crack A1 data. ### Sliding Window

Since LSTM and Seq2 Seq LSTM need a fixed sequence of data as an input to train the model and to make inferences from the model, we applied data reshaping with a fixed-length sliding window. The fixed-length window slides through the preprocessed data that eventually formed several batches of fixed sequence data. Then, we feed these batches into both LSTM models and Seq2 Seq LSTM models as inputs for training. Subsequently, we perform batch training that enables fast and efficient computation. Additionally, the batches with the sliding window ensure that the model can capture the lagged dependencies in the whole sequence of data. As an illustration, let the sequence of toy data \((x_{1}...x_{8})\) and the fixed-length sliding window with a length of 6 in LSTM operate as follows. The fixed-length window in the first batch covers from \(x_{1}\) to \(x_{6}\). Then, the window slides to the next sequence comprising \(x_{2}\) to \(x_{7}\). Afterward, the window proceeds to the next sequence containing from \(x_{3}\) to \(x_{8}\). Lastly, we set the last data point in each batch as the ground truth that we compare with the output of LSTM. In our experiment, we choose 100 as the length of the sliding window in the training setup for LSTM, and select the 100 th data point as the ground truth. We illustrate this sliding window mechanism in Figure 4. As aforementioned, we labeled the last data point in each batch as ground truth to calculate the gradient. As for Seq2 Seq LSTM, we perform a fixed-length sliding window operation that is similar to what has previously been described, but with a slight change. We divide the sequence sampled by the sliding window in half, which produces two new sequences. We select the first sequence as input for the encoder, and the rest as the ground truth to compare with the decoder's prediction. We move the fixed-length window to stride as long as the length of the ground truth to prevent the network from peeking the future for every batch. In the experiment, we use the sliding window with a length of 256 and divide it into two sequences, where the length of each sequence is 128. Figure 5 illustrates the sliding window process in Seq2 Seq LSTM on the toy data. Figure 4: Illustration of the sliding window operation for LSTM on toy data. Blue boxes denoted as input data for LSTM, red boxes denoted as ground truth that needed to be predicted using LSTM, and orange rectangles are the sliding windows. Note that we do not perform data reshaping for the linear regression method and the segmented nonlinear regression method we have applied, because we let them process one data point at one time step. ### Model Hyperparameters

To make a fair comparison between the LSTM and Seq2 Seq LSTM model, we train both models with similar hyperparameters. Both models consist of two stacked LSTMs, 64 hidden units, and a fully connected layer as an output layer.