## 3 BILSTM-Based Deep Neural Network Rock-Mass Classification Method
### Deep Neural Network Structure  
#### 3.1.1 BILSTM Neural Network  
The essence of predicting the class of the surrounding rock from the MWD data is a nonlinear classification problem based on the characteristics of the drilling parameters. Drilling the rock mass with the drilling rig is a continuous process; hence, the depth-sequence of the MWD data contains rich and important information. Rock-class prediction based only on the drilling parameters at a certain time or depth is one-sided; considering the influence of the preceding and following depth-series data is also essential for making a comprehensive evaluation.  
BILSTM is a variant of long short-term memory (LSTM); it is built from two LSTM networks in opposite directions and can learn the information contained in a depth-sequence by combining the effects of the preceding and following depth-sequence data through bidirectional transfer.  
The LSTM neural network was proposed by [PERSON] and [PERSON] [31] and its structure is illustrated in Figure 3; it adds input, forget, and output gates to the RNN. In this way, disturbing information is eliminated, and the recursive processing of data is selectively performed based on the time or space sequences, thereby solving the problem of gradient disappearance or gradient explosion caused by the traditional RNN. The parameters of the input, forget, and output gates (\(i_{t}\), \(f_{t}\), and \(O_{t}\), respectively) are updated according to Equations (5)-(10) in the following manner.  
\[\text{Input values}:\ Z_{t}=tanh(W_{z}[h_{t-1},x_{t}]+b_{z}) \tag{5}\]  
\[\text{Input gates}:\ i_{t}=\sigma(W_{i}[h_{t-1},x_{t}]+b_{i}\ ) \tag{6}\]  
\[\text{Forget gates}:\ f_{t}=\sigma\Big{(}W_{f}[h_{t-1},x_{t}]+b_{f}\Big{)} \tag{7}\]  
\[\text{Cells}:\ C_{t}=f_{t}\cdot C_{t-1}+i_{t}\cdot Z_{t} \tag{8}\]  
\[\text{Output gates}:\ O_{t}=\sigma(W_{o}[h_{t-1},x_{t}]+b_{o}\ ) \tag{9}\]  
\[\text{Outputs}:\ h_{t}=O_{t}\cdot tanh\cdot C_{t} \tag{10}\]  
where \(tanh\) is an activation function, \(\sigma\) denotes the sigmod activation function, \(W\) denotes the weights, and \(b\) denotes the bias.  
Figure 2: Workflow of the deep neural network combing k-fold cross-validation.  
The values calculated by input, forget, and output gates are all mapped at the (0, 1) interval by the sigmoid function: the closer the value is to 1, the more information is retained; the closer the value is to 0, the more information is rejected.  
As shown in Figure 3, the LSTM can only be passed unidirectionally along the sequence direction, i.e., only the influence of the pre-sequence test data can be considered. To consider simultaneously the impact of both the pre- and post-sequence test data, it is necessary to build a BILSTM network with two LSTM networks in opposite directions.  
The BILSTM structure is shown in Figure 4; it can combine the pre- and post-sequence information of the current sequence in the output. There are two hidden values, namely \(B\) and \(B^{\prime}\) associated with the sequence in the BILSTM: \(B\) is involved in the forward calculation, and \(B^{\prime}_{i}\) is involved in the reverse calculation. The eigenvector \(x_{i}=(x_{1},x_{2}\ldots,x_{i})\) is connected to the hidden layer through the input layer and \(B_{i}=f(AB_{i}+Z\ B_{i+1})\) and \(B^{\prime}_{i}=f\left(A^{\prime}B^{\prime}_{i+1}+Z^{\prime}B_{i}\right)\), while subsequently connecting to the output of the next layer, i.e., \(y_{i}=g\left(CB_{i}+C^{\prime}B^{\prime}_{i}\right)\). This means that for forward computation, \(B_{i}\) of the hidden layer is determined by the previous and current sequences, and for reverse computation, \(B^{\prime}_{i}\) of the hidden layer is determined by the next and current sequences. The output of each cell in the BILSTM sample is passed through the same number of hidden states; hence, the effect of the information contained in the depth-sequence data in the sample is considered.