# Fault Diagnosis of Railway Point Machines Using the Locally Connected Autoencoder
## 3 Methodology
### The Proposed Locally Connected Autoencoder
The signal \(\mathbf{s}_{n}\) is equally segmented into \(Q_{n}\) subsequences  
\[\mathbf{s}_{n}=\{\mathbf{s}_{n}^{1},\mathbf{s}_{n}^{2},\cdots,\mathbf{s}_{n}^{Q_{n}}\},Q_{n}= \lfloor|\mathbf{s}_{n}|/M_{\text{loc}}\rfloor,\]  
where \(M_{\text{loc}}\) denotes the window size, \(\mathbf{s}_{n}^{i}\in\mathfrak{R}^{M_{\text{loc}}\times 1}\), and \(i\in\{1,2,\cdots,Q_{n}\}\). Note that the number of segments generated by \(\mathbf{s}_{n}\) may not be the same, as different signals typically consist of a different number of points. Different from the existing methods [21; 22; 23; 24], to obtain richer feature representations, in this paper, we propose a new network structure--the locally connected autoencoder--to enhance the temporal characteristics by preserving the linear regularities among subsequences. Inspired by the word2 vec method [17], we define  
\[\mathbf{\hat{s}}_{n}^{i}=\mathbf{s}_{n}^{i-1}\oplus\mathbf{s}_{n}^{i}\oplus\mathbf{s}_{n}^{i+1}, \tag{2}\]  
where \(\oplus\) represents vector addition. Using Equation (2), we create a new dataset \(\mathbb{\tilde{S}}=\{\mathbf{\hat{s}}_{1},\mathbf{\hat{s}}_{2},\cdots,\mathbf{\hat{s}}_{N}\}\), where  
\[\mathbf{h}_{i}=f(\mathbf{s}_{i};\Theta),\]0  
\(\mathbf{\hat{s}}_{n}^{i}\) is fed into the encoder and the locally connected encoder is used to extract the local feature from \(\mathbf{s}_{n}^{i}\). We randomly select the segments \(\mathbf{\hat{s}}_{n}^{i}\in\mathfrak{R}^{M_{\text{loc}}\times 1}\) from the dataset \(\mathbb{\tilde{S}}\) to compose the local training set. Then, \(\mathbf{W}\in\mathfrak{R}^{K_{\text{loc}}\times M_{\text{loc}}}\), \(\mathbf{b}\in\mathfrak{R}^{K_{\text{loc}}\times 1}\), \(\mathbf{W}^{\prime}\in\mathfrak{R}^{M_{\text{loc}}\times K_{\text{loc}}}\), and \(\mathbf{W}^{\prime}\in\mathfrak{R}^{M_{\text{loc}}\times 1}\) are trained in the network, where \(K_{\text{loc}}\) denotes the hidden size. In the encoder part, \(\mathbf{W}\) and \(\mathbf{b}\) are used to map \(\mathbf{\hat{s}}_{n}^{i}\) into the feature space, whereas \(\mathbf{W}^{\prime}\) and \(\mathbf{b}^{\prime}\) are employed to reconstruct \(\mathbf{\hat{s}}_{n}^{i}\). The minibatch gradient descent method is employed with \(N_{s}\) samples. Equation (1) can be rewritten as  
\[\mathbf{h}_{i}=f(\mathbf{s}_{i};\Theta),\]1  
where \(\sigma_{f}(\cdot)\) is defined as the hyperbolic tangent function, i.e., \(tanh(\cdot)\), to capture the nonlinear relationship, whereas \(\sigma_{g}(\cdot)\) is set as the linear function. The hyperbolic tangent function can be written as  
\[\mathbf{h}_{i}=f(\mathbf{s}_{i};\Theta),\]2  
The backpropagation algorithm and minibatch gradient descent method are used to train and update all the parameters to reduce the reconstruction error, where the Adam optimizer is adopted. In addition, the early stopping mechanism is used to limit overfitting. The derivations of the training process are not covered in this paper due to space restrictions. One can refer to the work in [25] for a detailed description. After the training process, the local feature \(\mathbf{h}_{\text{loc}}^{n,i}\in\mathfrak{R}^{K_{\text{loc}}\times 1}\) of the segment \(\mathbf{s}_{n}^{i}\) can be calculated as  
\[\mathbf{h}_{i}=f(\mathbf{s}_{i};\Theta),\]3  
The encoding result \(\mathbf{h}_{\text{loc}}^{n,i}\) preserves useful information of the segment \(\mathbf{s}_{n}^{i}\) and can be used to form the representation of the original signal \(\mathbf{s}_{n}\).