Water demand forecasting method for water supply network based on multi-source data fusion and hybrid model
By integrating multi-source data and using hybrid models, combined with clustering and classification models, the nonlinearity and external interference problems in water demand prediction for water supply networks were solved, enabling efficient management of the water supply system and optimization of water resources.
Patent Information
- Application Number
- CN202510392708.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-03-31
- Publication Date
- 2025-12-09
- Estimated Expiration
- 2045-03-31
AI Technical Summary
Existing water demand forecasting methods struggle to accurately predict water demand in independent metering areas of water supply networks when faced with nonlinear and non-uniformly distributed long-term series data. Furthermore, the predictive performance of a single model is unstable for different types of DMAs, exhibiting poor universality and significant interference from external factors.
A hybrid model integrating clustering, classification, and prediction is adopted. Through the fusion of multi-source data, including historical water consumption, meteorological data, and holiday information, the K-means algorithm is used for daily type clustering, and the XGBoost algorithm is combined to train the daily type classification and water demand prediction model. The feature matrix is optimized to improve prediction accuracy and robustness.
It improves the universality and accuracy of water demand prediction models, maintains good performance when users' water consumption fluctuates briefly and irregularly, is applicable to different types of DMA, and the XGBoost algorithm can characterize users' water consumption behavior, reduce energy consumption, and improve the operating efficiency of water supply systems.
Smart Images

