Urban annual water consumption prediction method based on variable point detection and segmented double-layer fusion
Patent Information
- Application Number
- CN202611184735.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-08-06
- Publication Date
- 2026-09-04
AI Technical Summary
[0004](1)对结构突变适应性差:城市用水量的序列常出现“突增—回落—再平稳”的结构迁移;灰色预测模型适用于小样本预测,但当序列出现突增/突降等结构性变化时,单一灰色模型容易出现系统偏差与误差累积;
[0043] 1) This application incorporates the mutation and its regression phase into the change point segment management by detecting abnormal growth rate segments, avoiding being sensitive only to "sudden increase points" while ignoring the distribution drift caused by "structural decline"; at the same time, global weights provide a long-term robust base, dynamic weights provide short-term adaptation, and the dual-layer fusion avoids the pure dynamic weights from swinging violently under noise.
Smart Images

Figure CN122693933A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of urban water consumption prediction technology, specifically to a method for predicting annual urban water consumption based on change point detection and segmented two-layer fusion. Background Technology
[0002] The total annual water consumption of a city is influenced by a combination of factors, including changes in population size, industrial upgrading, the intensity of water conservation policies, climate conditions, water supply capacity boundaries, and macroeconomic fluctuations. It exhibits typical characteristics such as non-stationarity, small sample size, and the coexistence of abrupt changes and regressions.
[0003] Urban annual water consumption forecasting typically employs single-model prediction or simple fusion prediction, mainly including: grey prediction GM(1,1) and its improved models, Holt double exponential smoothing, linear regression / ridge regression, ARIMA and other time series models, as well as ensemble methods that fuse the outputs of multiple models with equal or fixed weights. However, existing technologies have technical shortcomings in the following aspects:
[0004] (1) Poor adaptability to structural changes: The sequence of urban water consumption often shows a structural shift of "sudden increase - decline - stabilization"; the grey prediction model is suitable for small sample prediction, but when the sequence shows structural changes such as sudden increase / decrease, the single grey model is prone to systematic bias and error accumulation.
[0005] (2) Fixed fusion lacks stage adaptation capability: Existing multi-model fusion usually learns a set of fixed weights on the whole sample, which cannot distinguish the statistical characteristics of normal segments and abnormal change points, resulting in weight mismatch near the change points.
[0006] (3) Pure dynamic weighting is not stable enough: If the weights are dynamically updated based on the errors of the most recent few years, although the local adaptability can be improved, it is more sensitive to short sample noise, random outliers and local fluctuations, which can easily cause the weights to fluctuate greatly and the prediction results are not stable enough.
[0007] (4) Abnormal year identification relies on human experience: Most existing technologies require human to specify “abnormal years” or “policy turning points”, which is highly subjective, lacks universality and engineering reusability, and is not conducive to the standardized deployment of software method solutions.
[0008] Therefore, a robust prediction method is needed that can automatically identify abnormal phases, learn model weights in segments, and dynamically adjust them in conjunction with short-term errors. Summary of the Invention
[0009] The purpose of this invention is to overcome the shortcomings of the prior art and provide a method for predicting urban annual water consumption based on change point detection and segmented two-layer fusion.
[0010] The objective of this invention is achieved through the following technical solution:
[0011] This application discloses a method for predicting annual urban water consumption based on change point detection and segmented two-layer fusion, including the following steps:
[0012] S1. Obtain historical urban water consumption data and preprocess it to obtain historical annual urban water consumption data, and divide the historical annual urban water consumption data into a first training period and a verification period.
[0013] S2. Based on the historical data of urban annual water consumption, calculate the growth rate sequence of adjacent years, and then search for the growth rate sub-segment that maximizes the anomaly objective function within the preset anomaly segment length range to obtain the start and end years of the change point segment.
[0014] S3. Establish multiple base models to form a multi-model prediction set. The base models include the grey metabolism GM(1,1,λ) prediction model, the damped double exponential smoothing Holt prediction model, and the Ridge time trend regression prediction model.
[0015] S4. Divide the first training period into an initial window and a second training period. In the second training period, perform a rolling one-step prediction on the multi-model prediction set formed in step S3 through the initial window. Calculate the normal segment error and the variable point segment error respectively. Then map the normal segment error and the variable point segment error to global fusion weights and obtain the global weights of the normal segment and the global weights of the variable point segment.
[0016] S5. Maintain a rolling error cache for the past k years and obtain dynamic weights based on an exponential weighting mechanism;
[0017] S6. During the verification period, the global fusion weight and the dynamic weight are fused to obtain a dual-layer weight. Based on the dual-layer weight, segmented gating prediction and online extrapolation are performed. When predicting the target year, if the target year belongs to a change point segment, the dynamic sensitivity parameter and dynamic intervention intensity are increased, and the global weight of the change point segment is selected; otherwise, the global weight of the normal segment is selected. When extrapolating future years, the output divergence of the base model is calculated and compared with the threshold as an online change point gating signal. The parameters are dynamically switched and the final predicted value is output.
[0018] Preferably, step S1 specifically includes: obtaining historical urban water consumption data, unifying it into annual total water consumption units, and converting the average daily water consumption according to the number of days in a leap year / common year in the Gregorian calendar to obtain historical sequence data of urban annual water consumption.
[0019] Preferably, step S2 specifically includes the following steps:
[0020] S21. Construct a growth rate based on water consumption in adjacent years. ,in, Indicates the first Annual growth rate , For the first Annual water consumption Indicates the first Annual water consumption It is a constant used to prevent the denominator from being zero;
[0021] S22. Construct candidate anomaly segments, assuming the growth rate sequence is... , , where n represents the total number of years, in the growth rate series The search length satisfies the candidate anomaly growth stage length. All continuous sub-segments are selected as candidate anomaly segments; where the length of the candidate anomaly growth stage is... satisfy , Indicates the minimum anomaly length. Indicates the maximum anomaly length;
[0022] S23. For candidate abnormal segments Construct the anomaly objective function , ,in, Indicates the length of the candidate anomaly segment. This represents the average growth rate preceding the candidate outlier segment. The variance of the growth rate preceding the candidate outlier segment. This represents the average growth rate of the candidate outlier segments. The variance of the growth rate of the candidate outlier segments. This represents the average growth rate following the candidate outlier segment. The variance of the growth rate following the candidate outlier segment;
[0023] S24. Traverse all candidate outlier segments and select the candidate outlier segment corresponding to the maximum value of the outlier degree function, thereby determining the change point segment. , ,in Indicates the starting year of the abnormal growth phase. This indicates the year in which the abnormal growth phase ended.
[0024] Preferably, step S3 specifically includes:
[0025] S31. Establish a grey metabolism GM(1,1,λ) prediction model, and analyze the background value coefficients. Perform a grid search, i.e. This minimizes the fitting error, thus yielding the optimal background value coefficients. ; and using a length of A sliding window is used to implement metabolic updates;
[0026] S32. Establish a damped double exponential smoothed Holt prediction model: ,in Indicates the level term. Indicates the trend term. and Represents the smoothing coefficient. Indicates the trend damping coefficient; This represents the horizontal component in year t-1. This represents the trend component in year t-1;
[0027] S33. Establish a Ridge time-trend regression prediction model. ,in, Indicates the trend coefficient. This represents the regression constant, and ridge regression is used to suppress extrapolation divergence.
[0028] Preferably, step S4 specifically includes: assuming the first The prediction results of the base model after performing a rolling one-step operation during the second training period are as follows: Through formula Execute error calculation, where, Indicates the first The mean absolute error of each basis model Indicates the first Root mean square error of each basis model Indicates the first The mean absolute percentage error of the base models, then construct the first... The comprehensive error function corresponding to each basis model , Then through the formula Calculate the global weights of the i-th base model. Global weights based on the i-th base model Extract the years marked as normal during the training period to obtain the global weights for the normal segment. Extract the years marked as anomalous during the training period to obtain the global weights of the variable point segments. If the number of years marked as abnormal is less than the preset threshold, the weight of the normal segment is taken as the default value of the global weight of the variable segment.
[0029] Preferably, step S5 specifically includes:
[0030] Maintain a rolling error cache for the past k years, and obtain dynamic weights based on an exponential weighting mechanism, i.e.:
[0031]
[0032] in, Indicates the i-th base model at the th... Years ago, most recently The average absolute error of the annual rolling error cache; This is the first dynamic weight sensitivity coefficient, which controls the sensitivity of mapping error differences to weights. Indicates the most recent base model of the i-th base model The dynamic weight of the year.
[0033] Preferably, step S6 includes the following steps:
[0034] S61. Calculate the predicted values of the gray metabolism GM(1,1,λ) prediction model. : Let the original annual water consumption sequence be established for ,in For the first Annual water consumption is calculated by summing up the original annual water consumption sequence. ,in Represents the original annual water consumption sequence before The cumulative sum of the terms, where Then, an adjustable background value coefficient is introduced. Constructing a sequence of background values : ,in, ;
[0035] Estimating the development coefficient using the least squares method Ash action amount , Among them, the background value matrix Original sequence vector ;
[0036] Next, construct the time response function: predict The accumulated value after each step; then restored to the original predicted value through cumulative subtraction. , The predicted values of the gray metabolism GM(1,1,λ) prediction model were obtained. : ,in, This indicates that the predicted cumulative sequence is in the first position. The value at time, This indicates that the predicted cumulative sequence is in the first position. The value at time, This indicates that the predicted cumulative sequence is in the first position. The value at time, Represents the natural constant;
[0037] S62. Calculate the predicted values of the damped double exponential smoothed Holt prediction model. respectively through formula and Calculating a level component and a trend component , wherein the trend component at time k, is the level component at time k; thereafter, one-step extrapolation prediction is performed by the formula wherein h is a prediction step index ; if multi-step prediction is required, it is extended to h-step prediction: step prediction: ;
[0038] S63: Calculating a predicted value of the Ridge trend regression prediction model , ; the loss function is ; wherein λ is a regularization strength ;
[0039] S64: When performing online gating in a future year, calculating an output dispersion of a multi-model prediction set : where std represents a standard deviation, and a threshold thr is determined according to quantiles of a historical dispersion sequence;
[0040] if the dispersion of the t-th year is less than thr, then the t-th year belongs to a normal segment, water consumption prediction is performed by using a first dynamic weight sensitivity coefficient η, a basic value and a global weight of the normal segment , and a first double-layer weight is calculated by the formula to calculate a first double-layer weight to generate a fusion prediction function for the normal segment, that is , wherein M represents the total number of base models, represents the i-th base model's predicted value for the t-th year, represents the fusion predicted value of the normal segment;
[0041] if the dispersion of the t-th year is greater than or equal to thr, then the t-th year belongs to a change point segment, water consumption prediction is performed by using a second dynamic weight sensitivity coefficient , a dynamic weight participation degree and a global weight of the change point segment to perform water consumption prediction, and a second double-layer weight is calculated by the formula to calculate a second double-layer weight , represents a global weight of the year change point segment, that is ; Based on the most recent The annual error is calculated using an exponentially weighted dynamic weighting of the variable point segments, where... , This indicates the amplification factor for sensitivity at the point of change. , This represents the dynamic intervention increment at the variable point state; it generates the variable point segment fusion prediction function, i.e. , This represents the fusion prediction value for the variable point segment.
[0042] The beneficial effects of this invention are:
[0043] 1) This application incorporates the mutation and its regression phase into the change point segment management by detecting abnormal growth rate segments, avoiding being sensitive only to "sudden increase points" while ignoring the distribution drift caused by "structural decline"; at the same time, global weights provide a long-term robust base, dynamic weights provide short-term adaptation, and the dual-layer fusion avoids the pure dynamic weights from swinging violently under noise.
[0044] 2) This application uses model divergence as a proxy index for uncertainty, and automatically enters the "change point state" parameter in the future stage to improve the conservatism for potential abnormal years. During the verification period, the segmented two-layer fusion of this embodiment achieved a mean absolute error (MAE) of 1.872, a root mean square error (RMSE) of 2.366, and a mean absolute percentage error (MAPE) of 3.53%, which is significantly better than the traditional GM(1,1,λ) with a MAPE of 21.04%. Attached Figure Description
[0045] Figure 1 This is a flowchart illustrating the urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to an embodiment of the present invention.
[0046] Figure 2 This is a schematic diagram of historical annual water consumption data for a certain city, as per an embodiment of the present invention.
[0047] Figure 3 This is a schematic diagram showing the comparison curves between the actual value during the verification period of this invention and fixed fusion, dynamic fusion, and segmented two-layer fusion.
[0048] Figure 4 This is a graph showing the predicted total water consumption for future years according to an embodiment of the present invention.
[0049] Figure 5 This is a graph showing the average daily water consumption prediction curve after considering leap years, according to an embodiment of the present invention. Detailed Implementation
[0050] The technical solution of the present invention will be clearly and completely described below with reference to the embodiments. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0051] This application discloses a method for predicting annual urban water consumption based on change point detection and segmented two-layer fusion. Robust prediction is achieved through "change point segment identification—segmented weight learning—two-layer fusion—online gated extrapolation." A flowchart of the method is shown below. Figure 1 As shown, it includes the following steps:
[0052] S1. Obtain historical urban water consumption data and preprocess it to obtain historical annual urban water consumption data, and divide the historical annual urban water consumption data into a first training period and a verification period.
[0053] S2. Based on the historical data of urban annual water consumption, calculate the growth rate sequence of adjacent years, and then search for the growth rate sub-segment that maximizes the anomaly objective function within the preset anomaly segment length range to obtain the start and end years of the change point segment.
[0054] S3. Establish multiple base models to form a multi-model prediction set. The base models include the grey metabolism GM(1,1,λ) prediction model, the damped double exponential smoothing Holt prediction model, and the Ridge time trend regression prediction model.
[0055] S4. Divide the first training period into an initial window and a second training period. In the second training period, perform a rolling one-step prediction on the multi-model prediction set formed in step S3 through the initial window. Calculate the normal segment error and the variable point segment error respectively. Then map the normal segment error and the variable point segment error to global fusion weights and obtain the global weights of the normal segment and the global weights of the variable point segment.
[0056] S5. Maintain a rolling error cache for the past k years and obtain dynamic weights based on an exponential weighting mechanism;
[0057] S6. During the verification period, the global fusion weight and the dynamic weight are fused to obtain a dual-layer weight. Based on the dual-layer weight, segmented gating prediction and online extrapolation are performed. When predicting the target year, if the target year belongs to a change point segment, the dynamic sensitivity parameter and dynamic intervention intensity are increased, and the global weight of the change point segment is selected; otherwise, the global weight of the normal segment is selected. When extrapolating future years, the output divergence of the base model is calculated and compared with the threshold as an online change point gating signal. The parameters are dynamically switched and the final predicted value is output.
[0058] For example, step S1 specifically includes: obtaining historical urban water consumption data, unifying it into the unit of total annual water consumption, and converting the average daily water consumption according to the number of days in a leap year / common year (366 days for leap years and 365 days for common years) to obtain historical sequence data of urban annual water consumption.
[0059] For example, step S2 specifically includes the following steps:
[0060] S21. Construct a growth rate based on water consumption in adjacent years. ,in, Indicates the first Annual growth rate , For the first Annual water consumption Indicates the first Annual water consumption It is a constant used to prevent the denominator from being zero;
[0061] S22. Construct candidate anomaly segments, assuming the growth rate sequence is... , , where n represents the total number of years, in the growth rate series The search length satisfies the candidate anomaly growth stage length. All continuous sub-segments are selected as candidate anomaly segments; where the length of the candidate anomaly growth stage is... satisfy , Indicates the minimum anomaly length. Indicates the maximum anomaly length;
[0062] S23. For candidate abnormal segments Construct the anomaly objective function , ,in, Indicates the length of the candidate anomaly segment. This represents the average growth rate preceding the candidate outlier segment. The variance of the growth rate preceding the candidate outlier segment. This represents the average growth rate of the candidate outlier segments. The variance of the growth rate of the candidate outlier segments. This represents the average growth rate following the candidate outlier segment. The variance of the growth rate following the candidate outlier segment;
[0063] S24. Traverse all candidate outlier segments and select the candidate outlier segment corresponding to the maximum value of the outlier degree function, thereby determining the change point segment. , ,in Indicates the starting year of the abnormal growth phase. This indicates the year in which the abnormal growth phase ended.
[0064] For example, step S3 specifically includes:
[0065] S31. Establish a grey metabolism GM(1,1,λ) prediction model, and analyze the background value coefficients. Perform a grid search, i.e. This minimizes the fitting error, thus yielding the optimal background value coefficients. ; and using a length of A sliding window is used to implement metabolic updates;
[0066] S32. Establish a damped double exponential smoothed Holt prediction model: ,in Indicates the level term. Indicates the trend term. and Represents the smoothing coefficient ( ), in the code Through grid search ( , Minimize the absolute error in the final step. Indicates the trend damping coefficient (fixed) ); This represents the horizontal component in year t-1. This represents the trend component in year t-1;
[0067] S33. Establish a Ridge time-trend regression prediction model. ,in, Indicates the trend coefficient. This represents the regression constant, and ridge regression is used to suppress extrapolation divergence.
[0068] For example, step S4 specifically includes: Let the first The prediction results of the base model after performing a rolling one-step operation during the second training period are as follows: Through formula Execute error calculation, where, Indicates the first The mean absolute error of each basis model Indicates the first Root mean square error of each basis model Indicates the first The mean absolute percentage error of the base models, then construct the first... The comprehensive error function corresponding to each basis model , Then through the formula Calculate the global weights of the i-th base model. Global weights based on the i-th base model Extract the years marked as normal during the training period to obtain the global weights for the normal segment. Extract the years marked as anomalous during the training period to obtain the global weights of the variable point segments. If the number of years marked as abnormal is less than the preset threshold, the weight of the normal segment is taken as the default value of the global weight of the variable segment.
[0069] For example, step S5 specifically includes:
[0070] Maintain a rolling error cache for the past k years, and obtain dynamic weights based on an exponential weighting mechanism, i.e.:
[0071]
[0072] in, Indicates the i-th base model at the th... Years ago, most recently The average absolute error of the annual rolling error cache; This is the first dynamic weight sensitivity coefficient, which controls the sensitivity of mapping error differences to weights. Indicates the most recent base model of the i-th base model The dynamic weight of the year.
[0073] For example, step S6 includes the following steps:
[0074] S61. Calculate the predicted values of the gray metabolism GM(1,1,λ) prediction model. : Let the original annual water consumption sequence be established for ,in For the first Annual water consumption is calculated by summing up the original annual water consumption sequence. ,in Represents the original annual water consumption sequence before The cumulative sum of terms (the purpose of which is to reduce random fluctuations in the original data through accumulation operations), where Then, an adjustable background value coefficient is introduced. ( Constructing a background value sequence : ,in, ;
[0075] Estimating the development coefficient using the least squares method Ash action amount , Among them, the background value matrix The first column represents the negative background values at each time point. The second column is all 1s (corresponding to the coefficient of the constant term b), the original sequence vector. , where the original sequence is a column vector consisting of the 2nd to the nth item (because k starts from 2);
[0076] Next, construct the time response function: predict The accumulated value after each step; then restored to the original predicted value through cumulative subtraction. , The predicted values of the gray metabolism GM(1,1,λ) prediction model were obtained. : ,in, This indicates that the predicted cumulative sequence is in the first position. The value at time (obtained by the time response function). This indicates that the predicted cumulative sequence is in the first position. The value at time, This indicates that the predicted cumulative sequence is in the first position. The value at time, This represents the natural constant (approximately 2.71828).
[0077] S62. Calculate the predicted values of the damped double exponential smoothed Holt prediction model. respectively through formula and Calculate the horizontal components and trend components ,in, No. The trend weight of time, For the first The horizontal component at time; then, through the formula Perform one step of extrapolation prediction. Prediction step index; if multi-step prediction is required, it is generalized to... Step prediction: ; (in the summation symbol) In the middle, when making a prediction step ,Pick Multi-step prediction Take from 1 each Representing the (The contribution of the step damping coefficient to the attenuation of the trend).
[0078] S63. Calculate the predicted value of the Ridge trend regression prediction model. , The loss function is ; where regularization intensity ;
[0079] S64, when performing online gating in future years, calculating the output dispersion of the multi-model prediction set : , std represents the standard deviation, and the threshold thr is determined according to the quantile of the historical dispersion sequence;
[0080] If the year's dispersion<thr, the year belongs to the normal segment, the first dynamic weight sensitivity coefficient η, the base value and the global weight of the normal segment are used for water consumption prediction, and the first two-layer weight is calculated through the formula , to generate a fused prediction function for the normal segment, that is , wherein represents the total number of base models (in this embodiment ), represents the prediction value of the -th base model for the -th year, represents the fused prediction value of the normal segment; each two-layer weight satisfies ;
[0081] If the year's dispersion ≥ thr, the year belongs to the change point segment, the second dynamic weight sensitivity coefficient , the participation degree of dynamic weight and the global weight of the change point segment are used for water consumption prediction, and the second two-layer weight is calculated through the formula , represents the global weight of the change point segment of the year, that is ; is the exponentially weighted dynamic weight of the change point segment based on the errors of the recent years, wherein , represents the sensitivity amplification factor of the change point state, , represents the dynamic intervention increment of the change point state; generating a fused prediction function for the change point segment, that is , represents the fused prediction value of the change point segment, and each two-layer weight of the change point segment satisfies .
[0082] Exemplarily, refer to Figures 2-5 The total annual water consumption (in billions of m³) of a certain city from 2003 to 2024 was used as the input sequence. Anomaly detection of the growth rate was performed, automatically identifying the anomaly segment as 2017–2020. The results reflect a structural shift in the sequence, from a sudden increase in 2015–2017 to a sustained decline in 2018–2020, making the anomaly in the growth rate statistically manifest as a continuous anomaly segment of "abrupt change + regression".
[0083] For example, parameter search and optimal configuration: the first training period is set to 2003–2018, and the validation period is set to 2019–2024. Since the base model's rolling prediction requires at least one initial window (determined by the parameters...) The decision was made to cover a period of 4–12 years, therefore, rolling one-step predictions were actually performed annually starting in 2007, with errors recorded. The first training period covered the complete history of water consumption (2003–2018), while the second training period (2007–2018) was used to statistically analyze the prediction errors of each model in normal and variable segments, and then calculate the two types of global fusion weights. After the training period, these weights served as a fixed base in the subsequent validation period (2019–2024) and future extrapolation period (2026–2036), fusing with dynamic weights to form a two-layer weight structure.
[0084] A grid search was performed on the parameters to obtain the optimal solution: =12, k=3, =1.5、 =0.4、 =3.0、 =0.3, Year of onset of abnormal growth phase =2017 and the year the abnormal growth phase ended =2020; The learned global weights are: = {Grey metabolism GM(1,1,λ) prediction model: 0.324, damped double exponential smoothing Holt prediction model: 0.359, Ridge time trend regression prediction model: 0.317}; = {Grey metabolism GM(1,1,λ) prediction model: 0.324, Damped double exponential smoothing Holt prediction model: 0.359, Ridge time trend regression prediction model: 0.317}. In this backtest, the global weights for the normal segment and the variable segment are consistent because the sample size of the variable segment is relatively short and the relative error structures of the three models are similar, leading to convergence after weight mapping; however, the two-layer fusion still passes ( , This enables stronger dynamic correction of the "change point state".
[0085] For example, a comparison of the effects during the verification period (2019–2024):
[0086] Validation results for the traditional GM(1,1,λ): Mean Absolute Error (MAE) = 11.199, Root Mean Square Error (RMSE) = 11.350, Mean Absolute Percentage Error (MAPE) = 21.04%;
[0087] Fixed fusion (using) Verification results: Mean absolute error (MAE) = 3.046, root mean square error (RMSE) = 4.043, mean absolute percentage error (MAPE) = 5.86%;
[0088] Dynamic fusion (only) Verification results: Mean absolute error (MAE) = 3.199, root mean square error (RMSE) = 3.536, mean absolute percentage error (MAPE) = 6.03%;
[0089] The verification results of segmented two-layer fusion (this invention) are as follows: mean absolute error (MAE) = 1.872, root mean square error (RMSE) = 2.366, and mean absolute percentage error (MAPE) = 3.53%.
[0090] Table 1 shows the comparison of errors of different methods during the validation period from 2019 to 2024.
[0091] Table 1: Comparison of errors of different methods during the validation period from 2019 to 2024
[0092] Traditional GM(1,1,λ) 11.199 11.350 21.04% Fixed fusion 3.046 4.043 5.86% Dynamic fusion 3.199 3.536 6.03% Segmented dual-layer fusion (this invention) 1.872 2.366 3.53%
[0093] The year-by-year output results show that 2019 and 2020 are considered transitional periods. =4.5、 =0.7, dynamic weighting intervenes more strongly; 2021–2024 is a normal period, so η=1.5 is used. =0.4, with stability as the main focus and dynamic correction as a supplement; in 2024, the dynamic weight showed a significant increase and rebalancing, indicating that the error structure has changed in recent years and the two-layer fusion can adaptively adjust.
[0094] For example, an online gating strategy is used to extrapolate the total annual water consumption (100 million m³) and average daily water consumption (10,000 m³ / day) from 2026 to 2036. The structure is shown in Table 2 (2025 is predicted first as the recursive input, but only 2026-2036 are output in the end).
[0095] Table 2: Total Annual Water Consumption and Average Daily Water Consumption, 2026–2036
[0096] 2026 56.196 365 1539.615 2027 56.206 365 1539.903 2028 56.635 366 1547.398 2029 57.589 365 1577.794 2030 58.572 365 1604.701 2031 59.354 365 1626.136 2032 59.921 366 1637.180 2033 60.360 365 1653.709 2034 60.600 365 1660.278 2035 61.131 365 1674.820 2036 61.741 366 1686.903
[0097] The above description is merely a preferred embodiment of the present invention. It should be understood that the present invention is not limited to the forms disclosed herein and should not be construed as excluding other embodiments. It can be used in various other combinations, modifications, and environments, and can be altered within the scope of the concept described herein through the above teachings or related technologies or knowledge. Modifications and variations made by those skilled in the art that do not depart from the spirit and scope of the present invention should be within the protection scope of the appended claims.
Claims
1. A method for predicting annual urban water consumption based on change point detection and segmented two-layer fusion, characterized in that, Includes the following steps: S1. Obtain historical urban water consumption data and preprocess it to obtain historical annual urban water consumption data, and divide the historical annual urban water consumption data into a first training period and a verification period. S2. Based on the historical data of urban annual water consumption, calculate the growth rate sequence of adjacent years, and then search for the growth rate sub-segment that maximizes the anomaly objective function within the preset anomaly segment length range to obtain the start and end years of the change point segment. S3. Establish multiple base models to form a multi-model prediction set. The base models include the grey metabolism GM(1,1,λ) prediction model, the damped double exponential smoothing Holt prediction model, and the Ridge time trend regression prediction model. S4. Divide the first training period into an initial window and a second training period. In the second training period, perform a rolling one-step prediction on the multi-model prediction set formed in step S3 through the initial window. Calculate the normal segment error and the variable point segment error respectively. Then map the normal segment error and the variable point segment error to global fusion weights and obtain the global weights of the normal segment and the global weights of the variable point segment. S5. Maintain a rolling error cache for the past k years and obtain dynamic weights based on an exponential weighting mechanism; S6. During the verification period, the global fusion weight and the dynamic weight are fused to obtain a dual-layer weight; based on the dual-layer weight, segmented gating prediction and online extrapolation are performed. When predicting the target year, if the target year belongs to a variable point segment, the dynamic sensitivity parameter and dynamic intervention intensity are increased, and the global weight of the variable point segment is selected. Otherwise, the global weight of the normal segment is selected; when extrapolating to future years, the output divergence of the base model is calculated and compared with the threshold as an online variable point gating signal, and the parameters are dynamically switched and the final predicted value is output.
2. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 1, characterized in that, Step S1 specifically includes: obtaining historical urban water consumption data, unifying it into the unit of total annual water consumption, and converting the average daily water consumption according to the number of days in a leap year / common year in the Gregorian calendar to obtain historical sequence data of urban annual water consumption.
3. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 2, characterized in that, Step S2 specifically includes the following steps: S21. Construct the growth rate based on water consumption in adjacent years. ,in, Indicates the first Annual growth rate , For the first Annual water consumption Indicates the first Annual water consumption It is a constant used to prevent the denominator from being zero; S22. Construct candidate anomaly segments, assuming the growth rate sequence is... , , where n represents the total number of years, in the growth rate series The search length satisfies the candidate anomaly growth stage length. All consecutive sub-segments are selected as candidate anomaly segments; where the length of the candidate anomaly growth stage is... satisfy , Indicates the minimum anomaly length. Indicates the maximum anomaly length; S23. For candidate abnormal segments Construct the anomaly objective function , ,in, Indicates the length of the candidate anomaly segment. This represents the average growth rate preceding the candidate outlier segment. The variance of the growth rate preceding the candidate outlier segment. This represents the average growth rate of the candidate outlier segments. The variance of the growth rate of the candidate outlier segments. This represents the average growth rate following the candidate outlier segment. The variance of the growth rate following the candidate outlier segment; S24. Traverse all candidate outlier segments and select the candidate outlier segment corresponding to the maximum value of the outlier degree function, thereby determining the change point segment. , ,in Indicates the starting year of the abnormal growth phase. This indicates the year in which the abnormal growth phase ended.
4. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 3, characterized in that, Step S3 specifically includes: S31. Establish a grey metabolism GM(1,1,λ) prediction model, and analyze the background value coefficients. Perform a grid search, i.e. This minimizes the fitting error, thus yielding the optimal background value coefficients. ; and using a length of A sliding window is used to implement metabolic updates; S32. Establish a damped double exponential smoothed Holt prediction model: ,in Indicates the level term. Indicates the trend term. and Represents the smoothing coefficient. Indicates the trend damping coefficient; This represents the horizontal component in year t-1. This represents the trend component in year t-1; S33. Establish a Ridge time-trend regression prediction model. ,in, Indicates the trend coefficient. This represents the regression constant, and ridge regression is used to suppress extrapolation divergence.
5. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 4, characterized in that, Step S4 specifically includes: Let the first... The prediction results of the base model after performing a rolling one-step operation during the second training period are as follows: Through formula Execute error calculation, where, Indicates the first The mean absolute error of each basis model Indicates the first Root mean square error of each basis model Indicates the first The mean absolute percentage error of the base models, then construct the first... The comprehensive error function corresponding to each basis model , Then through the formula Calculate the global weights of the i-th base model Global weights based on the i-th base model Extract the years marked as normal during the training period to obtain the global weights for the normal segment. Extract the years marked as anomalous during the training period to obtain the global weights of the variable point segments. If the number of years marked as abnormal is less than the preset threshold, the weight of the normal segment is taken as the default value of the global weight of the variable segment.
6. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 5, characterized in that, Step S5 specifically includes: Maintain a rolling error cache for the past k years, and obtain dynamic weights based on an exponential weighting mechanism, i.e.: in, Indicates the i-th base model at the th... Years ago, most recently The average absolute error of the annual rolling error cache; This is the first dynamic weight sensitivity coefficient, which controls the sensitivity of mapping error differences to weights. Indicates the most recent base model of the i-th base model The dynamic weight of the year.
7. The urban annual water consumption prediction method based on change point detection and segmented two-layer fusion according to claim 6, characterized in that, Step S6 includes the following steps: S61. Calculate the predicted values of the gray metabolism GM(1,1,λ) prediction model. : Let the original annual water consumption sequence be established for ,in For the first Annual water consumption is calculated by summing up the original annual water consumption sequence. ,in Represents the original annual water consumption sequence before The cumulative sum of the terms, where Then, an adjustable background value coefficient is introduced. Constructing a sequence of background values : ,in, ; Estimating the development coefficient using the least squares method Ash action amount , Among them, the background value matrix Original sequence vector ; Then construct the time response function predict The accumulated value after each step; then restored to the original predicted value through cumulative subtraction. , The predicted values of the gray metabolism GM(1,1,λ) prediction model were obtained. : ,in, This indicates that the predicted cumulative sequence is in the first position. The value at time, This indicates that the predicted cumulative sequence is in the first position. The value at time, This indicates that the predicted cumulative sequence is in the first position. The value at time, Represents the natural constant; S62. Calculate the predicted values of the damped double exponential smoothed Holt prediction model. respectively through formula and Calculate the horizontal components and trend components ,in, No. The trend weight of time, For the first The horizontal component at time; then, through the formula Perform one step of extrapolation prediction. Prediction step index; if multi-step prediction is required, it is generalized to... Step prediction: ; S63. Calculate the predicted value of the Ridge trend regression prediction model. , The loss function is ; where regularization intensity ; S64. When gating online in future years, calculate the output divergence of the multi-model prediction ensemble. : std represents the standard deviation, and the threshold thr is determined by quantiles based on the historical divergence sequence; If in the year, dispersion < thr, then the year belongs to a normal segment, the first dynamic weight sensitivity coefficient η, the base value and the global weight of the normal segment are used for water consumption prediction, and the formula is used to calculate the first two-layer weight , so as to generate a fused prediction function for the normal segment, that is , wherein represents the total number of base models, represents the -th base model's prediction for the -th year, represents the fused prediction value of the normal segment; If the first If the dispersion in year ≥ thr, then the first... The year belongs to a changing segment, and the second dynamic weight sensitivity coefficient is used. Dynamic weight participation level and global weight of variable point segment Water consumption forecasting is performed using the formula. Calculate the second double-layer weights , This represents the global weight of the segment with variable year, i.e. ; Based on the most recent The annual error is calculated using an exponentially weighted dynamic weighting of the variable point segments, where... , This indicates the amplification factor for sensitivity at the point of change. , This represents the dynamic intervention increment at the variable point state; it generates the variable point segment fusion prediction function, i.e. , This represents the fusion prediction value for the variable point segment.
