Water consumption prediction method based on GNN and LSTM combined model
By combining GNN and LSTM models, the time features and relationship features of corporate water consumption are extracted, which solves the problem of ignoring corporate correlation in traditional forecasting methods, achieves more accurate water consumption prediction, and improves the comprehensive performance and adaptability of prediction.
Patent Information
- Application Number
- CN202411076232.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-07
- Publication Date
- 2024-09-10
- Estimated Expiration
- 2044-08-07
AI Technical Summary
Traditional water consumption prediction methods ignore the complex relationships and interactions between enterprises, resulting in insufficient prediction accuracy. Especially in industrial parks, the historical water use data of a single enterprise is insufficient to capture spatial characteristics and enterprise relationship characteristics.
Using a combined model based on GNN and LSTM, by obtaining the company's historical water consumption and related influencing factors data, a GNN model is constructed to extract relationship features, an LSTM model is used to extract time features, and a GNN-LSTM superimposed model is used to extract combined features, combined with a fully connected layer Make water consumption forecasts.
It significantly improves the accuracy and robustness of water consumption prediction, enhances the ability to respond to emergencies and seasonal changes, provides more intelligent and sophisticated decision support for water resources management, and is more adaptable and popular.
Smart Images

Figure CN118627690A
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of water consumption prediction, and in particular to a water consumption prediction method based on a GNN and LSTM combined model. Background Art
[0002] With the development of industrial parks and the increase in corporate water consumption, accurate prediction of corporate water demand is crucial for water resource management and sustainable development in industrial parks. Traditional water consumption prediction methods mainly rely on statistical models, time series models and machine learning models, such as autoregressive integrated moving average model (ARIMA), support vector machine (SVM) and neural network. These methods usually only consider the historical water consumption data of a single enterprise, ignoring the complex associations and mutual influences between enterprises, resulting in insufficient prediction accuracy.
[0003] In recent years, the development of deep learning technology has provided a new method for water consumption forecasting. Long short-term memory network (LSTM) has been widely used in various forecasting tasks due to its superior performance in processing time series data. However, the LSTM model mainly focuses on the temporal characteristics of sequence data, and it is difficult to effectively capture the spatial characteristics of enterprises and the relationship characteristics between enterprises.
[0004] As a deep learning model that can process graph structured data, graph neural network (GNN) has significant advantages in representing the relative positions of nodes and learning complex relationships between nodes. It uses the adjacency matrix to represent graph structure information and captures the relationship between nodes through the message passing mechanism. Combining GNN and LSTM can simultaneously utilize the temporal features and relationship features in the data to improve the accuracy of prediction.
[0005] Enterprises in an industrial park are not only geographically related, but may also have upstream and downstream relationships in the industrial chain, alliance cooperation relationships, competitive relationships, investment relationships, etc. These relationships have an important impact on the water consumption of enterprises. For example, enterprises with upstream and downstream relationships may have similar periodicity in water use time; enterprises with cooperative relationships may coordinate water use with each other during peak water use periods; enterprises with competitive relationships may have water consumption increases and decreases due to market competition; and geographically adjacent enterprises may also be affected by the same emergencies (such as water supply network equipment failures). Therefore, the present invention proposes a method for predicting enterprise water consumption that combines GNN and LSTM. By introducing relationship features, it more comprehensively captures the complex relationships between enterprises in the industrial park, and combines time features to improve the comprehensive performance of the prediction model, thereby achieving accurate prediction of enterprise water consumption. Summary of the invention
[0006] The technical problem to be solved by the present invention is to provide a water consumption prediction method based on a GNN and LSTM combined model, which can effectively solve the problems raised in the above background technology.
[0007] To solve the above problems, the technical solution adopted by the present invention is: a water consumption prediction method based on a GNN and LSTM combined model, comprising the following steps: S1. Obtain the historical water consumption and related influencing factors of the enterprise, where the related influencing factors include time mark and meteorological mark, and pre-process the obtained data; S2. Construct a combined model based on GNN and LSTM. In the combined model, the LSTM model is used to extract the time characteristics of the enterprise's water consumption, the GNN model is used to extract the relationship characteristics, and the GNN-LSTM superposition model is used to extract the combined characteristics. The combined characteristics are concatenated as input and passed through the fully connected layer to obtain the water consumption prediction value; S3. Use historical data to train the combined model, update the parameters of the combined model, and obtain the combined prediction model.
[0008] As a further preferred embodiment of the present invention, in S1 Time marks include year, season, month, date, weekday, working day, and holiday; Meteorological indicators include temperature, humidity, wind speed and precipitation.
[0009] As a further preferred embodiment of the present invention, the data preprocessing method in step S1 includes outlier removal, missing value filling and normalization processing.
[0010] As a further preferred embodiment of the present invention, the process of extracting time features using the LSTM model in step S2 is as follows: input the time series of the enterprise's water consumption and influencing factors: ,in is the number of enterprises in the region, is the number of time steps, is the characteristic dimension (including water consumption and other related factors); The extraction process is: ; The temporal feature output is a hidden state sequence ,in is the number of future time steps, is the hidden state feature dimension.
[0011] As a further preferred solution of the present invention, the process of extracting relationship features using the GNN model in step S2 is as follows: Input K enterprise node features and construct a node feature matrix , among which, The node feature update formula of the layer is: in, For the The node characteristics of the layer, For the The weight matrix of the layer, For the Bias of the layer; is the activation function; is the adjacency matrix; The relationship feature output is: .
[0012] As a further preferred embodiment of the present invention, the process of extracting combined features by the GNN-LSTM model in step S2 is as follows: Input P enterprise node features and construct a node feature matrix ; The extraction process is ; The combined feature output is: .
[0013] As a further preferred embodiment of the present invention, the construction process of the adjacency matrix is: A1. Construct an adjacency matrix based on geographic location: The Gaussian kernel function is used to calculate the weight according to the geographical distance. The closer the distance, the greater the weight. in, Indicates the enterprise and The geographical distance between is the bandwidth of the Gaussian kernel; A2. Construct an adjacency matrix based on the similarity of water consumption sequences: The similarity of water consumption sequences can be obtained by calculating the Pearson correlation coefficient, and then constructing the adjacency matrix. in, and Indicates the enterprise and Time series of water consumption; A3. Construct an adjacency matrix based on business relationships. Construct an adjacency matrix based on the actual business relationships between enterprises (such as supply chain relationships, cooperative relationships, competitive relationships, etc.). ; A4. Constructing a comprehensive adjacency matrix: The above three adjacency matrices can be weighted and summed according to certain weights to construct a comprehensive adjacency matrix: in, , and is a weight parameter used to adjust the influence of different relationships and can be optimized through grid search.
[0014] As a further preferred embodiment of the present invention, the model feature splicing and prediction process in step S2 is: The time feature , Relationship characteristics and combined features Concatenate them together to form the final feature representation: ; Input the concatenated features into the fully connected layer for prediction: .
[0015] As a further preferred embodiment of the present invention, the loss function of the model training in step S3 is the total mean square error: Use the back-propagation algorithm to calculate the gradient, use the optimizer to update the model parameters, and adjust the hyperparameters at the same time. Repeat the training process until the model converges, and select the hyperparameters that minimize the average value of the loss function during the last 10 iterations.
[0016] Compared with the prior art, the present invention provides a water consumption prediction method based on a GNN and LSTM combined model, which has the following beneficial effects: This method comprehensively captures the temporal characteristics of water consumption of enterprises in the same region and the complex correlation characteristics between enterprises by integrating the advantages of GNN and LSTM.
[0017] In particular, the GNN model uses multiple dimensions such as geographic location, water consumption similarity, and actual business relationships to construct an adjacency matrix to accurately model the correlation between enterprises, while the LSTM model deeply explores the time series patterns of water consumption.
[0018] The combined model not only significantly improves the accuracy and robustness of the prediction by splicing features and making predictions through a fully connected layer, but also enhances the ability to respond to emergencies and seasonal changes, providing more intelligent and sophisticated decision-making support for park water resources management.
[0019] In addition, this method achieves optimal adjustment of the impact of different relationships by introducing a weight adjustment mechanism for multi-relationship features, making the model more adaptable and generalizable in practical applications. At the same time, the scope of application of the present invention can be extended, such as being applied to water consumption prediction of buildings with different functions but interrelated (catering, entertainment, schools, hospitals, parks, etc.) in medium and large areas. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is a schematic diagram of the process of the present invention; Figure 2 Schematic diagram of GNN-LSTM hybrid model prediction; Figure 3 This is a comparison chart of the predicted value and actual value of the enterprise based on the GNN and LSTM hybrid model in the embodiment. DETAILED DESCRIPTION
[0021] In addition, if there are descriptions involving "first", "second", etc. in the embodiments of the present invention, the descriptions of "first", "second", etc. are only used for descriptive purposes and cannot be understood as indicating or implying their relative importance or implicitly indicating the number of the indicated technical features.
[0022] In addition, if "and / or" or "and / or" appears in the full text, its meaning includes three parallel options. Taking "A and / or B" as an example, it includes option A, or option B, or a option in which both A and B are satisfied.
[0023] In addition, the technical solutions between the various embodiments can be combined with each other, but it must be based on the fact that ordinary technicians in the field can implement it. When the combination of technical solutions is contradictory or cannot be implemented, it should be deemed that such combination of technical solutions does not exist and is not within the scope of protection required by the present invention.
[0024] As a specific embodiment 1 of the present invention: a method for predicting water consumption of enterprises in an industrial park based on a combined model of GNN and LSTM is provided, such as Figure 1 As shown, the following steps are included: S1. First, obtain the historical water consumption and related influencing factors of enterprises in the industrial park, including time tags and meteorological tags. Perform data preprocessing. Specifically, obtain the historical water consumption data of a total of M enterprises from the water management system of the industrial park, with a time range of the past year. The data includes hourly water consumption and related influencing factor data, including meteorological tags (temperature, humidity, wind speed, precipitation) and time tags (year, season, month, date, hour, day of the week, weekday or holiday). The data preprocessing process includes using the Z-score method to remove outliers, using interpolation to supplement missing values, and using Min-Max Scaling to normalize all data and map them to the range of [0,1].
[0025] S2. Next, we build a combined model based on GNN and LSTM, where the LSTM model is used to extract the time characteristics of the water consumption of enterprises, the GNN model is used to extract the relationship characteristics between enterprises, and the GNN-LSTM superposition model is used to extract the combined characteristics. After the features are spliced, they are used as input to obtain the water consumption prediction value through the fully connected layer. Specifically: The process of extracting time features using the LSTM model is: 1.1 Input Enterprise Time series of water consumption and influencing factors: .
[0026] in, is the number of time steps, is the feature dimension (including water consumption and other related factors), where the time step =48 (hours), feature dimension F=12; 1.2 The extraction process is: ; 1.3 The LSTM model contains a forget gate, an input gate, a state update, and an output gate: 1.31. Forget Gate:
[0027] 1.32. Input gate:
[0028] 1.33. Cell status update:
[0029] 1.34. Output gate:
[0030] 1.35.Hidden status update:
[0031] The output is a hidden state sequence ,in The number of future time steps, = 24, hidden state sequence length = 128.
[0032] 2. Use the GNN model to extract relationship features. The specific process is as follows: 2.1 Constructing the node matrix : The enterprise nodes of enterprises in the park contain the following characteristic attributes: average water consumption in the previous day, average water consumption in the past 3 hours, water consumption in the past hour, geographical location (longitude and latitude), number of employees, length of working hours, years of establishment, energy consumption (electricity consumption, gas consumption), so the node feature matrix .
[0033] 2.2 Constructing the adjacency matrix : 2.21. Geographical location adjacency matrix: Based on the geographical distance between enterprises, the adjacency matrix is constructed and the distance weight is calculated using the Gaussian kernel function. The closer the distance, the greater the weight. in, Indicates the enterprise and The geographical distance between is the bandwidth of the Gaussian kernel. = 1.
[0034] 2.22. Adjacency matrix of water consumption sequence similarity: The adjacency matrix is constructed by calculating the Pearson correlation coefficient of the enterprise water consumption time series. in, and Indicates the enterprise and 24-hour water consumption time series.
[0035] 2.23. Adjacency matrix of business relationships: Construct the adjacency matrix based on the actual business relationships between enterprises (such as supply chain relationships, cooperative relationships, competitive relationships, etc.). ; 2.24. Comprehensive adjacency matrix The above three adjacency matrices are weighted and summed according to certain weights to construct a comprehensive adjacency matrix: in, , and is a weight parameter used to adjust the influence of different relationships, which can be optimized through grid search. In this embodiment, after optimization, =0.2, =0.4, =0.4.
[0036] 3. Next, we use the GNN network to extract relational features. GNN has two layers, and the output feature dimension of each layer is 64: The final relationship feature output is: .
[0037] 4. GNN-LSTM superposition model construction, the combined model structure is as follows Figure 2 As shown: In this embodiment 1, the relationship features extracted by GNN are directly Input into the LSTM model to obtain the combined features: .
[0038] 5. Model splicing and prediction 5.1. Feature concatenation: The temporal features extracted by LSTM, the relational features extracted by GNN, and the combined features extracted by GNN-LSTM are concatenated together to form the final feature representation: .
[0039] 5.2. Fully connected layer prediction: Input the concatenated features into the fully connected layer for prediction: The output dimension of the fully connected layer is × 24 (indicates the predicted water consumption of each enterprise in the next 24 hours).
[0040] S3. After the model is initially constructed, historical data is used to train the model. The loss function of the model training is the total mean square error: ; The weight initialization method uses Xavier initialization, the back-propagation algorithm is used to calculate the gradient, and the Adam optimizer is used to update the model parameters.
[0041] At the same time, the hyperparameters are adjusted and the training process is repeated until the model converges. The hyperparameters that minimize the average value of the loss function during the last 10 iterations are selected.
[0042] The final hyperparameters are set as follows: the hidden layer size of GNN is 64, the number of layers is 2, the activation function is ReLU, and the learning rate is 0.01; the hidden layer size of LSTM is 128, the number of layers is 2, the dropout rate is 0.3, and the learning rate is 0.001; the training batch size is 64, and the number of training rounds is 100; the L2 regularization parameter is 0.001; the geographic location weight in the adjacency matrix is 0.2, the water consumption similarity weight is 0.4, and the business relationship weight is 0.4.
[0043] As a specific embodiment 2 of the present invention: a method for predicting water consumption of industrial park enterprises based on a combined model of GNN and LSTM, comprising the following steps: S1. First, obtain the historical water consumption and related influencing factors of enterprises in the park, including time and weather marks, and perform data preprocessing.
[0044] Specifically, the historical water consumption data of a total of s enterprises are obtained from the water management system of the industrial park, with a time range of the past year. The data includes water consumption every 15 minutes, as well as relevant influencing factor data, including meteorological identifiers (temperature, precipitation) and time identifiers (year, month, date, hour, day of the week, weekday or holiday).
[0045] The data preprocessing process includes using the Z-score method to remove outliers, using interpolation to fill in missing values, and using Min-Max Scaling to normalize all data and map them to the range of [0,1].
[0046] S2. Next, we build a combined model based on GNN and LSTM. The LSTM model is used to extract the time characteristics of water consumption of each enterprise in the park, the GNN model extracts the water consumption relationship characteristics between enterprises, and the GNN-LSTM superposition model extracts the combined characteristics of water consumption in the park. After the features are spliced, they are used as input through the fully connected layer to obtain the water consumption prediction value.
[0047] Specifically, in the process of extracting time features using the LSTM model, the input is the time series of the enterprise’s water consumption and influencing factors in the previous 24 hours. , the output is a hidden state sequence , the future time step is 1 hour.
[0048] The process of extracting relational features using the GNN model includes: 1. Construct node matrix ,Each enterprise node in the park has the following characteristics: average water consumption in the previous week, average water consumption in the previous day, average water consumption in the past 3 hours, water consumption in the past hour, geographical location (longitude and latitude), number of employees, start of work / operation, years of establishment, average electricity consumption and gas consumption in the previous day.
[0049] 2. Constructing the adjacency matrix , including the adjacency matrix of geographical location, the adjacency matrix of water consumption sequence similarity, and the adjacency matrix of business relationship, and the three adjacency matrices are weighted and summed according to certain weights, with weights of 0.3, 0.3, and 0.4 respectively, to finally obtain a comprehensive adjacency matrix. After completing the construction of the node feature matrix and the adjacency matrix, the relationship features are extracted through the GNN network. GNN has three layers, and the output feature dimension of each layer is 128, and the final output is the relationship features of the enterprise .
[0050] Finally, the GNN-LSTM joint model is used to extract the combined features. The enterprise node features in the GNN model are adjusted to a certain extent, and the water consumption sequence in the past 24 hours is added to the feature matrix: , and then input the relational features extracted by GNN into the LSTM model to obtain the combined features .
[0051] Feature concatenation concatenates the temporal features extracted by LSTM, the relational features extracted by GNN, and the combined features extracted by GNN-LSTM to form the final feature representation. .
[0052] The fully connected layer predicts that the concatenated features are input into the fully connected layer for prediction, and the predicted water consumption of each enterprise in the next 24 hours is output. .
[0053] S3. After the model is initially constructed, the historical data collected by the park is used for model training. The loss function of the model training is the total mean square error. The weight initialization method uses Xavier initialization, the gradient is calculated using the back propagation algorithm, and the model parameters are updated using the RMSprop optimizer. At the same time, the hyperparameters are grid searched, and the model training process is repeated until the model converges. The hyperparameters that minimize the average value of the model loss function in the last 10 iterations are selected.
[0054] The final hyperparameters are set as follows: the hidden layer size of GNN is 128, the number of layers is 3, the activation function is ReLU, and the learning rate is 0.005; the hidden layer size of LSTM is 128, the number of layers is 4, the dropout rate is 0.4, and the learning rate is 0.001; the training batch size is 128, and the number of training rounds is 1000; the L2 regularization parameter is 0.001; the geographical location weight in the adjacency matrix is 0.3, the water consumption similarity weight is 0.3, and the business relationship weight is 0.4.
[0055] The final model compares the predicted effect of each enterprise with the actual water consumption. Figure 3 Among them, Enterprise 2 and Enterprise 4 are upstream and downstream relationships in the industry. It can be seen that the water use of the two enterprises has similar periodic laws, and the method of the present invention can capture the relationship between enterprises and make accurate predictions.
[0056] The above description is only a preferred embodiment of the present invention, and does not limit the patent scope of the present invention. All equivalent structural changes made by using the contents of the present invention specification and drawings under the inventive concept of the present invention, or directly / indirectly applied in other related technical fields are included in the patent protection scope of the present invention.
Claims
1. The water consumption prediction method based on the GNN and LSTM combined model is characterized by: The following steps are involved: S1. Obtain the historical water consumption and related influencing factors of the enterprise, where the related influencing factors include time mark and meteorological mark, and pre-process the obtained data; S2. Construct a combined model based on GNN and LSTM. In the combined model, the LSTM model is used to extract the time characteristics of the enterprise's water consumption, the GNN model is used to extract the relationship characteristics, and the GNN-LSTM superposition model is used to extract the combined characteristics. The combined characteristics are concatenated as input and passed through the fully connected layer to obtain the water consumption prediction value; S3. Use historical data to train the combined model, update the parameters of the combined model, and obtain the combined prediction model.
2. The water consumption prediction method based on the GNN and LSTM combined model according to claim 1 is characterized in that: The S1 Time marks include year, season, month, date, weekday, working day, and holiday; Meteorological indicators include temperature, humidity, wind speed and precipitation.
3. The water consumption prediction method based on the GNN and LSTM combined model according to claim 1 is characterized in that: The data preprocessing method in step S1 includes outlier removal, missing value filling and normalization.
4. The water consumption prediction method based on the GNN and LSTM combined model according to claim 1 is characterized in that: The process of extracting time features using the LSTM model in step S2 is as follows: input the time series of the enterprise's water consumption and influencing factors: ,in is the number of enterprises in the region, is the number of time steps, is the feature dimension; The extraction process is: ; The temporal feature output is a hidden state sequence ,in is the number of future time steps, is the hidden state feature dimension.
5. The water consumption prediction method based on the GNN and LSTM combined model according to claim 4 is characterized in that: The process of extracting relationship features using the GNN model in step S2 is as follows: Input K enterprise node features and construct a node feature matrix , among which, The node feature update formula is: in, For the The node characteristics of the layer, For the The weight matrix of the layer, For the Bias of the layer; is the activation function; is the adjacency matrix; The relationship feature output is: .
6. The water consumption prediction method based on the GNN and LSTM combined model according to claim 5 is characterized in that: The process of extracting combined features by the GNN-LSTM model in step S2 is as follows: Input P enterprise node features and construct a node feature matrix ; The extraction process is ; The combined feature output is: .
7. The water consumption prediction method based on the GNN and LSTM combined model according to claim 5 or 6 is characterized in that: The construction process of the adjacency matrix is: A1. Construct an adjacency matrix based on geographic location: The Gaussian kernel function is used to calculate the weight according to the geographical distance. The closer the distance, the greater the weight. in, Indicates the enterprise and The geographical distance between is the bandwidth of the Gaussian kernel; A2. Construct an adjacency matrix based on the similarity of water consumption sequences: The similarity of water consumption sequences can be obtained by calculating the Pearson correlation coefficient, and then constructing the adjacency matrix. in, and Indicates the enterprise and Time series of water consumption; A3. Construct an adjacency matrix based on business relationships. Construct an adjacency matrix based on the actual business relationships between enterprises. ; A4. Constructing a comprehensive adjacency matrix: The above three adjacency matrices can be weighted and summed according to certain weights to construct a comprehensive adjacency matrix: in, , and is a weight parameter used to adjust the influence of different relationships and can be optimized through grid search.
8. The water consumption prediction method based on the GNN and LSTM combined model according to claim 1 is characterized in that: The model feature splicing and prediction process in step S2 is as follows: The time feature , Relationship characteristics and combined features Concatenate them together to form the final feature representation: ; Input the concatenated features into the fully connected layer for prediction: .
9. The water consumption prediction method based on the GNN and LSTM combined model according to claim 1 is characterized in that: The loss function of the model training in step S3 is the total mean square error: Use the back-propagation algorithm to calculate the gradient, use the optimizer to update the model parameters, and adjust the hyperparameters at the same time. Repeat the training process until the model converges, and select the hyperparameters that minimize the average value of the loss function during the last 10 iterations.
Citation Information
Patent Citations
Water consumption prediction method and device, electronic equipment and computer readable medium
CN112036668A
Water level prediction method based on GCN-LSTM neural network model
CN116029403A
Cited By
Water plant ultra-short-term water supply quantity prediction method and system based on time multi-scale characteristics
CN119599159A
Deep learning industrial time series data prediction algorithm based on spatial-temporal feature fusion
CN120450174A
Regional water demand calculation method based on artificial intelligence
CN122198446A
