Water plant ultra-short-term water supply amount prediction method and system based on time multi-scale features
By selecting multi-scale features over time and optimizing deep learning models, the problem of insufficient accuracy in water supply forecasting for water plants has been solved, enabling more accurate water supply forecasting and control, and supporting urban water resource management.
Patent Information
- Application Number
- CN202411414691.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-11
- Publication Date
- 2025-11-11
- Estimated Expiration
- 2044-10-11
AI Technical Summary
Existing technologies do not fully consider the multi-scale characteristics of time in water plant supply forecasting, resulting in insufficient forecast accuracy and robustness, making it difficult to meet the needs of urban water supply management.
By acquiring historical water supply data and environmental data from water plants, and employing time-scale feature selection, correlation analysis, mutual information analysis, and feature histogram verification of feature sets, seven deep learning models based on the mean square error loss function were constructed. Then, Bayesian optimization techniques were used for hyperparameter tuning, and finally, the optimal model was used for ultra-short-term water supply prediction.
It improves the accuracy and reliability of water supply forecasting, enabling better matching of actual dynamic changes, achieving more precise water supply control, and ensuring the sustainable development of urban water supply systems.
Smart Images

Figure CN119599159B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of water resource management and forecasting technology, specifically to a method and system for forecasting ultra-short-term water supply from water plants based on multi-time scale characteristics. Background Technology
[0002] With the accelerating pace of urbanization and the increasing prominence of climate change, water resource management has become an increasingly urgent challenge. Against this backdrop, accurate prediction of water plant supply has become a key link in ensuring the living standards of urban residents and industrial production. The complexity of water resources and the uncertainty caused by various factors have revealed certain limitations of traditional statistical methods in water volume prediction. Therefore, it is crucial to explore more accurate and efficient methods for predicting water plant supply by considering more comprehensive feature selection and model selection techniques.
[0003] In water supply forecasting, feature selection and model selection are crucial steps. Correlation analysis, data preprocessing, and relevant statistics ensure that the selected features are closely related to the target variable and meet the requirements for model training. Regarding model selection, the task type determines the model type; appropriate model complexity and hyperparameters are chosen based on the problem's complexity. However, existing literature indicates that most studies do not consider multi-scale temporal features in their input feature set selection. Multi-scale temporal features refer to considering multiple features or change patterns at different scales in time series data. These scales can be different time intervals, such as hours, days, months, or years, or different data aggregation levels, such as raw data, hourly averages, and daily totals. Multi-scale temporal features are highly important in sequence forecasting tasks, as they help models better capture data trends, periodicity, historical dependencies, and the impact of sudden events, thereby improving forecast accuracy and robustness. For short-term water supply forecasting at water plants, determining which multi-scale temporal feature set and model is most suitable remains an urgent problem to be solved. Summary of the Invention
[0004] The purpose of this invention is to provide a method and system for predicting ultra-short-term water supply from water plants based on time-multi-scale features. It delves into and solves the key issues of feature set selection and model selection based on time-multi-scale features, makes full use of historical water supply data, meteorological information and other relevant factors at different time scales for ultra-short-term prediction, and explores more accurate and reliable modeling methods in water supply prediction to solve the technical problems raised in the background art.
[0005] To achieve the above objectives, the present invention provides the following technical solution: a method for predicting ultra-short-term water supply from water plants based on multi-scale time characteristics, comprising at least the following steps:
[0006] S1: Obtain the water supply-related dataset of the water plant. The dataset includes historical water supply data and related environmental data. Divide the dataset into training set, validation set and test set.
[0007] S2: Select historical water supply characteristic factors and relevant environmental characteristic factors from a multi-scale time perspective to form a feature set;
[0008] S3: Verify the correlation and potential relationship between the feature set and water supply through correlation analysis, mutual information analysis and feature histogram methods;
[0009] S4: Use Bayesian optimization techniques to tune the hyperparameters of each network model;
[0010] S5: Construct seven network models—RNN, BiRNN, LSTM, BiLSTM, GRU, BiGRU, and Transformer—based on the mean squared error loss function. Input the training set into each network model and output the training results.
[0011] S6: Use the test set as input for the 7 network models, output the test results, and calculate the evaluation metrics for each network model: RMSE, MAE, MAPE, and R. 2 Compare the results and retain the optimal input parameters and network model;
[0012] S7: Use the optimal network model to make ultra-short-term predictions of the future water supply of the water plant and record the prediction results.
[0013] Furthermore, S2 includes at least the following steps:
[0014] First, historical water supply data and related environmental data of the water plant were obtained. Then, the dataset was processed for missing and outlier values and normalized using the traditional mean imputation method.
[0015] Then select the water supply volume with a lag of 1 year, 1 month, 1 week, 1 day, water supply volume per half hour with a lag of 1 day, date, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature;
[0016] The dataset is then divided into training, validation, and test sets. 90% of the data is used as the training set to train the model, 10% of the data is extracted from the training set as the validation set for model hyperparameter tuning, and the remaining 10% of the data is used as the test set to evaluate model performance.
[0017] Furthermore, S3 includes at least the following steps:
[0018] In the correlation analysis, Pearson correlation coefficient, Spearman correlation coefficient, Kendall Tau correlation coefficient and partial correlation coefficient are used to analyze the correlation between the feature set and water supply. Then, a network model is constructed to take the feature set as input and output the prediction results.
[0019] Furthermore, S4 includes at least the following steps:
[0020] Step 1: Define the search space for hyperparameters and specify the range of values for the hyperparameters;
[0021] Step 2: Select a prior function. If the function distribution is known, select the optimal model based on experience. If it is unknown, use a kernel function based on Gaussian process as a black-box function for self-learning.
[0022] Step 3: Initialize some hyperparameter combinations and use these hyperparameter combinations to train the model to obtain the corresponding objective function values;
[0023] Step 4: Based on the existing hyperparameter combinations and objective function values, establish a Gaussian process model to estimate the probability distribution of the objective function;
[0024] Step 5: Use the acquisition function to search for the maximum point of the objective function. The AC is usually based on the predicted mean and variance of the Gaussian process model to select the next combination of hyperparameters to be evaluated in order to balance exploration and utilization.
[0025] Step 6: Input the hyperparameter combination selected by AC into the model for training and obtain the corresponding objective function value;
[0026] Step 7: Update the Gaussian process model with the new hyperparameter combination and objective function values;
[0027] Step 8: Repeat steps 5-7 until the preset number of iterations is reached, then stop.
[0028] A water plant ultra-short-term water supply prediction system based on time multi-scale characteristics includes at least a data acquisition module, a data analysis module, a model building module, a model training module, a model optimization module, and a water supply prediction module.
[0029] The data acquisition module is used to acquire relevant datasets, which include historical water supply data and relevant environmental data, and then divide the datasets into training sets and test sets.
[0030] The data analysis module is used to analyze various feature factors in the dataset and identify feature factors that are highly correlated with water supply.
[0031] The model building module is used to build seven deep learning network models based on the mean square loss function;
[0032] The model training module is used to input the processed training set into 7 deep learning network models and output the training results.
[0033] The model optimization module is used to fine-tune the hyperparameters of seven deep learning network models, then input the test set into the network model, output the test results, compare the test results with the training results, and retain the optimal network model.
[0034] The water supply prediction module is used to predict the future short-term water supply of the water plant using the optimal network model and record the prediction results.
[0035] Furthermore, the data acquisition module is used to acquire relevant datasets, which include water supply data with a lag of 1 year, 1 month, 1 week, and 1 day, water supply data every half hour with a lag of 1 day, dates, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature. The dataset is divided into a training set, a validation set, and a test set. 90% of the data is used as the training set for training the model, 10% of the data is extracted from the training set as the validation set for model hyperparameter tuning, and the remaining 10% of the data is used as the test set for evaluating model performance.
[0036] Furthermore, the data analysis module uses correlation analysis, mutual information, and histograms from feature engineering to comprehensively analyze the selected feature set. The correlation analysis uses Pearson correlation coefficient, Spearman correlation coefficient, Kendall-Tau correlation coefficient, and partial correlation coefficient to analyze the correlation between the feature set and the water supply.
[0037] Furthermore, the model optimization module uses Bayesian optimization technology to perform hyperparameter tuning on seven deep learning network models, with the number of Bayesian optimization iterations preset to 50.
[0038] Compared with the prior art, the beneficial effects of the present invention are:
[0039] This invention addresses the problem of insufficient research on historical water supply data in the current field of water supply forecasting. It considers the selection of historical water supply characteristic factors from a multi-scale time perspective, extracts a series of characteristic factors with different time spans to form a feature set, and demonstrates the effectiveness of this feature set through experiments. This feature set can improve the accuracy of water supply forecasting. At the same time, it proposes to perform ultra-short cycle forecasting of water supply, which can better match actual dynamic changes, achieve more refined water supply control, and improve the reliability and stability of water supply.
[0040] Compared to traditional statistical and machine learning methods, the deep learning model used in this invention has higher efficiency and accuracy when processing time series data, and can better capture the patterns and regularities in the data, thereby improving the accuracy and robustness of predictions.
[0041] Therefore, this invention provides an effective method for intelligent operation and maintenance in the field of water treatment, with broad application prospects. It can help water plants better plan and manage water resources and ensure the sustainable development of urban water supply systems. Attached Figure Description
[0042] To more clearly illustrate the technical solutions of the embodiments of the present invention, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 This is a flowchart of an embodiment of the present invention;
[0044] Figure 2 This is a flowchart of the network model according to an embodiment of the present invention;
[0045] Figure 3 This is a water supply data distribution diagram according to an embodiment of the present invention;
[0046] Figure 4 This is a schematic diagram illustrating the selection of time-scale historical water supply characteristics according to an embodiment of the present invention.
[0047] Figure 5 This is a schematic diagram of the correlation coefficient analysis in an embodiment of the present invention;
[0048] Figure 6 This is a schematic diagram of mutual information analysis according to an embodiment of the present invention;
[0049] Figure 7 This is a histogram of the feature set in an embodiment of the present invention;
[0050] Figure 8 This is a flowchart of Bayesian hyperparameter optimization according to an embodiment of the present invention;
[0051] Figure 9 This is a comparison chart of the predicted and actual water supply values for every half hour according to an embodiment of the present invention.
[0052] Figure 10 This is a comparison chart of the predicted and actual water supply values for the day in an embodiment of the present invention.
[0053] Figure 11 This is a functional block diagram of the system according to an embodiment of the present invention;
[0054] Figure 12 This is a structural diagram of an electronic device according to an embodiment of the present invention. Detailed Implementation
[0055] The technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings of the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments.
[0056] Example 1:
[0057] The basic implementation examples are as follows: Figure 1 and Figure 2 As shown: A method for predicting ultra-short-term water supply from water plants based on multi-scale temporal characteristics includes at least the following steps:
[0058] S1: Obtain the water supply-related dataset of the water plant, which includes historical water supply data and related environmental data, and then divide it into training set, validation set and test set;
[0059] The dataset is divided into three parts: 90% is used as the training set for model training, 10% is extracted from the training set as the validation set for model hyperparameter tuning, and the remaining 10% is used as the test set for model performance evaluation. In this application, the daily half-hour water supply and total daily water supply of a water plant in Chongqing from January 2019 to April 2022 were collected. Mean interpolation was used to handle missing and outlier values in the feature set. Mean interpolation is a common outlier handling method that estimates missing and outlier values using the mean of the features. The processed data was then normalized using a min-max scaling method. The preprocessed water plant water supply data is shown below. Figure 3 As shown.
[0060] S2: Select historical water supply characteristic factors and relevant environmental characteristic factors from a multi-scale time perspective to form a feature set;
[0061] This application proposes a method for extracting features from a multi-scale time perspective to address the problem that most researchers in the field of water supply forecasting currently focus on selecting environmental characteristic factors while neglecting the extraction of historical water supply data. Furthermore, considering multi-scale time change patterns is crucial in time series analysis and forecasting, as it can capture the changing patterns of data at different time scales, improving the accuracy and robustness of forecasts and providing more reliable decision support for water plant water supply management.
[0062] Therefore, this application takes a multi-scale time perspective and comprehensively considers existing water supply prediction methods, such as... Figure 4As shown, a series of feature factors with different time spans were extracted from the preprocessed historical water supply data, namely, water supply with a 1-year lag, water supply with a 1-month lag, water supply with a 1-week lag, water supply with a 1-day lag, and water supply every half hour with a 1-day lag. Then, these were combined with relevant environmental feature factors, including date, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature, to form an 89-dimensional feature set. For ease of display, each feature factor in the feature set was renamed, and the naming results are shown in Table 1.
[0063] Table 1 Renaming Feature Factors
[0064]
[0065]
[0066] S3: Verify the correlation and potential relationship between the feature set and water supply through correlation analysis, mutual information analysis and feature histogram methods;
[0067] To verify the correlation and potential relationship between the selected feature set and water supply, this application employs feature engineering methods, namely correlation analysis (CA), mutual information (MI), and histograms, to comprehensively analyze the selected feature set. Feature correlation analysis can help understand the relationships between features in the dataset, better revealing the dataset's internal structure and patterns, as detailed below:
[0068] The feature correlation analysis specifically includes:
[0069] In the correlation analysis, Pearson correlation coefficient, Spearman correlation coefficient, Kendall-Tau correlation coefficient, and partial correlation coefficient were used to analyze the correlation between the feature set and water supply. Then, a network model was constructed, taking the feature set as input and outputting the prediction results. The results are as follows: Figure 5 As shown;
[0070] The Pearson correlation coefficient is used to measure the degree of linear correlation between two continuous characteristic variables, and it is expressed as follows:
[0071] There are two feature variables X and Y, and their sample data are x1, x2, ..., xy. n and y1,y2,...,y n Pearson correlation coefficient ρ X,Y The calculation formula is:
[0072]
[0073] in, and Let X and Y be the sample means, respectively.
[0074]
[0075] The Spearman correlation coefficient is used to measure the monotonic relationship between two feature variables. It measures the relationship between feature variables by converting the original data into ranks, and is expressed as follows:
[0076] There are two feature variables X and Y with sample data x1, x2, ..., xy. n and y1, y2, ..., y n First, convert them to ranks; for each data x in X i Find its rank among all x values, R(x). i (First, convert them to ranks, that is, for each data x in X) i Find its rank among all x values, R(x). i Similarly, for each data y in Y... i Find its rank R(y) among all y values. i Then, calculate the Spearman correlation coefficient ρ. s :
[0077]
[0078] The Kendall-Tau correlation coefficient considers the ordinal relationship between feature variables, rather than specific numerical values, and is expressed as follows:
[0079] There are two variables X and Y, and their sample data are x1, x2, ..., xy. n and y1,y2,...,y n The formula for calculating the Kendall-Tau correlation coefficient τ is:
[0080]
[0081] Where C represents the number of consistent pairs, that is, for any two sample points (x, y, c), C represents the number of consistent pairs. i ,y i ) and (x j ,y j (i≠j), if x i >x j And y i >y j , or x i <x j And y i <y j If two sample points (x, y) are not identical, then these two sample points are called a consistent pair; D represents the number of inconsistent pairs, that is, for any two sample points (x, y)i ,y i ) and (x j ,y j (i≠j), if x i >x j And y i <y j , or x i <x j And y i >y j If these two sample points are inconsistent, then they are called an inconsistent pair.
[0082] The partial correlation coefficient measures the correlation between two characteristic variables after controlling for the effects of other characteristic variables, and it is expressed as follows:
[0083]
[0084] Given three feature variables X, Y, and Z, calculate the partial correlation coefficients of X and Y under the control of Z. The correlation coefficient matrix R is:
[0085] Where, γ ij Let represent the correlation coefficient between feature variable i and feature variable j, and then calculate the partial correlation coefficient γ. XY.Z :
[0086]
[0087] Mutual information is an indicator used to measure the degree of association between two random characteristic variables. It measures the influence of the information content in one random characteristic variable on the other random characteristic variable, as follows:
[0088] Given two continuous random characteristic variables X and Y, with joint probability distribution P(X,Y) and marginal probability distributions P(X) and P(Y) respectively, the mutual information I(X;Y) is:
[0089]
[0090] The mutual information method was used to calculate the mutual information value of each feature factor with respect to the target variable (water supply). The results are as follows: Figure 6 As shown; similar to the conclusions drawn from the correlation analysis, the feature factors such as water supply with a 1-week lag, water supply with a 1-month lag, water supply with a 1-day lag, and water supply every half hour with a 1-day lag all showed high mutual information values. Among them, the mutual information value of water supply every half hour with a 1-day lag was particularly prominent, indicating that the prediction of the target variable (water supply) was strongly influenced by this feature factor. The mutual information values of other feature factors were all ≥0, indicating a dependence on the target variable. Including them in the input feature set of the model can improve the prediction accuracy.
[0091] Histograms can clearly show the distribution of data, revealing its central tendency, dispersion, and shape. Figure 7 The histograms of each feature factor in the feature set are shown. From the histograms, it can be clearly and intuitively seen that the data distribution of the feature factors other than temperature is approximately Gaussian. This distribution helps to reduce the complexity of the modeling process and makes the model fit more accurately.
[0092] S4: Use Bayesian optimization techniques to tune the hyperparameters of each network model;
[0093] This application employs Bayesian optimization for hyperparameter tuning. Bayesian optimization estimates the probability distribution of the objective function by establishing a probabilistic model, while considering the uncertainty of the objective function and selecting the next hyperparameter combination to be evaluated based on the current estimated distribution. This allows it to find a better hyperparameter combination in a relatively small number of iterations, saving time and cost. Furthermore, Bayesian optimization can adaptively adjust the next selected hyperparameter combination based on previous observations, thus searching for the optimal solution more intelligently. This adaptability enables Bayesian optimization to dynamically adjust the search strategy during the search process to find the best possible hyperparameter combination. The process is as follows: Figure 8 As shown, the specific process is as follows:
[0094] (1) Define the search space for hyperparameters and specify the range of values for the hyperparameters; In this application, there are four hyperparameters: learning rate, number of hidden layers, number of hidden layer neurons, and number of iterations, and their ranges are shown in Table 2:
[0095] Table 2. Range of hyperparameter values
[0096]
[0097] (2) Select a prior function (PF); In this application, since the function distribution is unknown, a kernel function based on a Gaussian process is used as a black-box function for self-learning. The Gaussian process can be represented as:
[0098] f(x)~gp(m(x),k(x,x'))
[0099] Where f(x) represents the objective function, gp represents the Gaussian process, m(x) is the mean function, which is usually assumed to have zero mean, i.e., m(x) = 0, and k(x,x') is the covariance function (kernel function), which is used to measure the similarity between two points x and x'.
[0100] The covariance function uses a Gaussian kernel function (also known as a radial basis function, RBF):
[0101]
[0102] Where, ||x-x'|| 2 It is the square of the Euclidean distance between the two points, and l is the length scale parameter of the kernel function, which is used to control the smoothness of the function;
[0103] (3) Initialize some hyperparameter combinations and use these hyperparameter combinations to train the model and obtain the corresponding objective function values;
[0104] (4) Based on the existing hyperparameter combinations and objective function values, establish a Gaussian process model to estimate the probability distribution of the objective function;
[0105] (5) An acquisition function (AC) is used to search for the maximum point of the objective function; the AC is usually based on the predicted mean and variance of the Gaussian process model to select the next combination of hyperparameters to be evaluated, in order to balance exploration and exploitation; the acquisition function used in this application is based on the Expected Improvement (EI) acquisition function:
[0106] EI(x)=E[max(0,f(x * )-f(x))]
[0107] Where, x * The current optimal combination of hyperparameters is f(x), which is the mean of the Gaussian process model's prediction of the hyperparameter combination x. E represents the expectation. Specifically, EI calculates the expected improvement that the new hyperparameter combination x may bring given the current optimal solution. If the mean of the prediction of f(x) is much lower than the objective function value of the current optimal solution, then the value of EI will be relatively large, indicating that this hyperparameter combination may bring a significant improvement and is therefore more likely to be selected for the next trial.
[0108] (6) Input the hyperparameter combination selected by AC into the model for training and obtain the corresponding objective function value;
[0109] (7) Update the new hyperparameter combination and objective function value to the Gaussian process model;
[0110] (8) Repeat steps (5)-(7) until the stopping condition is met, that is, the Bayesian optimization iteration rounds reach 50 times. The Bayesian optimization results are shown in Table 3.
[0111] Table 3. Bayesian optimization results of hyperparameters
[0112]
[0113] S5: Construct seven network models—RNN, BiRNN, LSTM, BiLSTM, GRU, BiGRU, and Transformer—based on the mean squared error loss function. Input the training set into each network model and output the training results.
[0114] S5: In this application, seven deep learning-based neural network models are used, namely Recurrent Neural Network (RNN), Bidirectional Recurrent Neural Network (BiRNN), Long Short-Term Memory Network (LSTM), Bidirectional Long Short-Term Memory Network (BiLSTM), Gated Recurrent Unit (GRU), Bidirectional Gated Recurrent Unit (BiGRU), and Transformer. The models are trained under the premise of the same input feature set, and output the water supply volume of a water plant in Chongqing City every half hour for the next 24 hours and the total water supply volume for the next day (49 dimensions in total).
[0115] S6: Use the test set as input for the 7 network models, output the test results, and calculate the evaluation metrics for each network model: RMSE, MAE, MAPE, and R. 2 Compare the results and retain the optimal input parameters and network model;
[0116] In this application, the root mean square error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and goodness of fit (R²) are used to measure the error. 2 The performance metrics were used to evaluate the performance of seven deep learning network models on the test set. The results are shown in Table 4. It was found that all models except the Transformer model showed good results, with the LSTM model exhibiting the best performance metrics: RMSE, MAE, MAPE, and R. 2 The percentages were 647.7032, 162.7941, 5.3530%, and 0.9981, respectively.
[0117] Therefore, it can be seen that LSTM has a higher accuracy (R²) in short-term water supply prediction for water plants compared to other deep learning models. 2 =0.9981) and a lower percentage error (MAPE = 5.3530%), compared to RNN(R 2 =0.9964, MAPE=6.6197%), LSTM has a more complex design, including input gate, forget gate and output gate, which can better handle long-term dependencies and help capture long-term patterns and trends in water volume changes; for GRU(R 2 =0.9974, MAPE=6.0990%. In contrast, the gating mechanism of LSTM is more complex, and it can selectively remember or ignore input information, which makes it more adaptable and helps the model to better adapt to different data features and changes.
[0118] Furthermore, the Transformer model performs slightly worse than other models in short-term water supply forecasting for water plants, with lower RMSE, MAE, MAPE, and R... 2 The percentages were 2803.3188, 741.303, 16.7595%, and 0.9648, respectively. The reason for this problem may be that the Transformer model usually performs well when processing long-sequence data (such as text sequences in natural language processing tasks), but may not be suitable for processing time series data such as short-term water supply forecasting. Such data may have specific periodicity, trends, or seasonality, and the Transformer model may not be able to effectively capture these patterns. Secondly, the Transformer model has a more complex structure and strategy than RNN, LSTM, and GRU models. Short-term water supply forecasting is a relatively simple time series forecasting problem, and using a complex model will lead to poorer forecast results.
[0119] Table 4 Performance metrics for each model (test dataset)
[0120]
[0121] In addition, a series of feature ablation experiments were designed in this application to verify the impact of time-scale feature factors on the network model. The LSTM, which performed well in the above experiments, was selected as the prediction model and feature ablation experiments were conducted on the multi-scale feature set.
[0122] The standard feature set is composed of the following feature factors: holidays, weekends, daily minimum temperature, daily maximum temperature, daily average temperature, water supply with a 1-year lag, water supply with a 1-month lag, water supply with a 1-week lag, water supply with a 1-day lag, and water supply every half hour with a 1-day lag. This set is then used as the input to the LSTM model.
[0123] The results are shown in Table 5. Similarly, RMSE, MAE, MAPE, and R... 2 Performance metrics were used to evaluate models using different feature sets as inputs. It was found that removing any multi-scale feature factor from the standard feature set would cause the model performance to decline. The model performance changed significantly when the water supply data with a 1-year lag, a 1-month lag, and a 1-week lag were removed simultaneously, with the percentage error increasing by 0.5121%.
[0124] Table 5 shows the model performance of LSTM under different feature sets.
[0125]
[0126] Thus, this experiment demonstrates that the time-scale feature set proposed in this study is effective in predicting water supply from water plants. Each time-scale feature factor contributes to the model prediction to different degrees, with the water supply feature factor lagging by one month making a more significant contribution.
[0127] Therefore, in predicting the water supply of water plants, the above-mentioned characteristic factors should be included in the feature set to improve the model's performance and generalization ability, thereby further strengthening the water plant's ability to manage water resources and its resource planning.
[0128] S7: Use the optimal network model to make ultra-short-term predictions of the future water supply of the water plant and record the prediction results;
[0129] Figure 9 and Figure 10 The figure visually demonstrates the consistency between the observed water supply per half hour and per day over the next 100 days and the water supply per half hour and per day predicted by the seven models. It is easy to see from the figure that, except for the Transformer model, the other models all showed good predictive ability. Among them, the LSTM and BiLSTM models performed better, and their predicted water supply per half hour and total daily water supply were closest to the actual values. They also performed well at the peak changes of the actual values.
[0130] Example 2:
[0131] This embodiment proposes a water plant ultra-short-term water supply prediction system based on time-multi-scale characteristics, as described in Embodiment 1 above. Figure 11 As shown, the water plant ultra-short-term water supply prediction system based on time multi-scale characteristics includes at least a data acquisition module, a data analysis module, a model building module, a model training module, a model optimization module, and a water supply prediction module.
[0132] The data acquisition module is used to acquire relevant datasets, which include water supply data with a lag of 1 year, 1 month, 1 week, and 1 day, water supply data every half hour with a lag of 1 day, dates, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature. The dataset is then divided into training, validation, and test sets. 90% of the data is used as the training set for training the model, 10% is extracted from the training set as the validation set for model hyperparameter tuning, and the remaining 10% is used as the test set for evaluating model performance.
[0133] The data analysis module uses correlation analysis (CA), mutual information (MI), and histograms from feature engineering to comprehensively analyze the selected feature set. In terms of correlation analysis, Pearson correlation coefficient, Spearman correlation coefficient, Kendall-Tau correlation coefficient, and partial correlation coefficient are used to analyze the correlation between the feature set and the water supply.
[0134] The model building module is used to build seven deep learning network models based on the mean square loss function (MSE).
[0135] The model training module is used to input the processed training set into 7 deep learning network models and output the training results.
[0136] The model optimization module uses Bayesian optimization techniques to fine-tune the hyperparameters of seven deep learning network models. Then, the test set is input into the network model, the test results are output, the test results are compared with the training results, and the optimal network model is retained.
[0137] The water supply prediction module is used to predict the future short-term water supply of the water plant using the optimal network model and record the prediction results.
[0138] Example 3:
[0139] This embodiment proposes an electronic device based on the above embodiments, such as... Figure 12 As shown, an electronic device includes at least: an electronic device 400, a processor 401, a memory 402, an input device 403, and an output device 404;
[0140] The processor 401 may be a central processing unit (CPU) or other form of processing unit with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device 400 to perform desired functions;
[0141] The memory 402 may include one or more computer program products, which may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory; the volatile memory may include, for example, random access memory (RAM) and / or cache memory; the non-volatile memory may include, for example, read-only memory (ROM), hard disk, flash memory, etc.; one or more computer program instructions may be stored on the computer-readable storage medium, and the processor 401 may execute the program instructions to implement the water plant ultra-short-term water supply prediction method based on time multi-scale characteristics of any embodiment of the present invention described above, or other desired functions; various contents such as initial external parameters and thresholds may also be stored in the computer-readable storage medium.
[0142] For simplicity, Figure 9 Only some of the components of the electronic device 400 that are relevant to the present invention are shown in this paper, and components such as buses, input / output interfaces and the like are omitted; in addition, the electronic device 400 may include any other suitable components depending on the specific application.
[0143] In addition to the methods and devices described above, embodiments of the present invention can also be computer program products, comprising computer program instructions that, when executed by a processor, cause the processor to perform the steps of the water plant ultra-short-term water supply prediction method based on time multi-scale features provided in any embodiment of the present invention. The computer program product can be written in any combination of one or more programming languages to perform the operations of the embodiments of the present invention. The programming languages include object-oriented programming languages such as Python, Java, C++, etc. The program code can be executed entirely on a user computing device, partially on a user device, as a standalone software package, partially on a user computing device and partially on a remote computing device, or entirely on a remote computing device or server.
[0144] Furthermore, embodiments of the present invention may also be computer-readable storage media storing computer program instructions thereon, which, when executed by a processor, cause the processor to perform the steps of the water plant ultra-short-term water supply prediction method based on time multi-scale features provided in any embodiment of the present invention.
[0145] The computer-readable storage medium may be any combination of one or more readable media; the readable medium may be a readable signal medium or a readable storage medium; the readable storage medium may be, for example, including but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof; more specific examples of readable storage media (a non-exhaustive list) include: an electrical connection having one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination thereof.
[0146] In summary:
[0147] This invention aims to address the shortcomings of existing water supply forecasting methods, such as insufficient research on historical water supply data and inadequate consideration of multi-scale time considerations. First, historical water supply data and related environmental factors are collected from water plants. After preprocessing, the data is divided into training, validation, and test sets. Then, historical water supply characteristic factors and related environmental characteristic factors are selected from a multi-scale time perspective to form a feature set. The correlation and potential relationship between the feature set and water supply are verified using correlation analysis, mutual information analysis, and feature histogram methods. Next, seven deep learning models are constructed based on the mean squared error loss function for water supply forecasting, and Bayesian optimization techniques are used for hyperparameter tuning. This invention also verifies the effectiveness of the multi-scale time features through feature ablation experiments, providing water plants with more accurate and effective water supply planning, enhancing their water resource management and resource planning capabilities.
[0148] It will be apparent to those skilled in the art that the present invention is not limited to the details of the exemplary embodiments described above, and that the invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the invention; therefore, the embodiments should be regarded as exemplary and non-limiting in all respects, and the scope of the invention is defined by the appended claims rather than the foregoing description, and all variations falling within the meaning and scope of the equivalents of the claims are intended to be included within the invention, and no reference numerals in the claims should be regarded as limiting the scope of the claims.
Claims
1. A method for predicting ultra-short-term water supply from water plants based on multi-scale temporal characteristics, characterized by: At least the following steps are included: S1: Obtain the water supply-related dataset of the water plant. The dataset includes historical water supply data and related environmental data. Divide the dataset into training set, validation set and test set. S2: Select historical water supply characteristic factors and relevant environmental characteristic factors from a multi-scale time perspective to form a feature set; S2 includes at least the following steps: First, historical water supply data and related environmental data of the water plant were obtained. Then, the dataset was processed for missing and outlier values and normalized using the traditional mean imputation method. Then select the water supply volume with a lag of 1 year, 1 month, 1 week, 1 day, water supply volume per half hour with a lag of 1 day, date, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature; The dataset is then divided into training, validation, and test sets. 90% of the data is used as the training set for training the model, 10% is extracted from the training set as the validation set for hyperparameter tuning, and the remaining 10% is used as the test set for evaluating model performance. S3: Verify the correlation and potential relationship between the feature set and water supply through correlation analysis, mutual information analysis and feature histogram methods; The S3 includes at least the following steps: In the correlation analysis, Pearson correlation coefficient, Spearman correlation coefficient, Kendall-Tau correlation coefficient, and partial correlation coefficient were used to analyze the correlation between the feature set and water supply. Then, a network model was constructed to take the feature set as input and output the prediction results. S4: Use Bayesian optimization techniques to tune the hyperparameters of each network model; The S4 includes at least the following steps: Step 1: Define the search space for hyperparameters and specify the range of values for the hyperparameters; Step 2: Select a prior function. If the function distribution is known, select the optimal model based on experience. If it is unknown, use a kernel function based on Gaussian process as a black-box function for self-learning. Step 3: Initialize some hyperparameter combinations and use these hyperparameter combinations to train the model to obtain the corresponding objective function values; Step 4: Based on the existing hyperparameter combinations and objective function values, establish a Gaussian process model to estimate the probability distribution of the objective function; Step 5: Use the acquisition function to search for the maximum point of the objective function. The AC is usually based on the predicted mean and variance of the Gaussian process model to select the next combination of hyperparameters to be evaluated in order to balance exploration and utilization. Step 6: Input the hyperparameter combination selected by AC into the model for training and obtain the corresponding objective function value; Step 7: Update the Gaussian process model with the new hyperparameter combination and objective function values; Step 8: Repeat steps 5-7 until the preset number of iterations is reached, then stop. S5: Construct seven network models—RNN, BiRNN, LSTM, BiLSTM, GRU, BiGRU, and Transformer—based on the mean squared error loss function. Input the training set into each network model and output the training results. S6: Use the test set as input for the 7 network models, output the test results, and calculate the evaluation metrics for each network model: RMSE, MAE, MAPE, and R. 2 Compare the results and retain the optimal input parameters and network model; S7: Use the optimal network model to make ultra-short-term predictions of the future water supply of the water plant and record the prediction results.
2. A water plant ultra-short-term water supply prediction system based on time-multi-scale characteristics, referring to the water plant ultra-short-term water supply prediction method based on time-multi-scale characteristics as described in claim 1, characterized in that: It includes at least a data acquisition module, a data analysis module, a model building module, a model training module, a model optimization module, and a water supply prediction module; The data acquisition module is used to acquire relevant datasets, which include historical water supply data and relevant environmental data, and then divide the datasets into training sets and test sets. The data analysis module is used to analyze various feature factors in the dataset and identify feature factors that are highly correlated with water supply. The model building module is used to build seven deep learning network models based on the mean square loss function; The model training module is used to input the processed training set into 7 deep learning network models and output the training results. The model optimization module is used to fine-tune the hyperparameters of seven deep learning network models, then input the test set into the network model, output the test results, compare the test results with the training results, and retain the optimal network model. The water supply prediction module is used to predict the future short-term water supply of the water plant using the optimal network model and record the prediction results.
3. The water plant ultra-short-term water supply prediction system based on time multi-scale characteristics according to claim 2, characterized in that: The data acquisition module is used to acquire relevant datasets, which include water supply data with a lag of 1 year, 1 month, 1 week, and 1 day, water supply data every half hour with a lag of 1 day, dates, holidays, daily minimum temperature, daily maximum temperature, and daily average temperature. The dataset is divided into training set, validation set, and test set. 90% of the data is used as the training set for training the model, 10% of the data is extracted from the training set as the validation set for model hyperparameter tuning, and the remaining 10% of the data is used as the test set for evaluating model performance.
4. The water plant ultra-short-term water supply prediction system based on time multi-scale characteristics according to claim 3, characterized in that: The data analysis module uses correlation analysis, mutual information, and histograms from feature engineering to comprehensively analyze the selected feature set. The correlation analysis uses Pearson correlation coefficient, Spearman correlation coefficient, Kendall-Tau correlation coefficient, and partial correlation coefficient to analyze the correlation between the feature set and the water supply.
5. The water plant ultra-short-term water supply prediction system based on time multi-scale characteristics according to claim 4, characterized in that: The model optimization module uses Bayesian optimization techniques to perform hyperparameter tuning on seven deep learning network models, with the number of Bayesian optimization iterations preset to 50.
Citation Information
Patent Citations
DWT-PCA-LSTM-based water supply quantity prediction device for water supply company
CN111079989A
Construction method of air pollutant concentration seasonal prediction model
CN114741972A