# A Novel Method of Local Anode Effect Prediction for Large Aluminum Reduction Cell
## 4 Prediction of Local Anode Effect Based on Analysis of Anode Guide Current Fluctuation
### Prediction of Fluctuating Anode Current Based on GRU-LSTM Hybrid Neural Network
#### 4.1.2 Memory Gate  
\([\mathbf{h}_{t-1}\mathbf{x}_{t}]\) will also be used as input while entering the calculation of the forget gate. The neuron state information at time \(t\) is calculated through the \(tanh\) activation function, and the information to be updated is obtained by Hadamard product of the neuron state at moment \(t\) with \(\mathbf{i}_{t}\). As shown in Equation (10) and Equation (11), \(\mathbf{W}_{i}\) and \(\mathbf{W}_{c}\) respectively represent the weight of the memory gate, and \(\mathbf{b}_{i}\), \(\mathbf{b}_{c}\) respectively represent the bias of different states of the memory gate. \[\mathbf{i}_{t}=\sigma(\mathbf{W}_{i}[\mathbf{h}_{t-1}\mathbf{x}_{t}]+\mathbf{b}_{i}) \tag{10}\] \[-\] \[\mathbf{C}_{t}=tanh(\mathbf{W}_{c}[\mathbf{h}_{t-1}\mathbf{x}_{t}]+\mathbf{b}_{c}) \tag{11}\]  
GRU is a member of the Recurrent Neural Networks (RNN) family. Compared with LSTM, GRU can also solve the problem of gradient saturation in the memory and back propagation of historical data, which are common in RNN. However, due to its simplified structure, the neuron parameters are much less than LSTM, and only a gated unit is used to perform the operation of forgetting and selective memory of historical data. The structure of gated neuron is shown in Figure 6.  
Figure 5: Structure of LSTM gated neurons. The output of GRU reset data gate and GRU update gate are as follows:  
\[\mathbf{r_{t}}=\sigma(\mathbf{W_{r}}[\mathbf{h_{t-1}},\mathbf{x_{t}}]+\mathbf{b_{r}}) \tag{12}\]  
\[\mathbf{z_{t}}=\sigma(\mathbf{W_{z}}[\mathbf{h_{t-1}},\mathbf{x_{t}}]+\mathbf{b_{z}}) \tag{13}\]  
where, \(\mathbf{r_{t}}\) is the output of GRU reset data gate; \(\mathbf{W_{r}}\) is the weight matrix of reset gate; \(\mathbf{h_{t-1}}\), \(\mathbf{x_{t}}\) constitute the vector of the neuron hidden layer and the data input layer, which is continuously updated with the input; \(\mathbf{b_{r}}\) is the bias matrix; \(\mathbf{z_{t}}\) is the output of GRU update gate; \(\mathbf{W_{z}}\) is the weight matrix of the update gate. It is calculated by _sigmoid_ function to narrow the output values to (0-1). \[\mathbf{h_{t}}^{\prime}=tanh(\mathbf{W_{h}}[\mathbf{r_{i}}\odot\mathbf{h_{t-1}},\mathbf{x_{t}}]+ \mathbf{b_{h}}) \tag{14}\]  
where, \(\mathbf{h_{t}}^{\prime}\) is the neuronal state at time \(t\); \(\mathbf{W_{h}}\) is the weight update matrix of neuronal state; \(\odot\) is Hadamard product; \(\mathbf{b_{h}}\) is the bias matrix of neuronal state; the neuronal state is limited to (\(-1\),1) by hyperbolic tangent function. \[\mathbf{h_{i}}=\mathbf{z_{i}}\odot\mathbf{h_{i-1}}+(1-\mathbf{z_{i}})\odot\mathbf{h_{i}}^{\prime} \tag{15}\]  
where, \(\mathbf{h_{t}}^{\prime}\) is calculated by Equation (14). As can be seen from the above formula, the output of the update gate strictly controls the retention or not of the information flow of the previous state in the neuron, with \(\mathbf{z_{i}}\) varying between (0-1) [21], to ensure that the control output is the ratio of the state of the unit at the previous moment to the unit input being input, to achieve the memory of important information, forgetting the inputs that have less impact on the neuron unit, and to constantly update the parameter architecture of the neuron hidden layer. Since the training time of LSTM network is slightly longer, in order to improve the training speed of neural network and realize online current tracking, the advantages of LSTM and GRU networks are combined, and LSTM and GRU are combined by full link to form a current prediction model to achieve fast current tracking and high accuracy at the same time. The occurrence point of strong fluctuation of anode current can be determined in advance by current tracking, which can be used as the prediction value of the occurrence time of anode effect.