**3.4. BPN classifier**

Finally, this feature extraction by the PCA is fed into the short-term classifier and long-term classifier sequentially, and then output the AUV conditions. In order to detect the AUV condition accurately, reliably, stably, and robustly, we divided the recognition system into three classifiers which are based on BPN. BPN is considered the workhorse of ANNs and is the multilayer perceptron (MLP) based on a feed-forward algorithm. The hidden layers, between input and output layers, use the error backpropagation (BP) algorithm to compute the nonlinear relationship in supervised learning as shown in **Figure 7**. The main features of BPN are as follows: high learning accuracy, fast response, and ability to process the nonlinear problems.

In this chapter, a three-layer BPN is used for classifying AUV failure conditions. The topology of the BPN classifier is shown in **Figure 7** [26]. The input layer has R neurons, equal to the dimension of the feature vectors *I* ¼ *I* ð Þ1 <sup>1</sup> *; I* ð Þ1 <sup>r</sup> *;* …*; I* ð Þ1 R h i*<sup>T</sup>* , where superscript 1 indicates the first layer. The hidden layer has J neurons, and the output layer has P neurons, equal to the number

**Figure 6.** Attitude data with a long-term window, which consists of many overlapping short-term windows.

**Figure 7.** The topology of the BPN classifier.

of AUV conditions *<sup>O</sup>* <sup>¼</sup> *<sup>O</sup>*ð Þ<sup>3</sup> <sup>1</sup> *; <sup>O</sup>*ð Þ<sup>3</sup> <sup>p</sup> *;*…*; <sup>O</sup>*ð Þ<sup>3</sup> P h i*<sup>T</sup>* , where superscript 3 indicates the third layer. *w*ð Þ<sup>3</sup> *pj* and *<sup>w</sup>*ð Þ<sup>2</sup> *jr* denote the weight from the hidden to the output layer and from the input to the hidden layer, respectively. *b*ð Þ<sup>3</sup> and *b*ð Þ<sup>2</sup> denote the bias in the third and second layers, respectively. *i* ð Þ <sup>n</sup> and *o*ð Þ <sup>n</sup> are the input value and the activation of a neuron in the nth layer f g *n*∈ *N* : *n* ≤ 3 . We take the interval between the hidden layer (second) and the output layer (third) as an example. The function of the neurons in each step is defined as follows [27]:

In the BPN, the intermediate quantity *net*ð Þ<sup>3</sup> *<sup>j</sup>* is the weighted input to the neurons in the third layer, and implements a nonlinear transformation from the output values of the second layer to the output values of the third layer. *σ* is called the sigmoid function and is in general nonlinear and differentiable. The functions of the pth neuron are given by:

$$
\sigma\_p^{(3)} = \sigma \left( net\_{\dot{j}}^{(3)} \right) = \sigma \left( \sum\_{j=1}^{l} w\_{p\dot{j}}^{(3)} o\_{\dot{j}}^{(2)} + b\_p^{(3)} \right) \tag{13}
$$

The discrepancy *E*ð Þ<sup>3</sup> between the desired output *t* ð Þ3 *<sup>p</sup>* and the real output *O*ð Þ<sup>3</sup> *<sup>p</sup>* in the third layer can motivate the BP learning algorithm as gradient descent on the sum-squared discrepancy. The factor of 1*=*2 will simplify the exponent when differentiating later. The function is defined as:

$$\mathbf{E}^{(3)} = \frac{1}{2} \sum\_{p} \left( t\_p^{(3)} - O\_p^{(3)} \right)^2 \tag{14}$$

Then, the weights are adjusted to find the partial derivative *E* with respect to a weight *w*ð Þ<sup>3</sup> pj : Δ*w*ð Þ<sup>3</sup> pj <sup>∝</sup> � *<sup>η</sup> <sup>∂</sup>E*ð Þ<sup>3</sup> *<sup>=</sup>∂w*ð Þ<sup>3</sup> pj � �. However, the discrepancy is not directly the function of weights. Calculating the derivative of the discrepancy is done using the chain rule twice.

