Water content prediction method based on time convolution
By using time convolutional network (TCN) model and data preprocessing technology, the complex nonlinear and long-term dependencies in moisture content prediction are solved, and the prediction of higher accuracy and reliability is achieved, supporting oil field production management.
Patent Information
- Application Number
- CN202510527072.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-24
- Publication Date
- 2025-08-15
AI Technical Summary
When existing moisture content prediction methods deal with complex nonlinear and long-term dependencies, there are problems such as insufficient prediction accuracy and difficulty in model training. In particular, traditional linear regression models and neural network models such as RNNs are not effective in moisture content prediction, and it is difficult to capture the sequential information and long-term dependencies of time series.
The time convolution network (TCN) model is used to combine data preprocessing and frequency domain transformation. By constructing a time convolution layer and a fully connected layer, the correlation of time series is captured, and the unified data magnitude is processed through MinMaxScaler normalization, key input features are screened, and the generalization ability of the model is enhanced.
It improves the accuracy and reliability of moisture content prediction, enhances the generalization ability of the model, can better adapt to complex working conditions, and provides efficient prediction tools to support oil field management decisions.
Smart Images

Figure CN120492835A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the fields of data processing and analysis and moisture content prediction, and in particular to a moisture content prediction method and system based on a temporal convolutional network. Background Art
[0002] In actual production scenarios, water cut is affected by numerous factors, including the top of the production well section, reservoir thickness, and pump depth. These factors often exhibit a complex, nonlinear relationship. Changes in some of these factors can significantly impact water cut. Traditional water cut prediction techniques have significant limitations, such as linear regression models, which assume a linear relationship between water cut and other production parameters. Complex on-site construction conditions can exceed these assumptions, leading to significant deviations in water cut predictions made by linear regression models and failure to meet the demand for accurate predictions.
[0003] During oil production, changes in water cut are influenced by long-term trends and a variety of factors. The Autoregressive Integrated Moving Average (ARIMA) model captures temporal dependencies, helping us understand how water cut changes over time. It focuses on how current data points and past data influence future trends, much like how we reflect on past experiences to predict future trends. This approach is particularly well-suited for complex, multi-factorial problems like water cut. Factors such as slow changes in formation structure and long-term wear and tear on equipment can have long-term and intertwined impacts on water cut. However, the ARIMA model struggles to effectively handle such complex situations, significantly limiting its predictive power and failing to adapt well to the complex temporal patterns of water cut.
[0004] With the development of machine learning technology, neural network methods have gradually been applied to water cut prediction. While neural networks such as multilayer perceptrons (MLPs) have proven effective in some fields, they struggle with time series data such as water cut. Conventional neural networks are not structurally designed for time series data and cannot effectively capture sequential information and long-term dependencies within them. Time sequence is crucial for accurate water cut prediction, as the current water cut is dependent on production operations and formation conditions over a period of time. Conventional neural networks, ignoring the importance of this temporal sequence, produce inaccurate predictions. Recurrent neural networks (RNNs) and their variants, long short-term memory (LSTM) networks and gated recurrent units (GRUs), are used to address the sequential nature of time series data. This is especially true given the inherently difficult vanishing and exploding gradient problems inherent in RNNs.
[0005] When processing long sequences of data, the gradient of an RNN during backpropagation may approach zero or become very large. Moisture content is a production data scenario with a long time span, making it difficult to effectively train an RNN model. In severe cases, this can affect both model training and prediction accuracy.
[0006] The Temporal Convolutional Network (TCN) differs from the aforementioned models in its unique advantages in processing similar data. By combining causal convolution with dilated convolution, the model ensures the causal rationality of time series predictions, effectively captures long-term dependencies in time series, and can better simulate and predict changes in moisture content during actual production. Dilated convolution effectively expands the receptive field without significantly increasing model parameters. In moisture content prediction, TCN comprehensively considers the impact of production parameters from multiple past time periods on the current moisture content. By stacking multiple convolutional layers, TCN deeply explores complex patterns in production data, improving the accuracy and reliability of moisture content predictions. Summary of the Invention
[0007] The technical problem solved by the present invention is: utilizing the advantages of temporal convolutional networks to fully explore the local and global time series characteristics in moisture-cut related data, improve the accuracy and reliability of moisture-cut prediction, and enhance the generalization and interpretability of the model.
[0008] To solve the above technical problems, the present invention provides the following technical solution: a moisture content prediction method based on time convolution, which includes the following steps:
[0009] 1) Read data from an Excel file containing production-related data, perform missing value processing and feature selection, and extract input and output features for moisture cut prediction;
[0010] 2) Calculate the normalized value and data partition of the input feature data, use MinMaxScaler to scale the data to the range of 0 to 1, and perform the same normalization processing on the output feature data;
[0011] 3) Build a prediction model and use a temporal convolution layer to convolve the feature set to capture the temporal correlation of features. After temporal convolution, a new feature set that incorporates historical data information is obtained. Use a fully connected layer to adjust the dimension of the features and establish a mapping relationship between the features and moisture content to predict the moisture content.
[0012] 4) Calculate the anomaly score and anomaly threshold based on the results calculated by the reconstruction and prediction modules, and evaluate the model performance based on the prediction and reconstruction results.
[0013] 5) Perform model evaluation and system implementation, and use the trained model to predict the data.
[0014] 6) Use the trained model to predict the test set to obtain the predicted value, and then denormalize the predicted value and the actual value; draw a comparison curve between the predicted value and the actual value, and calculate the performance indicators of the model, including mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE).
[0015] Furthermore, the normalization and simplified formulas of step 2 are:
[0016]
[0017] X min and X max are the minimum and maximum values of the feature in the original dataset, respectively. new_max and new_min are the maximum and minimum values of the specified normalized feature range.
[0018] Furthermore, the specific process of step 3 is:
[0019] 3.1) Constructing a temporal convolutional network (TCN) model;
[0020] 3.2) Parameter settings: 12 input features, 3 convolution kernels, 64 channels, Dropout 0.2, and input dimension adjustment.
[0021] 3.3) Model Training: Convolution operations capture correlations, and fully connected layers adjust dimensions. The input is a time step vector, which is then processed through dilated convolution and fully connected layers to produce the final output.
[0022] Furthermore, in step 6, the mean square error (MSE) is calculated using the formula:
[0023]
[0024] Calculate the root mean square error (RMSE) using the formula:
[0025]
[0026] Calculate the mean absolute error (MAE) using the formula:
[0027]
[0028] Beneficial effects of the present invention:
[0029] 1. This invention combines data preprocessing with the TCN model to simultaneously process spatial and temporal features. It then extracts frequency-domain features through a frequency-domain conversion module, enabling a joint analysis of spatiotemporal and frequency-domain features. Comparative experiments have shown that the proposed prediction curve is closer to the true value, effectively handles nonlinear relationships, and improves prediction accuracy under complex operating conditions.
[0030] 2. In this paper, the MinMaxScaler normalization process unifies data levels, addresses the issue of dimensional differences between different features, accelerates model convergence, and improves training stability. Furthermore, correlation analysis is used to screen key input features and remove redundant information, allowing the model to focus on core influencing factors and enhance generalization capabilities, making it applicable to diverse oilfield production data scenarios.
[0031] 3. The TCN architecture of this invention is clear, and through visualization of prediction results and performance indicators, the model's prediction effects are intuitively displayed, making it easier for production managers to understand. Furthermore, the end-to-end system is compatible with Excel data input and PyTorch deployment, supporting rapid single-sample predictions and ensuring both convenience and reliability.
[0032] 4. This invention uses high-precision water-cut predictions to provide data support for oilfield production strategies, such as proactively adjusting pump speeds and optimizing equipment maintenance cycles, thereby reducing production losses due to abnormal water cuts. Combined with fluctuation coefficient analysis, this technology can specifically identify abnormally producing wells, assisting decision-making to improve resource utilization efficiency and reduce production costs. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the following briefly introduces the drawings required for describing the embodiments of the present application.
[0034] Figure 1 This is a diagram of the overall process framework of the moisture content prediction algorithm and system based on time convolution of the present invention;
[0035] Figure 2 It is a training loss graph of the method of the present invention in the moisture content prediction algorithm based on time convolution of the present invention;
[0036] Figure 3 It is the moisture content prediction in the method of the present invention in the moisture content prediction algorithm based on time convolution of the present invention;
[0037] Figure 4 This is an example of visualization of the results of the method of the present invention in the moisture content prediction algorithm based on time convolution;
[0038] Figure 5 This is a comparison chart of the training time of different models in the moisture content prediction algorithm based on time convolution under different data scales;
[0039] Figure 6 This is a comparison chart of multi-model prediction results in the moisture content prediction algorithm based on time convolution of the present invention. Specific implementation plan
[0040] The present invention will now be described in detail with reference to the accompanying drawings and embodiments.
[0041] Example
[0042] See also Figure 1 The present embodiment provides a method for studying and implementing a moisture content prediction algorithm based on time convolution. The specific implementation steps are as follows:
[0043] 1) Read data from an Excel file containing production-related data, perform missing value processing and feature selection, and extract input and output features for moisture cut prediction;
[0044] 2) Calculate the normalized value and data partition of the input feature data, use MinMaxScaler to scale the data to the range of 0 to 1, and perform the same normalization processing on the output feature data;
[0045] 3) Build a prediction model and use a temporal convolution layer to convolve the feature set to capture the temporal correlation of features. After temporal convolution, a new feature set that incorporates historical data information is obtained. Use a fully connected layer to adjust the dimension of the features and establish a mapping relationship between the features and moisture content to predict the moisture content.
[0046] 4) Calculate the anomaly score and anomaly threshold based on the results calculated by the reconstruction and prediction modules, and evaluate the model performance based on the prediction and reconstruction results.
[0047] 5) Perform model evaluation and system implementation, and use the trained model to predict the data.
[0048] 6) Use the trained model to predict the test set to obtain the predicted value, and then denormalize the predicted value and the actual value; draw a comparison curve between the predicted value and the actual value, and calculate the performance indicators of the model, including mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE).
[0049] During implementation, the oilfield production dynamic data is read from the Excel file "data.xlsx", which contains 12 input features (such as the top of the production well section, oil layer thickness, pump depth, stroke, number of strokes, monthly water production, annual water production, cumulative water production, dynamic liquid level, pump efficiency, etc.) and 1 output feature (water cut). These data cover the key parameters in the oil well production process and provide comprehensive information for subsequent water cut prediction. For example, the top of the production well section and the thickness of the oil layer reflect the characteristics of the formation, the pump depth and the number of strokes reflect the operating status of the equipment, and various types of water production are directly related to the water cut. In this embodiment, since the oil well data may be missing, messy or redundant, in order to ensure the high accuracy of the subsequent method of the present invention, the corresponding data needs to be effectively processed.
[0050] In this embodiment, when processing missing values in a data set, a specific approach is to use a deletion strategy for missing values in the data. If the missing value ratio is low (eg, <5%) and the data volume is sufficient, the rows containing missing values are directly deleted.
[0051] During implementation, the number of deleted rows was recorded to ensure data representativeness was not compromised. If a row with missing "Pump Depth" data was removed, that row was removed to ensure dataset integrity. If more than 20% of the data for a well record was missing, all data for that well was removed.
[0052] During implementation, correlation analysis was used to screen for features highly correlated with water cut. Features with high correlations, such as "reservoir thickness" and "pump depth," were prioritized, while less relevant variables, such as "formation pressure," were removed to reduce redundant information. Data processing ensured integrity and format consistency, thereby improving the accuracy of subsequent prediction models.
[0053] In this embodiment, in step 2), all features are scaled to the range of [0, 1] using MinMaxScaler for normalization. The normalization formula is:
[0054]
[0055] X min and X max are the minimum and maximum values of the feature in the original dataset, respectively. new_max and new_min are the maximum and minimum values of the specified normalized feature range. In the code, feature_range = (0, 1) is specified, so the formula is simplified to:
[0056]
[0057] In practice, if the original range of "Oil Layer Thickness" is [10, 50] meters, the normalized value is [0, 1]. This step unifies the data magnitude and accelerates model convergence.
[0058] Water cut refers to the proportion of water in the oil-water mixture in an oil well. During pumping unit operation, changes in water cut can alter the physical properties of the mixture and the pumping unit's operating conditions. Therefore, water cut is often used to analyze the properties of the oil-water mixture to study pumping unit efficiency and performance.
[0059] Monitoring and analyzing water cut can help optimize pumping unit operating parameters, reduce energy consumption, and improve pumping efficiency. Changes in water cut can affect the pumping unit's performance curve, which in turn affects the interpretation of well production data and subsequent prediction models. Therefore, monitoring and addressing water cut is crucial for improving pumping unit operation accuracy and efficiency.
[0060] During implementation, the dataset of over 17,000 data points collected from Shengli Oilfield was divided into an 80% training set and a 20% test set. For example, if the total dataset contained 1,000 rows, the training set would consist of 800 rows and the test set would consist of 200 rows. The training set size was calculated based on the training_input input, the training_output output, and the test_input input and test_output output. The training set was used for model learning, and the test set was used for performance evaluation.
[0061] In this embodiment, the specific process in step 3) is:
[0062] 3.1) Building a Temporal Convolutional Network (TCN) Model
[0063] This embodiment adopts the TCN model, which includes a TemporalConvNet layer and a linear layer: TemporalConvNet: consists of multiple stacked TemporalBlock layers, each TemporalBlock includes: Convolution layer: the convolution kernel size is 3, the number of input channels is 12 (number of features), and the number of output channels is 64. Chomp1d layer: removes the redundant padding caused by causal convolution to ensure the causality of the time series. ReLU activation function: introduces nonlinearity. Dropout layer: the ratio is set to 0.2 to prevent overfitting. Expansion rate: increases exponentially with the number of layers, and the dilation of the i-th layer is dilation = 2^i. For example, the dilation of the first layer is 1, the dilation of the second layer is 2, and the dilation of the third layer is 4, which expands the receptive field to capture long-term dependencies. Linear layer: maps the TemporalConvNet output to the moisture content prediction value (the output dimension is 1).
[0064] 3.2) Parameter settings
[0065] In this implementation, the input features are set to 12 and the convolution kernel size is set to 3. This means that the model examines features from the past three time steps during each learning step. This helps the model understand short-term trends. The number of channels is set to 64 and the dropout ratio is set to 0.2. The model input dimension needs to be increased, for example, from [batch_size, 12] to [batch_size, 12, 1], to meet the TCN input requirements.
[0066] When implemented, TCN effectively captures long-term patterns in time series through dilated convolutions, avoiding the vanishing gradient problem compared to traditional RNNs.
[0067] 3.3) Model Training
[0068] During implementation, the kernel performs a sliding convolution operation on the input time series data. By updating the weights of the convolutional layer, the model learns the correlations between different time steps and generates new features. After the temporal convolution, a high-dimensional feature representation is obtained. These features contain deep information about the historical data, but due to their high dimensionality, they require adjustment and mapping through a fully connected layer.
[0069] In practice, one of the main functions of the fully connected layer is to reduce or increase the dimensionality of high-dimensional features after convolution, adjusting them to a dimension suitable for subsequent processing. The first fully connected layer, with 256 neurons, uses the GELU activation function to expand the feature space, and then passes through a second fully connected layer with 128 neurons to achieve feature compression. The output layer uses a single neuron with the Sigmoid activation function to constrain the output to the range [0, 1]. The convolution operation outputs a feature with multiple channels, and the fully connected layer converts it into a more concise and representative vector.
[0070] The model input is represented as:
[0071] x=(x T , x T-1 ,…,x T-n+1 , x T-n ), respectively representing the input vectors of the T, T-1, ...Tn time steps, including the normalized moisture content and other related features. After the dilation factor d and the convolution kernel size k, the output of the s-th time step is:
[0072]
[0073] f represents the convolution kernel, and the result of a series of dilated convolution transformations is: Here d1, d2, ..., d mFor different dilation factors, the final model output is: o = D(ReLU(G(x)+C(x))), where C(x) is the 1×1 convolutional transformation used for residual calculation, ReLU is the activation function, and D(x) is the function represented by the fully connected layer. This model structure effectively captures the time series characteristics and complex nonlinear relationships in the data, improving the accuracy of moisture content prediction.
[0074] When operating, the RELU activation function formula is as follows:
[0075] a j =σ(z j )=max(0,z j ) (4)
[0076] in:
[0077] a j is the output of the jth neuron after nonlinear activation;
[0078] σ(z j ) is the activation function.
[0079] During implementation, for nonlinear mapping, the fully connected layer uses an activation function to perform nonlinear transformations on the features output by the convolutional layer, increasing the model's expressive power. This allows the model to capture more complex relationships between features and enhances the mapping between features and moisture content.
[0080] In this embodiment, step 4) calculates the anomaly score and sets a dynamic threshold value through the predicted water content value and its reconstruction features obtained by the prediction model. A sudden increase in water content in oil well production may cause serious economic losses. By calculating the anomaly score and dynamic threshold value, it is possible to: timely detect potential faults (such as pipe leakage, decreased pump efficiency) and distinguish normal fluctuations from real anomalies (avoid false alarms). If the model predicts that the water content is 50% and the actual value is 65%, the anomaly score can quantify whether this deviation exceeds a reasonable range. The anomaly score is used to quantify the degree of deviation between the predicted value and the actual value, and combined with the feature reconstruction error, improve the robustness of anomaly detection. The implementation method is as follows: Calculate the predicted water content and the actual moisture content y t The absolute deviation is normalized:
[0081]
[0082] Among them, σ y is the standard deviation of the moisture content residual of the training set, which is used to measure the fluctuation range of the prediction error.
[0083] In this embodiment, step 5) determines the model based on its low error. Metrics such as mean square error and trend prediction accuracy are calculated on the test set, serving as a basis for initiating self-learning and retraining. Mean square error measures the average squared error between the model's predicted value and the true value, while trend prediction accuracy reflects the model's accuracy in predicting moisture content trends. These metrics are used to evaluate model performance. If model performance falls short of expectations, self-learning and retraining are initiated to further optimize the model.
[0084] In this embodiment, the loss function in step 6) is: the mean square error (MSE) is used, and nn.MSELoss is used to calculate the deviation between the predicted value and the actual value. Optimizer: RMSprop is selected, and the learning rate is set to 0.001. Training loop: Set the model to training mode (model.train()). Traverse the training set batches (batch size = 32). After the input data is dimensioned, it passes through the TCN model to obtain the predicted value. Calculate the MSE loss, perform backpropagation, and update the model parameters. Training rounds: set to 100 rounds, and record the training loss and test loss for each round.
[0085] Calculate the mean square error (MSE) using the formula:
[0086]
[0087] Calculate the root mean square error (RMSE) using the formula:
[0088]
[0089] Calculate the mean absolute error (MAE) using the formula:
[0090]
[0091] Extract the last row of data from the test set, convert the input features into Tensor and add a dimension to make predictions, denormalize the predicted values and true values, and finally print the input features, predicted values, and true values.
[0092] When implementing, see Figure 2 At the beginning of the training process, when the number of training rounds is low, the loss value is relatively high, close to 0.6. As the number of training rounds gradually increases, the loss value shows a clear downward trend. When the number of training rounds increases to approximately 10,000, the loss value drops significantly to around 0.2. As the number of training rounds continues to increase, the rate of decline in the loss value slows down, but it continues to decrease until it reaches around 70,000 rounds, when the loss value stabilizes at around 0.1. As training progresses, the model continuously learns features and patterns from the data, which gradually narrows the gap between the predicted value and the true value, manifesting as a continuous decrease in the loss value.
[0093] During implementation, training results can be further optimized by adjusting the learning rate and batch size. Properly adjusting the batch size can balance training speed and stability. By properly adjusting these hyperparameters, the loss value is expected to decrease faster and lower, further improving model performance.
[0094] The technical solution of the present invention solves the limitations of traditional methods in water cut prediction through innovative TCN models and data processing technology, and provides a more accurate and efficient tool for oilfield management.
[0095] The accuracy of the prediction of the present invention is illustrated by specific comparative experiments below.
[0096] A relatively simple method is to use the same part of the data to compare the prediction results.
[0097] Experimental process: First, use the water cut of the same oil well for a certain period of time, then use them to make predictions using different models and use the actual data of the following period of time to compare with the predicted data. At the same time, select some models for comparison in terms of training time.
[0098] After the model training is completed, its performance is verified by the test set. Figure 6 As shown, the deviation between the prediction curve of TCN (blue) and the true value (black) is the smallest, while the prediction results of LSTM (orange) and XGBoost (green) fluctuate greatly. Figure 5 Compared with the training time in , TCN only takes 75 minutes to process 20k samples, while LSTM takes 125 minutes, indicating that the present invention significantly improves the computational efficiency while ensuring accuracy.
[0099] Compared with traditional methods, this technical solution has achieved significant improvements in oil well water cut prediction: prediction accuracy has been greatly improved, and the mean square error, root mean square error, and mean absolute error have been significantly reduced; prediction efficiency has been significantly improved, and compared with traditional methods, prediction time has been shortened, providing more timely support for oil well production decisions.
Claims
1. Research and implementation of moisture content prediction method based on time convolution, characterized by: The following steps are involved: 1) Read data from an Excel file containing production-related data, perform missing value processing and feature selection, and extract input and output features for moisture cut prediction; 2) Calculate the normalized value and data partition of the input feature data, use MinMaxScaler to scale the data to the range of 0 to 1, and perform the same normalization processing on the output feature data; 3) Build a prediction model and use a temporal convolution layer to convolve the feature set to capture the temporal correlation of features. After temporal convolution, a new feature set that incorporates historical data information is obtained. Use a fully connected layer to adjust the dimension of the features and establish a mapping relationship between the features and moisture content to predict the moisture content. 4) Calculate the anomaly score and anomaly threshold based on the results of the reconstruction and prediction modules, and evaluate the model performance based on the prediction and reconstruction results. 5) Perform model evaluation and system implementation, and use the trained model to predict the data. 6) Use the trained model to predict the test set, obtain the predicted value, and denormalize the predicted value and the actual value; Plot a comparison curve between the predicted and actual values, and calculate the model performance indicators, including mean square error (MSE), root mean square error (RMSE), and mean absolute error (MAE).
2. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The data reading and processing in step 1) are specifically as follows: reading data containing multiple production-related features from a specified Excel file (such as data.xlsx); deleting rows containing missing values; selecting specific input features (such as 12 features such as the top of the production well section) and output features (water content), and converting them into numpy array format.
3. As described in claim 1, a MinMaxScaler object is created, and the feature range is specified as (0, 1), and the feature variables that are correlated with the data to be predicted are extracted as model input parameters, each field of the source data is normalized, and the input data is normalized using the fit_transform method: X min and X max are the minimum and maximum values of the feature in the original dataset, respectively. new_max and new_min are the maximum and minimum values of the specified normalized feature range. In the code, feature_range = (0, 1) is specified, so the formula is simplified to:
4. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The data division in step 3) is specifically as follows: according to the calculated training set size; the training set input is divided into train_input, the training set output is divided into train_output, the test set input is divided into test_input, and the test set output is divided into test_output.
5. The TemporalConvNet, the core of the TCN model based on parallel temporal convolution as described in claim 1, captures long-term dependencies in time series by stacking multiple TemporalBlock layers. The convolution operation of each TemporalBlock layer uses a different dilation rate. As the number of layers increases, the dilation rate increases exponentially (2**i). This can expand the receptive field of the convolution kernel without adding too many parameters, thereby better capturing long-term patterns in time series. The input dimension of the model needs to match the number of features in the data. When inputting data into the model, one dimension needs to be added (unsqueeze(-1)) to meet the model's input dimensionality requirements.
6. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The model construction in step 3) is specifically as follows: defining a TCN model, which is composed of a TemporalConvNet layer and a linear layer, and first passing through the TemporalConvNet layer and then through the linear layer in the forward function to obtain a prediction result; defining a TemporalConvNet model, which is composed of multiple TemporalBlock layers, and the expansion rate, number of input channels and number of output channels of each layer are determined according to the number of layers, and constructing the TemporalBlock layer and combining them into a sequential container; Define a TemporalBlock model, which consists of a convolutional layer, a Chompld layer, a ReLU activation function, and a Dropout layer. In the forward function, these layers are passed through in sequence to obtain the output. Define a Chompld model to remove the excess padding caused by the convolution operation. In the forward method, remove the last chomp_size elements of the last dimension.
7. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The model training in step 5) is specifically as follows: using the mean square error loss function nn.MSELoss as the loss function; optimizing the model using the RMSprop optimizer torch.optim.RMSprop; in each training round, setting the model to training mode, initializing the training loss to 0, traversing each batch in the training set, clearing the gradient, adding one dimension to the input data and obtaining the output through the model, calculating the loss, backpropagating, updating the model parameters, accumulating the training loss, and finally calculating and storing the average training loss.
8. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The prediction and denormalization in step 6) are specifically as follows: Set the model to evaluation mode, turn off gradient calculation, convert the test input data to Tensor and add a dimension to make predictions to get the predictions; Use the scaler.inverse_transform method to denormalize the predicted and actual values, print the denormalized prediction results, and save them to a CSV file.
9. The moisture content prediction method based on a temporal convolutional network according to claim 1, characterized in that: The model evaluation and individual prediction in step 6) are specifically as follows: Calculate the mean square error (MSE) using the formula: Calculate the root mean square error (RMSE) using the formula: Calculate the mean absolute error (MAE) using the formula: Extract the last row of data from the test set, convert the input features into Tensor and add a dimension to make predictions, denormalize the predicted values and true values, and finally print the input features, predicted values, and true values.
10. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the steps of the moisture content prediction method based on time convolution according to any one of claims 1 to 7 are implemented.
Citation Information
Cited By
Complex reservoir effectiveness evaluation and water production rate prediction method
CN121234778A