2.3.1. 1D-CNN

A convolutional neural network (CNN) usually consists of an input layer, convolutional layer (Conv), pooling layer (Pooling), dense layer (Dense), and output layer. In the CNN architecture, the first few layers usually alternate between convolutional layers and pooling layers, and the last few layers close to the output layer are composed of dense layers. CNN is an end-to-end learning method model, which can use the existing supervised gradient descent algorithm to train the model. For time-series-processing problems, the effect of a one-dimensional convolutional neural network (1D-CNN) can be comparable to a recurrent neural network (RNN), and the computational cost is much smaller. For simple tasks such as time series classification, a small one-dimensional convolutional network can completely replace the RNN, and it runs faster [21].

Regardless of whether one-dimensional or two-dimensional convolution is used, convolutional neural networks have a similar structure. The structure starts with a stack of convolutional and pooling layers, and then connected to a flatten layer to convert twodimensional features into one-dimensional output, and then multiple dense layers can be added for classification or regression. However, there is a little difference between them: one-dimensional convolutional neural networks can use larger convolution kernels [21]. For example, for a two-dimensional convolution layer, a 3 × 3 convolution kernel contains 3× 3 = 9 convolution vectors; however, for a one-dimensional convolution layer, a convolution kernel of size 3 only contains 3 convolution vectors. Therefore, a one-dimensional convolution kernel greater than or equal to 9 can be easily used.

**Figure 3.** Comparison chart before and after data expansion. (**a**) Data expansion for outlier data; (**b**) Data expansion for drift data.

The Python Science Suite, Tensorflow, and Keras are used to build a neural network architecture with GPU acceleration. The processor and graphics card types of the hardware platform are Inter Core i5-9400F and Nvidia GeForce RTX 2070. The object function in CNN is set to categorical cross-entropy to estimate the difference between the actual data category and the predicted data category. The metric is set to the accuracy to evaluate the performance of the model. In order to minimize the output of the object function, an adaptation of the mini-batch stochastic gradient descent algorithm called Adam is used as an optimizer.

In the classification, the imbalanced training set needs to be considered; that is, the number of normal samples is much larger than the abnormal samples. If an imbalanced training set is used to train the network, all abnormal samples will be predicted as normal samples during the test, and there will still be a high accuracy, but this is meaningless. Therefore, we choose to use the class weight technique [22], which can make important

categories of samples contribute more to the object function during training. Batch Normalization (BN) [23,24] is a method that has been widely used in deep network training. The method of adding BN after the convolutional layer and then adding the activation function can save the operator from adjusting the parameters deliberately and slowly. Figure 5 shows the workflow of the proposed method.

**Figure 4.** Before and after data preprocessing and down-sampling. (**a**) Preprocessing and downsampling of trend data; (**b**) Preprocessing and down-sampling of normal data.

**Figure 5.** Workflow of the proposed method.
