# Status Recognition of Marine Centrifugal Pumps Based on a Stacked Sparse Auto-Encoder
## 2 SSAE Model  
An auto-encoder (AE) [31] is an unsupervised learning neural network model that automatically learns the features of raw data and consists of input, hidden, and output layers. Its network structure is shown in Figure 1. The coding network is composed of an input layer and a hidden layer, and the decoding network is composed of a hidden layer and an output layer. The coding network extracts the features from the original data, and the decoding network restores the input data through the features. In Figure 1, \(\mathbf{X}=[X_{1},X_{2},\cdots,X_{n}]^{T}\) is the input to the network, and \(n\) is the number of nodes in the input layer of the network, representing the sample data dimension. The hidden feature \(\mathbf{h}\) of the original data \(\mathbf{X}\) obtained through the coded network is calculated as follows:  
\[\mathbf{h}=f(\mathbf{W}\mathbf{X}+b) \tag{1}\]  
where \(\mathbf{h}\) is the feature parameter extracted by coding; \(f\) is the activation function used in the coding process, for which Sigmoid is generally selected; \(\mathbf{W},b\) are the weights and biases used in the coding phase, respectively; and the dimension of \(\mathbf{W}\) is \(s\times n\), where \(s\) is the dimension of the feature parameter. The decoding network is used to reconstruct the original input data, and the reconstructed data \(\mathbf{Y}\) can be obtained after decoding the hidden feature \(\mathbf{h}\) of the data, as follows:  
\[\mathbf{Y}=U(\mathbf{W}\mathbf{h}+b\mathbf{r}) \tag{2}\]  
where \(\mathbf{Y}=[Y_{1},Y_{2},\cdots,Y_{n}]^{T}\) is the network's output data; \(U\) is the activation function used in the decoding process, for which Sigmoid is generally selected; \(\mathbf{W}\) and \(b\mathbf{r}\) are the weights and biases used in the coding phase, respectively; and \(\mathbf{W}=\mathbf{W}^{T}\). The AE uses backpropagation and stochastic gradient descent algorithms to optimize the parameter set \(\theta=\{\mathbf{W},b,\mathbf{W},b\}\) in order to minimize errors between input and output data. In general, the mean square error function is defined as a loss function, which is as follows:  
\[J_{MSE}(\theta)=\frac{1}{m}\sum_{i=1}^{m}\frac{1}{2}\|\mathbf{X}^{(i)}-\mathbf{Y}^{(i) }\|^{2} \tag{3}\]  
where \(m\) is the total number of training samples; and \(\mathbf{X}^{(i)},\mathbf{Y}^{(i)}\) are the original data and output data of the \(i\) sample, respectively. The sparse auto-encoder (SAE) [32] is constructed by adding a sparse penalty term to the cost function of an AE. The SAE can learn more abstract and representative compression features and has great potential. The sparse penalty term is defined as follows:  
\[J_{spare}(\theta)=\beta\sum_{j=1}^{s}KL(\rho\parallel\widetilde{\rho}_{j}) \tag{4}\]  
Figure 1: AE structure. \[KL(\rho\parallel\widehat{\rho}_{j})=\rho\log_{2}\frac{\rho}{\widehat{\rho}_{j}}+(1- \rho)\log\frac{1-\rho}{1-\widehat{\rho}_{j}} \tag{5}\]  
\[\widehat{\rho}_{j}=\frac{1}{m}\sum_{i=1}^{m}\left(a_{j}X^{(i)}\right) \tag{6}\]  
In Formula (4), \(\beta\) is the sparse penalty factor, which is used to control the weight of the sparse penalty term in the loss function; \(s\) is the dimension of the hidden layer; \(\widehat{\rho}_{j}\) is the average activation value of the hidden unit; and \(\rho\) is the sparse parameter. Formula (5) is the relative entropy calculation formula, which is used to measure the degree of deviation between the two distributions. Formula (6) calculates the average activation value of the hidden unit, where \(a_{j}\) indicates the amount of activity in the \(j\) unit of the hidden layer. Formula (7) is the loss function of the SAE; the first term is the mean square error function, the second term is the sparse penalty term. \[J(\theta)=J_{MSE}(\theta)+J_{sparse}(\theta) \tag{7}\]  
An SSAE is a deep neural network model composed of multiple SAEs. By taking the hidden layer of the previous SAE as the input of the next SAE, each hidden layer is a non-linear mapping representation of the output of the previous layer.