$$
\Delta w\_{p\circ}^{(3)} = -\eta \frac{\partial E^{(3)}}{\partial o\_p^{(3)}} \frac{\partial o\_p^{(3)}}{\partial net\_p^{(3)}} \frac{\partial net\_p^{(3)}}{\partial w\_{p\circ}^{(3)}} \tag{15}
$$

Let us discuss each of partial derivatives in turn. In the last term of Eq. (15) is the derivative of the net *net*ð Þ<sup>3</sup> *<sup>p</sup>* with respect to a weight *w*ð Þ<sup>3</sup> *pj* :

$$\frac{\partial net\_p^{(3)}}{\partial w\_{pj}^{(3)}} = \frac{\partial}{\partial w\_{pj}^{(3)}} \left( \sum\_{j=1}^{l} w\_{pj}^{(3)} o\_j^{(2)} + b\_p^{(3)} \right) = o\_j^{(2)} \tag{16}$$

Next, the derivative of the activation *o* ð Þ3 *<sup>p</sup>* with respect to the net input *net*ð Þ<sup>3</sup> *<sup>p</sup>* :

$$\begin{split} \frac{\partial o\_p^{(3)}}{\partial net\_p^{(3)}} &= \frac{\partial}{\partial net\_p^{(3)}} \sigma \left( net\_p^{(3)} \right) \\ &= \sigma \left( net\_p^{(3)} \right) \left( 1 - \sigma \left( net\_p^{(3)} \right) \right) = o\_p^{(3)} \left( 1 - o\_p^{(3)} \right) \end{split} \tag{17}$$

Last, we consider the derivative of *E* with respect to the activation. Since the neuron is in the output layer, then *O*ð Þ<sup>3</sup> *<sup>p</sup>* is equal to *o* ð Þ3 *<sup>p</sup>* .

$$\frac{\partial E}{\partial \mathbf{o}\_{\mathbf{p}}^{(3)}} = \frac{\partial E}{\partial \mathbf{O}\_{\mathbf{p}}^{(3)}} = \frac{\partial \left( 1/2 \left( \mathbf{t}\_{\mathbf{p}}^{(3)} - \mathbf{O}\_{\mathbf{p}}^{(3)} \right)^{2} \right)}{\partial \mathbf{O}\_{\mathbf{p}}^{(3)}} = -\left( \mathbf{t}\_{\mathbf{p}}^{(3)} - \mathbf{o}\_{\mathbf{p}}^{(3)} \right) \tag{18}$$

Finally, we substitute these results Eqs. (15)–(17) back into original Eq. (17) to find the weight change Δ*w*ð Þ<sup>3</sup> *pj* rule,

$$
\Delta w\_{p\uparrow}^{(3)} = \eta \overbrace{\left(\mathbf{t\_p^{(3)}} - \mathbf{o\_p^{(3)}}\right) \mathbf{o\_p^{(3)}} \left(1 - \mathbf{o\_p^{(3)}}\right)}^{\varepsilon\_p} \mathbf{o\_p^{(3)}} = \eta \varepsilon\_p \mathbf{o\_p^{(3)}} \tag{19}
$$

We can find the weight change Δ*w*ð Þ<sup>2</sup> *jr* in the same processes as above and it is defined as:

$$\Delta w\_{\rm{jr}}^{(2)} = \eta \overbrace{\sum\_{j}^{l} \varepsilon\_{p} \mathbf{w}\_{\rm{p}\uparrow}^{(3)} \mathbf{o}\_{\rm{j}}^{(2)} \left(1 - \mathbf{o}\_{\rm{j}}^{(2)}\right) \mathbf{o}\_{\rm{r}}^{(1)}}^{e\_{\rm{j}}} = \eta \varepsilon\_{\rm{j}} \mathbf{o}\_{\rm{r}}^{(1)} \tag{20}$$

The BPN algorithm approach to recognize and intelligently detect failures is based on changes in weight values Δ*w*ð Þ<sup>3</sup> *pj* <sup>Δ</sup>*w*ð Þ<sup>2</sup> *jr* of the AUV feature parameters.
