## 2 Methods
### Porosity Prediction Based on Multi-Head Attention Mechanism  
The deep sequence correlation graph \(G_{d}\) is generated from the sampled data \(X_{i}^{T}\), and the feature correlation graph \(G_{f}\) is generated from the sampled data \(X_{i}\). Using the same sampled data \(X_{i}\) to generate \(G_{d}\) and \(G_{f}\) for spectral graph convolution operations may lead to redundancy and overlapping information. The tensor obtained after spectral graph convolution operations is defined as \(B_{i}\), as shown in Equation (18). Employing the raw result tensor \(B_{i}\) directly in porosity estimation might diminish the predictive accuracy.  
\[B_{i}:=g\Big{(}{}^{*}[_{G_{d},G_{f}}]\Big{)}X_{i}=\sigma\Big{[}A_{d}X_{i}\Theta _{d}+b_{d},A_{f}X_{i}^{T}\Theta_{f}+b_{f}\Big{]}, \tag{18}\]  
Therefore, we employ a multi-head attention mechanism to extract the most pertinent information from the result tensor \(B_{i}\) for prediction. This allows us to select the most relevant information from the logging data for prediction and project the result tensor \(B_{i}\) into a higher-dimensional space. Thus, this minimizes redundancy and overlaps in the high-dimensional space. During this phase, the resulting tensor \(B_{i}\) undergoes multiple parallel linear transformations to generate diverse representations of the input data, as depicted in Equation (19).  
\[\Big{(}Q_{i}^{(h)},K_{i}^{(h)},V_{i}^{(h)}\Big{)}=B_{i}\cdot\Big{(}W_{Q}^{(h) },W_{K}^{(h)},W_{V}^{(h)}\Big{)}, \tag{19}\]  
where \(W_{Q}^{(h)},W_{K}^{(h)}\), and \(W_{V}^{(h)}\) represent the weight matrices for obtaining the corresponding higher-dimensional queries \(Q_{i}^{(h)}\), keys \(K_{i}^{(h)}\), and values \(V_{i}^{(h)}\) of the \(h\)th head. The final output result \(H_{i}^{(h)}\) of the \(i\)th sampled feature in the \(h\)th head can be given by Equation (20), with \(d\) being the weight matrix dimension.  
\[H_{i}^{(h)}=\text{SoftMax}\Big{(}Q_{i}^{(h)}\cdot K_{i}^{(h)}/\sqrt{d}\Big{)} V_{i}^{(h)}, \tag{20}\]  
Next, the outputs \(H_{i}^{(h)}\) from each head in the multi-head attention mechanism can be concatenated as depicted in Equation (21).  
\[\text{MultiHead}(Q,K,V)_{i}=\text{Concat}\Big{(}\text{SoftMax}\Big{(}Q_{i}^{( h)}\cdot K_{i}^{(h)}/\sqrt{d}\Big{)}V_{i}^{(h)}\Big{)}, \tag{21}\]Ultimately, the output from the multi-head attention mechanism \(\text{MultiHead}(Q,K,V)_{i}\) is flattened and fed into a fully connected(FC) layer to determine the final porosity estimate, as expressed in Equation (22). Here, \(W\) denotes the weight matrix of the FC layer, \(b\) represents the bias vector within the layer, and \(\hat{y}_{i}\) signifies the resulting forecast.  
\[\hat{y}_{i}=\sigma(W\cdot FC(\text{MultiHead}(Q,K,V)_{i})+b), \tag{22}\]  
The loss function \(l\) used for training can be represented as Equation (23). To avoid over-fitting, \(L_{2}\) regularization terms are appended to the parameter matrices \(\Theta_{d}\) of the graph convolution kernel \(g_{d}\) and \(\Theta_{f}\) of the graph convolution kernel \(g_{f}\).  
\[l=\frac{1}{\Omega_{i}}\sum_{i=1}^{\Omega_{i}}(y_{i}-\hat{y}_{i})^{2}+\lambda \left(\|\Theta_{d}\|_{2}^{2}+\left\|\Theta_{f}\right\|_{2}^{2}\right), \tag{23}\]  
where \(\lambda\) signifies the regularization coefficient for the \(L_{2}\) penalty term, \(\Omega_{i}\) denotes the count of windows, and \(y_{i}\) corresponds to the actual outcome.  
Part (D) of Figure 1 depicts the porosity estimation utilizing the multi-head attention framework. Within this concluding stage, the multi-head attention system identifies and prioritizes the most pertinent data for forecasting, simultaneously discarding irrelevant and repeated details.