Figure CN120278331B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to a water demand prediction method based on multi-source data fusion, which is used to solve the water demand prediction problem of users in the independent metering area of the water supply network. BACKGROUND
[0002] Water demand prediction is one of the core problems of optimal management of water supply systems and rational allocation of water resources. Water demand prediction aims to predict the water demand in a specific period in the future based on historical water consumption data and water consumption behavior influencing factors. Factors affecting water demand are diverse, including seasonality, holidays, weather conditions (such as temperature, rainfall), user attributes in the prediction area, social and economic activities, population growth, water-saving policies, etc. Common prediction time scales include short-term (such as hours or days), medium-term (such as weeks or months), and long-term (such as years) prediction. Different time scales focus on different aspects, and this paper mainly discusses short-term water demand prediction, and the prediction results mainly serve water supply scheduling and operation optimization. After achieving accurate water demand prediction for different District Metering Areas (DMAs), the scheduling strategy of the pipe network pump valve and the secondary water supply system can be modified based on the prediction results, thereby improving the operation efficiency of the water supply system, reducing energy consumption, reducing resource waste, and providing support for long-term water resource planning. In recent years, with the development of data collection and analysis technology, water demand prediction methods have undergone a transformation from traditional statistical models to data-driven intelligent models.
[0003] The current popular water demand prediction methods can be roughly divided into three categories. The first is the early statistical method. Researchers use traditional statistical time series regression analysis methods such as linear regression, ARMA, ARIMA, and SVR. The second is the machine learning and deep learning method that has emerged in recent years. The third is the hybrid model method, which combines the advantages of different methods to improve the prediction accuracy of the model.
[0004] However, historical water demand data is usually non-linear, non-uniformly distributed time series data with a large time span, and traditional models often still cannot completely extract the characteristics of long sequence data sets with a large time span. In addition, the prediction effect of a single model for water consumption of different categories of DMAs is not stable, and the universality is poor; and the feature input of the hybrid model is mostly simple lag water consumption data, in addition to lag water consumption, the water consumption of users is also easily disturbed by multiple external factors. The water demand of some users is easily affected by changes in season, temperature, rainfall, and social activities due to their special user attributes. SUMMARY
[0005] In view of the above-mentioned prior art, the present invention provides a hybrid model method that integrates clustering model, classification model and prediction model. It can combine the advantages of clustering model, classification model and prediction model, and integrate multi-source data information such as holidays, weather, and historical water consumption to improve the universality and accuracy of water demand prediction model. Even when users' water consumption is subject to short-term irregular fluctuations, the prediction model can still take into account the characteristics of recent water consumption and similar types of daily water consumption, and the model has good performance when predicting water consumption of different types of DMA.
[0006] To address the aforementioned technical problems, this invention proposes a method for predicting water demand in water supply networks based on multi-source data fusion and a hybrid model. This hybrid model is a combination of multiple models, including a clustering model, a daily type classification model, and a prediction model. The method for predicting water demand in water supply networks includes the following steps:
[0007] Step 1: Collect and preprocess multi-source data:
[0008] The multi-source data includes historical water consumption data, meteorological data, and holiday information data, which are relatively easy for water companies to obtain. Since this invention is a method for predicting water demand over long time series, it has certain requirements for data quality. Specifically, the historical water consumption data is granular at one hourly rate, with a time span of more than one year; the meteorological data includes temperature, rainfall, humidity, and wind speed, granular at one hourly rate, with a time span of more than one year; the holiday information includes information on weekdays, weekends, statutory holidays, and daylight saving time, granular at one daily rate, with a time span of more than one year. The collected historical water consumption data and meteorological data are preprocessed, and the z-score method is used to detect and filter outliers. The K-nearest neighbor method is used to imput missing values.
[0009] Step 2: Perform daily clustering based on historical daily water consumption data using a clustering model:
[0010] Clustering methods were used to extract features from the preprocessed historical water consumption data. The historical water consumption data was divided into several daily water consumption samples, and the k-means algorithm was used to cluster the daily water consumption samples to obtain the clustering results of the daily historical water consumption data, thus forming the clustering result vector y. clusterDue to the water demand data will be affected by seasonal, holiday, weather conditions and other external factors appear larger fluctuations, with non-uniform distribution of time series data characteristics, and the water demand data time span is longer, the traditional only use of lag water time series prediction method for the prediction of this type of long sequence data is poor, so the invention determines before the prediction model training, first using clustering method for feature extraction of pretreated historical water consumption data, the historical water consumption data is divided into a number of daily water consumption samples with day as a unit, the clustering algorithm is used to cluster the daily water consumption samples, the clustering results of the daily historical water consumption data are obtained, thereby forming a clustering result vector y cluster ; in the selection of clustering method, the invention tries to divide the clustering model K-means and the time series clustering model K-shape, and preferably uses K-means algorithm to cluster the daily water consumption samples.
[0011] Step 3, preparing a feature matrix for training a classification model, and training a daily type classification model:
[0012] According to the holiday information and the pretreated historical water consumption data and meteorological data, a feature matrix for training a classification model is prepared, denoted as feature matrix A, and label Y A is the clustering result vector y cluster ; the feature matrix A is input into the XGBoost algorithm for training to form a daily type classification model; the feature information of the feature matrix A corresponding to the day to be predicted is input into the daily type classification model, and the output of the daily type classification model is the daily type classification result of the day to be predicted; the XGBoost algorithm is a high-efficiency gradient boosting algorithm, which is widely used in classification, regression and sorting tasks, and is used in the invention to solve the daily type classification and water demand prediction problems. The principle of XGBoost is based on gradient boosting trees (GBT), and many important optimizations are made on this basis, which is especially suitable for large-scale data sets. The algorithm combines multiple weak learners through an additive model, and in the process of training the daily type classification model, the weak learner is a decision tree.
[0013] The structure of the feature matrix A and the output label Y A is shown as follows:
[0014]
[0015] Y A =y cluster
[0016] Wherein, x se is a seasonal factor vector, and the summer time and winter time to which the day belongs are represented by 0 and 1 respectively.mon is a month factor vector, months are sequentially coded, and the coding result of the day belonging to the month is taken as the value of the feature; x day is a date factor vector, dates are sequentially coded, and the corresponding coding of the day is taken as the value of the feature; meteorological factors include four-dimensional vectors, respectively, rainfall x rain , air temperature x temp , humidity x hum , wind speed x wind , and the average value of the daily meteorological factors is taken as the value of the feature; x holi is a holiday factor vector, working days and rest days are respectively coded as 0 and 1 according to local calendar information, and the coding result is taken as the value of the feature, wherein statutory holidays and weekends are all identified as rest days; lag day water consumption information includes the average water consumption of the lag day and the standard deviation of water consumption , wherein the lag day water consumption refers to the water consumption of a certain number of days before the current day, such as the water consumption of the first lag day, which is 1 day before the current day; respectively including the average value of the hourly water consumption of the first lag day to the nth lag day feature vector; respectively including the average value of the hourly water consumption of the first lag day to the nth lag day feature vector; is the average value of the hourly water consumption of the kth lag day feature vector; is the average value of the hourly water consumption of the kth lag day feature vector; x ik is the water consumption of the i hour of the kth lag day.
[0017] Since the dimensions of each feature are different, there are scale differences between the features, so it is necessary to uniformly standardize each dimension feature to align the feature scale. The present application adopts the Z-score standardization method to standardize each dimension feature of the feature matrix A, and the calculation formula is as follows:
[0018]
[0019] , wherein x is the feature value, μ is the mean of the feature vector, and σ is the standard deviation of the feature vector.
[0020] Step 4, the multi-source data fusion feature matrix for training the prediction model is prepared, and the water demand prediction model is trained:
[0021] The daily historical water consumption data clustering result vector obtained by the clustering model is combined with the multi-source data to make a multi-source data fusion feature matrix for training the prediction model, which is denoted as a feature matrix B; the feature matrix B is input into an XGBoost algorithm for training to form a water demand prediction model; the XGBoost algorithm combines multiple weak learners through an additive model to gradually reduce the prediction error, and in the process of training the water demand prediction model, the weak learner is a regression tree; the feature matrix B and the output label Y B The structure of the feature matrix B is as follows:
[0022]
[0023] The obtaining step of the long-term lag water consumption of the same type day comprises the following steps: firstly, according to the clustering result y cluster , the daily historical water consumption is grouped and rearranged in time sequence to obtain the historical water consumption sequence of each type day; then, according to the historical water consumption sequence of the same type day to which the current time water consumption belongs, the current time water consumption is subjected to lag processing to obtain the long-term lag water consumption of the same type day.
[0024] After obtaining the day type classification model and the water demand prediction model, the water demand of a certain day and a certain time in the future can be predicted, which specifically comprises the following steps: according to the structure of the feature matrix A, the features of the day to be predicted are made into a feature sample of the day to be predicted to input into the day type classification model to obtain the day type classification result of the day to be predicted; according to the structure of the feature matrix B, the day type classification result of the day to be predicted is combined to make a feature sample of the time to be predicted of the day to be predicted to input into the water demand prediction model, and the output of the water demand prediction model is the water demand prediction value of the day and the time.
[0025] In the present application, according to the feature importance of the short-term lag water consumption feature and the feature importance of the long-term lag water consumption feature in the water demand prediction model, the water consumption behavior of the user is described, wherein the feature importance of the short-term lag water consumption feature represents the inertia of the water consumption behavior of the user, the feature importance of the long-term lag water consumption feature represents the periodicity of the water consumption behavior of the user, and the greater the feature importance value, the more obvious the corresponding water consumption behavior characteristics. The feature importance is calculated after the training of the water demand prediction model using the XGBoost algorithm, the contribution degree of each dimension data in the feature matrix to the prediction result is calculated, the result is represented by Gain value, and the calculation method is the same as that of calculating information gain, that is, the increment of entropy when a certain feature is split, and the greater the increment, the stronger the importance of the feature.
[0026] Compared with the prior art, the present application has the following advantages:
[0027] (1) The mixed feature matrix optimized by multi-source data fusion used in the training process can better play the prediction ability of the XGBoost regression model on future water demand, and the importance proportion of the features after multi-source data fusion in the prediction model is higher than that of the simple time lag features.
[0028] (2) The prediction model optimized by multi-source data fusion in the present application has better robustness than the existing prediction method, and has good prediction effect on different user types of DMA.
[0029] (3) The XGBoost algorithm used in the present application has a feature importance evaluation function, which can describe the water consumption behavior of the predicted DMA user to a certain extent according to the importance proportion of each feature in the prediction model. BRIEF DESCRIPTION OF DRAWINGS
[0030] Figure 1 is a schematic diagram of the water demand prediction method of the water supply network of the present application;
[0031] Figure 2 XGBoost algorithm schematic diagram. DETAILED DESCRIPTION
[0032] The water demand prediction method based on multi-source data fusion and hybrid model described in the present application will be further described below in combination with the drawings and through specific embodiments:
[0033] As shown in Figure 1 , the present application proposes a water demand prediction method for water supply network based on multi-source data fusion and hybrid model, the hybrid model is a combination of multiple models, and the hybrid model includes a clustering model, a day type classification model and a prediction model; the water demand prediction method for water supply network mainly includes: classifying and preprocessing multi-source data; using a clustering algorithm to realize day type clustering based on daily historical water consumption data; making a feature matrix based on multi-source data and day type clustering label to train the day type classification model; making a multi-source data fusion feature matrix for the prediction model training based on the classification model classification result and training the prediction model; after obtaining the day type classification model and the water demand prediction model, predicting the water demand at a certain time on a future day. The specific content of each step is as follows:
[0034] Step 1: Classify and preprocess multi-source data.
[0035] In the present application, the multi-source data includes historical water consumption data, meteorological data and holiday information data, which is easy to obtain for water department; since the present application is a long time series water demand prediction method, it has certain requirements for the quality of data. Among them, the granularity of historical water consumption data is one number per hour, and the time span is more than one year; meteorological data includes temperature, rainfall, humidity and wind speed, the granularity is one number per hour, and the time span is more than one year; holiday information includes working day, weekend, legal holiday and daylight saving time information, the granularity is one number per day, and the time span is more than one year. The historical water consumption data and meteorological data collected above are preprocessed, the z-score method is used for detection and filtering of abnormal values, and the K nearest neighbor method is used for missing value interpolation.
[0036] Second step: using clustering algorithm based on daily historical water consumption data to realize day type clustering.
[0037] Since the water demand data will be affected by seasonal, holiday, weather conditions and other external factors, it will have a large fluctuation, and has the characteristics of non-uniformly distributed time series data, and the time span of water demand data is long, the traditional time series prediction method only using lag water demand has poor prediction effect on this type of long sequence data, therefore, the present application decides to use clustering method to extract features from the preprocessed historical water consumption data before training the prediction model, and the historical water consumption data is divided into daily water consumption samples, the clustering algorithm is used to cluster the daily water consumption samples, and the clustering result of the daily historical water consumption data is obtained, so as to form a clustering result vector y cluster , and according to the water consumption data of different day types, the corresponding prediction model feature matrix is formulated, the long sequence data is divided into samples by day, and the features in the similar day type sample are taken for model training, so as to improve the fitting accuracy of the prediction model for different day types.
[0038] Since the historical water consumption data is typical time series data, and it has obvious peak and valley time series shape characteristics, the problem can be transformed into a time series clustering problem. The historical water consumption data sample set in the present application can be recorded as a set D containing n time series samples D={D1, D2, …, D n}, wherein each sample is a time series composed of 24 time water consumption values per day. The clustering process of historical water consumption data is to map D to clustering result C through similarity measurement F, which can be represented by formula C=F(D), wherein C={C1, C2, …, C m}, and
[0039] In the selection of clustering methods, the application attempts to divide the clustering model K-means and the clustering model K-Shape for time series, and decides to use the K-means algorithm to cluster the daily time history water consumption data.
[0040] The core of the k-means algorithm mainly includes three steps, one is to calculate the centroid of each class, the second is to determine the class to which each data belongs according to the centroid and the similarity measurement method, and the third is to iterate according to the objective function. In the application, the Euclidean distance formula is used to calculate the distance Dist(D i ,D j ) between data sample points, and the calculation formula is as follows:
[0041]
[0042] Wherein, D i ,D j represent the i-th and j-th historical water consumption data sample; D ik ,D jk represent the k-th value of the i-th and j-th sample; T represents the total number of variables of each sample, and in the application, each historical water consumption data sample is a time series composed of 24 time values of water consumption in a day, that is, D Therefore, T is 24 here.
[0043] The calculation formula of the centroid D i of each cluster C io is as follows:
[0044]
[0045] Wherein, r i is the total number of samples in the cluster C i ; D tk represents the value of the t-th variable in the k-th sample, and in this paper, it represents the value of the water consumption at the t-th time in each historical water consumption data sample.
[0046] The target of the clustering of the application is to minimize the sum of squares of distances between sample points and centroids in the cluster, and the calculation formula is as follows:
[0047]
[0048] Wherein, m is the total number of clusters in the set C; C i is the i-th cluster in the set C; D is the historical water consumption data sample in C i , and D io is the centroid of the i-th cluster.
[0049] After the daily type clustering of the historical water consumption data is completed, the historical water consumption similarity features extracted in the daily type clustering need to be introduced into the feature matrix of the prediction model, and this process is realized through the daily type classification module.
[0050] In the third step, the feature matrix is made based on the multi-source data and the daily type clustering label to train the daily type classification model.
[0051] Because the water consumption information of the day to be predicted is unknown, the only information that can be obtained for judging the daily type of the day to be predicted is the water consumption behavior influencing factor other than the water consumption. In order to add the clustering information of the day to be predicted in the feature matrix of the prediction model, the classification of the daily type of the day to be predicted needs to be realized based on the multi-source data and the clustering result. According to the holiday information and the preprocessed historical water consumption data and meteorological data, the feature matrix for training the classification model is made, which is denoted as feature matrix A, and the label Y A is the clustering result vector y cluster ; the feature matrix A is input into the XGBoost algorithm for training to form the daily type classification model; the feature information of the feature matrix A corresponding to the day to be predicted is input into the daily type classification model, and the output of the daily type classification model is the daily type classification result of the day to be predicted.
[0052] The XGBoost algorithm combines multiple weak learners through an additive model, and in the process of training the daily type classification model, the weak learner is a decision tree.
[0053] The structure of the feature matrix A and the output label Y A is shown as follows:
[0054]
[0055] Y A =y cluster
[0056] wherein x se is a seasonal factor vector, the summer time and the winter time to which the day belongs are respectively represented by 0 and 1; x mon is a month factor vector, the month is sequentially coded, and the coding result of the month to which the day belongs is taken as the value of the feature; x day is a date factor vector, the date is sequentially coded, and the coding of the day is taken as the value of the feature; the meteorological factor includes a four-dimensional vector, which is the average value of the daily meteorological factor, and is taken as the value of the feature; x rain is the rainfall x temp , the temperature x hum , the humidity x wind , and the wind speed x holiHoliday factor vector, according to local calendar information, working days and holidays are encoded as 0 and 1 respectively, and the encoding result is taken as the value of the feature.
[0057] Lag day water consumption information includes the average water consumption of the lag day and the standard deviation of water consumption Among them, the lag day water consumption refers to the water consumption of a certain number of days before the current day, such as the first lag day water consumption, which is 1 day before the current day; respectively including the average value feature vector of the hourly water consumption of the first lag day to the nth lag day; respectively including the standard deviation feature vector of the hourly water consumption of the first lag day to the nth lag day; is the average value feature vector of the hourly water consumption of the kth lag day; is the standard deviation feature vector of the hourly water consumption of the kth lag day;x ik is the water consumption of the i hour of the kth lag day.
[0058] Because the dimensions of the features are different, there are scale differences between the features, so it is necessary to standardize each dimension of the feature to align the feature scale. The present application adopts Z-score standardization method to standardize each dimension of the feature matrix A, and the calculation formula is as follows:
[0059]
[0060] Among them, x is the feature value, μ is the mean of the feature vector, and σ is the standard deviation of the feature vector.
[0061] The present application adopts XGBoost algorithm as the algorithm core of the classification model, and the XGBoost algorithm is a high-efficiency gradient boosting algorithm, which is widely used in classification, regression and sorting tasks, and is used in the present application to solve the day type classification and water demand prediction problems. The principle of XGBoost is based on gradient boosting tree (GBT), and many important optimizations are made on this basis, which is especially suitable for large-scale data sets. The algorithm structure of XGBoost is as shown in Figure 2 The core idea is to combine multiple weak learners through additive model to gradually reduce the prediction error, and the prediction form of the model is as shown in the following formula:
[0062]
[0063] Among them, φ(x i ) represents the total water consumption prediction model, f k(x) represents the kth sub-tree model, K is the total number of sub-tree models in the total model for predicting water consumption, and the goal of each sub-tree model is to fit the residual error of water demand prediction by minimizing the loss function. The goal of the XGBoost model in the application is to minimize the loss function with a regularization term, which can be expressed by the following formula:
[0064]
[0065] wherein, represents the loss function, and in the application, the average squared residual error between the predicted water consumption value and the true value, i.e. Ω(f k ) represents the regularization term, which is used to control the complexity of each tree, and XGBoost uses L2 regularization to limit the number of leaf nodes and leaf node weights to prevent overfitting.
[0066] The specific process of the algorithm is as follows:
[0067] 1) Initialize the model. The goal of XGBoost is to minimize the objective function by gradually adding multiple weak learners to the model. To achieve this effect, the application first uses the mean of the predicted value as the initial value of the total model.
[0068] 2) Build weak learner sub-models. XGBoost fits the residual error of the last generation model by building new weak learner sub-models in each iteration, and optimizes the internal structure of the weak learner sub-models by calculating the first and second derivatives of the loss function, thereby reducing the objective function value. The optimization process mainly includes two parts:
[0069] 2-1) Select the best split point. The best split point is determined by calculating the gain of all possible split points for each feature, and the split point with the maximum gain is selected as the optimal split point for the current node. XGBoost uses a split gain calculation method based on the first and second derivatives, and the gain of each split point can be expressed by the following formula:
[0070]
[0071] wherein, G L and G R are the sum of the gradients of the left and right child nodes, respectively, H L and H R are the sum of the corresponding second-order gradients, λ is the regularization parameter, and γ is the regularization term.
[0072] 2-2) Calculate the leaf node weight. The weight is optimized by calculating the first and second derivatives of the loss function, and the optimal value of the weight can be expressed by the following formula:
[0073]
[0074] wherein, I j is the set of samples contained in leaf node j; g i is the gradient of the current sample water demand prediction value; h i is the second derivative of the current sample water demand prediction value, and λ is a regularization parameter;
[0075] 3) Repeat step 2) for iterations until a termination condition is reached. The termination condition is that a preset number of weak learners is reached, a maximum number of iterations is reached, or the residual change is small.
[0076] In addition to adding a regularization and penalty term in the objective function, the XGBoost algorithm also performs column subsampling, parallel computing, shrinkage, and optimization of missing value processing, so that it has certain improvement in prediction accuracy and computational time and space complexity compared with traditional gradient boosting algorithms.
[0077] In the present application, the water demand daily type classification model uses a decision tree as a weak learner of the XGBoost algorithm, and the model training parameters can be set as shown in the following table:
[0078] Hyperparameter name Value or range Step size objective 'multi:softmax' - eval_metric 'logloss' - num_class 2-9 1 max_depth 3-9 3 learning_rate 0.01-0.3 0.02 n_estimators 50-100 10 gamma 0.5 - colsample_bytree 0.5-0.9 0.2
[0079] wherein, the values of the classification model hyperparameters objective and eval_metric indicate that the classification model uses a softmax function for solving a multi-classification task as a training set loss function, uses a logarithmic function as a validation set evaluation function, and num_class indicates the number of classifications of the multi-classification task; max_depth indicates the maximum depth of each sub-tree model; learning_rate indicates the learning rate; n_estimator indicates the number of sub-tree models, and since the number of classification samples is relatively small, this parameter in the classification model is set to 50-100; gamma indicates the second derivative regularization term coefficient, which is used to control the model complexity, and in the present application, 0.5 is taken; colsample_bytree indicates the number of column subsampling, that is, the sub-tree model will only extract a certain proportion of columns for training during training, which can reduce overfitting, speed up the training process, and improve the model generalization ability, and is usually taken as 0.5-0.9.
[0080] Step 4: Based on the classification results of the classification model, a multi-source data fusion feature matrix for training the prediction model is made, and the prediction model is trained.
[0081] The daily historical water consumption data clustering result vector obtained by the clustering model is combined with the multi-source data to make a multi-source data fusion feature matrix for training the prediction model, denoted as feature matrix B; and the feature matrix B is input into the XGBoost algorithm for training to form the water demand prediction model.
[0082] In the present application, the XGBoost algorithm is also used in the training process of the water demand prediction model, and the difference from the classification model is that in the process of training to form the water demand prediction model, the weak learner is a regression tree.
[0083] In the process of training to form the water demand prediction model, the training parameters of the XGBoost algorithm can be set according to the following table:
[0084] Hyperparameter name Value or range Step size objective 'reg:squarederror' - max_depth 3-9 3 learning_rate 0.01-0.3 0.02 n_estimators 100-1000 100 gamma 0.5 - colsample_bytree 0.5-0.9 0.2
[0085] The value of the prediction model hyperparameter objective indicates that the square error is used as the model loss function; n_estimator represents the number of sub-tree models, and since the number of prediction samples is relatively large, this parameter in the prediction model is set to 100-1000; the parameter settings of max_depth, learning_rate, gamma and colsample_bytree are the same as those of the classification model.
[0086] The present application uses the feature importance method of XGBoost to analyze the contribution degree of each dimension data to the prediction result. The feature importance refers to a method for measuring the contribution degree of each dimension data to the prediction result after the training of the water demand prediction model using the XGBoost algorithm. In the present application, the "Gain value" method is used to measure the contribution degree of each dimension feature to the prediction result, and the calculation method is the same as that of calculating the information gain, that is, the increment of entropy when a certain feature is split, and the greater the increment, the stronger the importance of the feature. Generally, the existing feature matrix can be optimized according to the importance of the feature, and the features with small feature importance are deleted, so as to improve the model training rate and make the model more focused on the features with high contribution degree.
[0087] In order to improve the prediction accuracy and robustness of the prediction model for long time series data, the input matrix structure of the prediction model is improved in combination with the clustering results of the clustering model and the feature importance of the lag water consumption. The traditional water demand prediction model usually only uses the lag water consumption input feature matrix, and contains many useless lag water consumptions with low importance, which makes the model training cost high, the training accuracy low and the robustness poor.
[0088] In the present application, new feature engineering is designed based on the above experience, and the specific operation is as follows:
[0089] 1) The application adds time features to the periodic information of water consumption to align the time dimension of the prediction results;
[0090] 2) The feature matrix is simplified based on the importance of the lagging water consumption features, reducing the feature dimension from 24 to 4, including 2 dimensions of short-term lagging water consumption features and 2 dimensions of long-term lagging water consumption features.
[0091] 3) To retain the statistical rules of long-term lagging water consumption, the application adds statistical features of water consumption at 24 lagging times;
[0092] 4) To ensure that the model has good performance for different types of DMA, the application adds day type features and long-term lagging water consumption features of the same type of day in combination with the clustering results.
[0093] 5) The application simultaneously introduces weather factor features, aiming to realize the fusion of multi-source data and absorb the user water consumption behavior information hidden in multi-source data.
[0094] The multi-source data fusion feature matrix B and the output label Y used to train the prediction model in the application are represented as follows: B
[0095]
[0096] The obtaining step of the long-term lagging water consumption of the same type of day includes: first, obtaining the clustering results y cluster The daily historical water consumption is grouped and rearranged in time sequence to obtain the historical water consumption sequence of each type of day, and then the current time water consumption is subjected to lag processing according to the historical water consumption sequence of the same type of day to which the current time water consumption belongs, so that the long-term lag water consumption of the same type of day is obtained. This feature more accurately captures the periodic characteristics of the water consumption mode by comparing the lag water consumption of the same type of day, and thus more accurately reflects the periodic water consumption behavior of the user. The finally determined feature matrix is re-input into the XGBoost algorithm for training to obtain the final water demand prediction model. After obtaining the day type classification model and the water demand prediction model, the water demand of a certain day and time in the future can be predicted, which specifically includes the following steps: 1) according to the feature matrix structure of the day type classification model in step 3, the features of the day to be predicted are made into a feature sample of the day to be predicted and input into the day type classification model to obtain the day type classification result of the day to be predicted; 2) according to the multi-source data fusion feature matrix structure of the prediction model, the day type classification result of the day is combined to make a feature sample of the time to be predicted of the day to be predicted and input into the water demand prediction model, and the final model will output the water demand prediction value of the day and the time. At the same time, the water consumption behavior of the user can also be described according to the feature importance of the short-term lag water consumption feature and the long-term lag water consumption feature of the prediction model. The short-term lag water consumption feature can represent the inertia of the user's water consumption behavior, and the long-term lag water consumption feature can represent the periodicity of the user's water consumption behavior. The larger the feature importance value is, the more obvious the corresponding water consumption behavior characteristics are.
[0097] The public dataset provided by the Battle of water demand forecasting (BWDF) competition organized under the background of the third International WDSA-CCWI Joint Conference (https: / / wdsa-ccwi2024.it) is taken as a case for water demand forecasting, and the prediction results are compared with the prediction method used by Perelman et al. [1] The prediction method using the combined area cross-correlation coefficient and lag water consumption, the prediction method using only the lag water consumption feature, and the prediction method of the present application, i.e., the prediction method based on multi-source data fusion and mixed model, are compared. The comparison results are quantified by the Mean Absolute Percentage Error (MAPE) of the prediction results of each model on the test set, and the comparison results are as follows:
[0098]
[0099] The results show that the prediction method based on multi-source data fusion and mixed model used in the application is significantly higher than the method combining regional mutual correlation with lag water consumption characteristics and the method using lag water consumption characteristics in most DMAs, indicating that the feature matrix optimized by multi-source data fusion can better play the prediction ability of XGBoost regression algorithm on future water demand. In the case of the disclosed data set, the average prediction MAPE of the prediction model of the application can reach below 5%, the highest prediction MAPE is less than 10%, and the lowest prediction MAPE can reach 1.56%, indicating that the model optimized by multi-source data fusion has better robustness compared with the existing method, and has good prediction effect on different user types of DMA.
[0100] Reference: [1] Perelman G, Romano Y, Ostfeld A. Optimizing Time Series Models for Water Demand Forecasting [J]. Engineering Proceedings, 2024, 69(1): 9.
[0101] Although the application is described above with reference to the drawings, the application is not limited to the specific embodiments described above, and the specific embodiments described above are only illustrative but not restrictive, and those skilled in the art can make many improvements and changes under the inspiration of the application without departing from the purpose of the application, and these all belong to the protection of the application.
Claims
1. A water demand forecasting method for water distribution networks based on multi-source data fusion and hybrid models, characterized in that, The hybrid model is a combination of a plurality of models, and the hybrid model comprises a clustering model, a day type classification model and a prediction model; the water demand prediction method of the water supply network comprises the following steps: Step 1, collecting and preprocessing multi-source data; The multi-source data comprises historical water consumption data, meteorological data and holiday information data; wherein, the granularity of the historical water consumption data is one number per hour, and the time span is more than one year; the meteorological data comprises air temperature, rainfall, humidity and wind speed, and the granularity is one number per hour, and the time span is more than one year; the holiday information comprises working days, weekends, statutory holidays and daylight saving time information, and the granularity is one number per day, and the time span is more than one year; The historical water consumption data and the meteorological data collected above are preprocessed, the z-score method is used for detecting and filtering abnormal values, and the K-nearest neighbor method is used for realizing missing value interpolation; Step 2, using a clustering model to cluster the day types based on the daily historical water consumption data; The historical water consumption data after preprocessing is extracted by using a clustering method, the historical water consumption data is divided into a plurality of daily water consumption samples in units of days, the daily water consumption samples are clustered by using a k-means algorithm, and a clustering result of the daily historical water consumption data is obtained, so as to form a clustering result vector ; Step 3, preparing a feature matrix for training a classification model, and training a day type classification model; According to the holiday information and the preprocessed historical water consumption data and meteorological data, a feature matrix for training a classification model is made, denoted as feature matrix , and label is a clustering result vector ; the feature matrix is input into an XGBoost algorithm for training to form a day type classification model; the feature information of the feature matrix corresponding to the day to be predicted is input into the day type classification model, and the output of the day type classification model is the day type classification result of the day to be predicted; The XGBoost algorithm combines a plurality of weak learners through an additive model, and the weak learner is a decision tree in the process of training the day type classification model; The feature matrix and output labels The structure is represented as follows: ; ; Wherein: ; ; ; ; wherein, is a seasonal factor vector, representing the summer time and winter time of the day with 0 and 1 respectively; is a month factor vector, sequentially encoding the month and taking the encoding result of the month of the day as the value of the feature; is a date factor vector, sequentially encoding the date and taking the encoding of the day as the value of the feature weather factors include a four-dimensional vector, respectively, rainfall , air temperature , humidity , wind speed , taking the average value of daily weather factors as the value of the feature; is a holiday factor vector, encoding the working day and rest day with 0 and 1 respectively according to the local calendar information, and taking the encoding result as the value of the feature, wherein the statutory holidays and weekends are all recognized as rest days; The lag day water consumption information includes average water consumption of the lag day and standard deviation of water consumption ; wherein the lag day water consumption refers to water consumption of a certain number of days before the current day, such as the first lag day water consumption, which is water consumption of 1 day before the current day; respectively including an average value feature vector of hourly water consumption of the first lag day to the nth lag day; respectively including a standard deviation feature vector of hourly water consumption of the first lag day to the nth lag day; is an average value feature vector of hourly water consumption of the kth lag day; is a standard deviation feature vector of hourly water consumption of the kth lag day; is water consumption of the ith hour of the kth lag day; The Z-score standardization method is used to standardize each dimension feature of the feature matrix , and the calculation formula is as follows: ; wherein, is the eigenvalue, is the eigenvector mean, is the eigenvector standard deviation; Step 4, preparing a multi-source data fusion feature matrix for training a prediction model, and training a water demand prediction model The daily historical water consumption data clustering result vector obtained by the clustering model is combined with the multi-source data to make a multi-source data fusion feature matrix for training the prediction model, denoted as a feature matrix ; the feature matrix is input into the XGBoost algorithm for training to form a water demand prediction model; The XGBoost algorithm combines a plurality of weak learners through an additive model, and the weak learner is a regression tree in the process of training the water demand prediction model; The feature matrix and output labels The structure is represented as follows: ; The obtaining step of the long-term lagged water consumption of the same type day comprises the following steps: firstly, obtaining clustering results of daily historical water consumption data according to a clustering model grouping daily historical water consumption and rearranging in time sequence to obtain a historical water consumption sequence of each type day; and then, obtaining the long-term lagged water consumption of the same type day by performing lag processing on the current time water consumption according to the historical water consumption sequence of the same type day to which the current time water consumption belongs. After obtaining the day type classification model and the water demand prediction model, the water demand of a certain day and time in the future can be predicted, which comprises the following steps: 4-1) According to the feature matrix The feature of the day to be predicted is made into a feature sample of the day to be predicted, is input into a day type classification model, and a day type classification result of the day to be predicted is obtained. 4-2) According to the feature matrix The structure, combined with the day type classification result of the day to be predicted, makes the feature sample input of the time to be predicted of the day to be predicted into the water demand prediction model, and the output of the water demand prediction model is the water demand prediction value of the day at the time.
2. The method for water demand forecasting of water distribution network based on multi-source data fusion and hybrid model according to claim 1, characterized in that, According to the feature importance of the short-term lag water consumption feature and the feature importance of the long-term lag water consumption feature in the water demand prediction model, the water consumption behavior of the user is described, wherein the feature importance of the short-term lag water consumption feature represents the inertia of the user's water consumption behavior, the feature importance of the long-term lag water consumption feature represents the periodicity of the user's water consumption behavior, and the greater the feature importance value, the more obvious the corresponding water consumption behavior characteristics.
3. The method for water demand forecasting of water distribution network based on multi-source data fusion and hybrid model according to claim 2, characterized in that, The feature importance is calculated after the training of the water demand prediction model using the XGBoost algorithm, and the contribution degree of each dimension data in the feature matrix to the prediction result is represented by the Gain value.
Citation Information
Patent Citations
City short-term water consumption prediction method based on least square support vector machine model
CN104715292A
Daily water consumption prediction method based on big data
CN111210093A