## 4 Methodology
### A Feature Extraction Network-Based CNN  
CNNs are important variants of neural networks, which have been widely used in many fields, such as computer vision, natural language processing, and image and sequence feature extraction [35]. CNNs mainly include convolutional layers, pooling layers, activation layers, and other structures. As shown in Figure 3, in this paper, we utilized a one-dimensional convolutional layer and a pooling layer to construct a feature extraction network. The main principles of one-dimensional convolutional layers and pooling layers are as follows. * One-dimensional convolutional layer. Convolutional layers perform discrete convolution operations on input data through convolutional kernels, thereby extracting the features of the input data. Multiple convolution kernels can be used to extract different features of input data. Assuming that \(k=(k_{1},k_{2},k_{3},\ldots,k_{M})\) is a one-dimensional convolutional kernel, \(x=(x_{1},x_{2},x_{3},\ldots,x_{N})\) is a data record and \(y=(y_{1},y_{2},y_{3},\ldots,y_{N-M+1})\) is the result of one-dimensional convolutional. The \(j\)-th element of \(y\) is as shown in Formula (2). \[y_{j}=\sum_{m=1}^{M}k_{m}\cdot x_{j+m-1}\] (2) where \(N\) denotes the dimensions of the data record and \(M\) denotes the size of the convolutional kernel. * Pooling layers In CNNs, pooling layers are used to reduce the size of feature maps while expanding the receptive fields of the next-level neural networks. There are several types of pooling layers, including mean pooling, max pooling, stochastic pooling, and min pooling. Figure 3: The overall framework of the proposed approach. The feature extraction network proposed in this article was constructed based on the CNN network structure. In this feature extraction network, the convolutional calculation process of the one-dimensional convolutional network is used to extract all of the specific lengths of the subsequences from the input data. Afterward, we designed a neural network layer that can calculate the distance between each shapelet and subsequence of input data, equal in length to each shapelet. Finally, a min pooling layer is used to obtain the distance between each shapelet and the input data (please refer to Formula (1)). Assuming that the input sequence length is 500, the number of shapelets is 7, and the shapelet length is 400, the proposed feature extraction network is as shown in Table 2.  
The main steps of the feature extraction network proposed in this paper are as follows. Step 1: Extract the subsequences of the input data. By designing a convolutional kernel for a one-dimensional convolutional neural network, we can extract all subsequences that are the same lengths as the shapelets from the input data. Assuming that the length of the shapelet to be extracted is \(M\), the length and number of convolution kernels should also both be \(M\). At this point, the \(i\)-th element of the \(j\)-th convolution kernel is as shown in Formula (3). \[k_{i}^{j}=\left\{ \begin{array}{ll}1,i=j\\ 0,i\
eq j\end{array} \right. \tag{3}\]  
After determining the weights of all convolutional kernels, they are locked, meaning that they do not participate in the subsequent training process. Using the above processing, all subsequences of input data that are of the same length as the shapelets can be obtained. For example, when the length of a shapelet is \(M\) and the length of the input data sequence is \(Q\), we can obtain \(Q-M+1\) subsequences with a length of \(M\). Step 2: Calculate the distance between each shapelet and each subsequence. In order to calculate the distance between each shapelet and the subsequences obtained in Step 1, we designed a squared distance neural network layer to achieve squared distance calculation. The number of weights in this layer depends on the length and number of shapelets. For example, if the length of a shapelet is \(M\) and the number of shapelets is \(K\), then the number of weights in the squared distance layer is \(M\times K\).