# Energy Consumption Prediction for Drilling Pumps Based on a Long Short-Term Memory Attention Method
## 3 Results and Discussion
### Data Processing
While we also experimented with other normalization methods, such as standard deviation-based normalization, our results showed that Max normalization provided better training efficiency and model performance. Therefore, given the characteristics of our data, Max normalization is a reasonable and effective choice for this study. The normalization formula is as follows:  
\[x^{\prime}=\frac{x-x_{min}}{x_{max}-x_{min}} \tag{9}\]  
This formula scales all feature values to the range [0, 1]. The process involves calculating the maximum and minimum values for each feature (such as pump pressure, inlet flow rate, and pump power) and then transforming all data points for that feature using the normalization formula. After normalization, all feature values are compressed to the range [0, 1], eliminating the differences in scale between different features. This standardization ensures that the influence of each feature on the loss function is balanced during model training and accelerates the model's convergence process, thereby improving training efficiency. In time series prediction tasks, the sliding window method is commonly used to segment the data to capture temporal dependencies. In this study, the sliding window length was set to 100 data points, and the sliding step was set to 30 data points, generating multiple overlapping time segments. Each sliding window contains 100 consecutive data points, serving as input features for the model. These 100 data points encapsulate the complete temporal information, enabling the model to capture temporal dependencies within the data. With a step size of 30 data points, there is an overlap of 70 data points between successive windows. This setting allows the generation of more training samples without losing historical information, enhancing the model's generalization capability and predictive accuracy. The target variable for each window is the pump power value at the end of the window, indicating the influence of the current time segment's input features on the pump power. Through this configuration, the model can learn patterns in the time series data and make accurate energy consumption predictions. Starting from the first data point, a new window is generated every 30 data points until the end of the data is reached. Each window's 100 data points are defined as input features, with the corresponding pump power value as the output label. This process resulted in multiple sample pairs for subsequent model training and evaluation. The sliding window setup effectively captures complex relationships in the time series, improving the model's predictive performance. Figure 4: Independent sliding window approach for real-time pump power data. After data segmentation, all generated sample pairs were randomly divided into training and test sets for model training and performance evaluation. The proportions of data assigned to the training and test sets were set at 70% and 30%, respectively. The training set, containing 70% of the data samples, was used to train the model. The model learns the patterns and rules within the training data by continuously optimizing its internal parameters to fit the data. The test set, containing 30% of the data samples, was used to evaluate the model's performance.