A water consumption prediction method and apparatus

By training an RLMamba model in the source region and transferring it to the target region, the problems of insufficient data and limited feature capture ability in short-term urban water consumption forecasting are solved, achieving high-precision water consumption forecasting and model adaptability.

CN122242856APending Publication Date: 2026-06-19HENAN CHUSHANDIAN RESERVOIR IRRIGATION DISTRICT ENGINEERING CO LTD +2

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
HENAN CHUSHANDIAN RESERVOIR IRRIGATION DISTRICT ENGINEERING CO LTD
Filing Date
2026-03-20
Publication Date
2026-06-19

AI Technical Summary

Technical Problem

Existing water consumption forecasting methods suffer from insufficient data and limited feature capture capabilities in short-term urban water consumption forecasting, making it difficult to model and predict, especially in areas where data is missing.

Method used

The RLMamba model is adopted. By training the model in a data-rich source region, the model learns the temporal dynamics and potential patterns of water use, and then transfers it to the target region for fine-tuning to adapt to the water use patterns and environmental characteristics of the target region, thereby achieving water consumption prediction.

Benefits of technology

It improves the prediction accuracy and generalization ability of the model in the target area, adapts to the dynamics of urban water systems, enhances the modeling ability for long-range dependent information, and has good scalability and cross-regional generalization performance.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN122242856A_ABST
    Figure CN122242856A_ABST
Patent Text Reader

Abstract

This application provides a water consumption prediction method and apparatus, relating to the field of water conservancy information technology. The method includes: collecting historical data from a source region and a target region; training an RLMamba model based on the historical data from the source region, using the RLMamba model to learn the temporal dynamics and potential patterns of water consumption in the source region, thus obtaining an RLMamba model for the source region; using the RLMamba model of the source region to predict water consumption in the source region; fine-tuning the RLMamba model of the source region based on historical data from the target region to adapt to the water consumption patterns and environmental characteristics of the target region, thus obtaining an RLMamba model for the target region; and predicting water consumption in the target region for future periods based on the RLMamba model of the target region. This method not only improves the accuracy and stability of short-term water consumption prediction in data-rich source regions but also has high computational efficiency and can achieve rapid modeling in data-scarce areas based on transfer learning strategies.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of water conservancy information technology, and in particular to a method and device for predicting water consumption. Background Technology

[0002] Urban water use forecasting is a core component of ensuring the stable operation of water supply systems and achieving the scientific allocation of water resources, playing a vital role in water resource management, scheduling optimization, and urban planning. With the accelerating pace of urbanization and intensifying climate change trends, urban water demand is exhibiting greater dynamism and complexity, posing numerous challenges to traditional forecasting methods.

[0003] Current water use forecasting methods mainly fall into three categories: statistical analysis methods, traditional machine learning methods, and deep learning methods. Statistical methods, such as Autoregressive Moving Average (ARIMA) and grey prediction models, possess good interpretability and periodic modeling capabilities, but struggle to handle water use changes under nonlinear and multivariate influences. Traditional machine learning methods, such as Support Vector Regression (SVR), Random Forest (RF), and Gradient Boosting Decision Tree (GBDT), excel at capturing nonlinear relationships, but they have significant limitations in modeling long-term temporal dependencies and data evolution trends. Deep learning methods, such as Artificial Neural Networks (ANN), Long Short-Term Memory Networks (LSTM), and Gated Recurrent Units (GRU), possess the ability to model complex temporal relationships and have demonstrated high prediction accuracy in numerous studies; however, their model structures are complex, their feature capture capabilities are weak, and they are highly dependent on feature selection and hyperparameter configuration.

[0004] Furthermore, water use forecasting typically involves multiple influencing factors, such as meteorological factors and holidays. These factors have cross-scale and nonlinear dependencies on water consumption, and existing methods suffer from insufficient information utilization when modeling these complex interactions. On the other hand, the environment in which urban water systems operate is highly dynamic; factors such as pipeline renovation, changes in user behavior, and extreme weather events constantly alter the system's operational patterns.

[0005] In summary, current research has two common problems: first, the current water consumption prediction models need to improve their feature extraction capabilities for multi-dimensional input data; second, due to the high dynamism of short-term water consumption / supply, some areas may frequently face data gaps, especially in the event of emergencies.

[0006] Therefore, there is an urgent need for a water consumption forecasting method to address the problems of insufficient data in certain areas leading to difficulty in modeling and the limited feature capture capability of forecasting models in short-term urban water consumption forecasting. Summary of the Invention

[0007] This application provides a water consumption forecasting method and apparatus to address the problems of insufficient data in certain areas leading to difficulty in modeling and limited feature capture capabilities of forecasting models in short-term urban water consumption forecasting. In a first aspect, this application provides a method for predicting water consumption, the method comprising: Collect historical data related to water consumption in the source and target areas; Based on historical data of the source region, the RLMamba model is trained, and the RLMamba model is used to learn the temporal dynamics and potential patterns of water use in the source region, thus obtaining the RLMamba model of the source region; the RLMamba model of the source region is used to predict the water consumption of the source region. The RLMamba model of the source region is fine-tuned based on historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, thus obtaining the RLMamba model of the target region. The RLMamba model based on the target area is used to predict water consumption in the target area in future periods.

[0008] Optionally, the step of training the RLMamba model based on historical data from the source region, and using the RLMamba model to learn the temporal dynamics and potential patterns of water use in the source region to obtain an RLMamba model for the source region, includes: Generate a time series corresponding to the historical data of the source region; The time dimension of the time series is compressed to a fixed embedding dimension through linear mapping to form a token representation; The token representation is iteratively calculated using multiple layers of RLMamba modules to extract the correlation features between time series and variables, and to obtain the auxiliary outputs of each layer of RLMamba modules; The residual output channels of the auxiliary outputs of each RLMamba module are aggregated and processed to obtain the predicted output of the RLMamba model. The training loss is determined based on the root mean square error between the predicted output and the true value of the RLMamba model, and the model parameters are optimized through backpropagation to complete the training of the RLMamba model.

[0009] Optionally, the token representation is iteratively computed using multiple layers of RLMamba modules to extract temporal and variable correlation features, obtaining auxiliary outputs from each layer of RLMamba modules, including: The Token representation is assigned as the initial hidden state matrix; The hidden state matrix of the previous layer RLMamba module is processed by the Mamba module to obtain the output of the current layer Mamba module; The output of the current layer Mamba module is regressed and normalized with the hidden state matrix of the previous layer to obtain the residual output of the current layer Mamba module. The residual output of the current layer Mamba module is processed by a feedforward neural network to obtain the feedforward layer output of the current layer; The hidden state matrix of the current layer is obtained based on the residual output of the current layer Mamba module and the feedforward output of the current layer; The output of the current layer's Mamba module is concatenated with the output of the current layer's feedforward layer, linearly mapped, and activated using sigmoid to obtain the auxiliary output of the current layer.

[0010] Optionally, the step of performing Mamba module calculations on the hidden state matrix of the previous-layer RLMamba module to obtain the output of the current-layer Mamba module includes: The hidden state matrix output from the previous layer is processed by a first branch and a second branch. The first branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it. The second branch includes linearly mapping the hidden state matrix output from the previous layer, then reactivating it through a convolutional layer, and then modeling it through selective state space. The processing results of the first branch and the second branch are merged to obtain the output of the current layer Mamba module.

[0011] Optionally, the RLMamba model of the source region is fine-tuned based on historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, resulting in an RLMamba model of the target region, including: The parameters of the RLMamba model in the source region are initialized to those in the target region, serving as the initial parameters of the RLMamba model in the target region. The historical data of the target region is divided into sliding window segments to construct the input sequence of the target region and its corresponding target value sequence. Based on the input sequence of the target region and its corresponding target value sequence, the RLMamba model of the source region is fine-tuned and trained to obtain the RLMamba model of the target region.

[0012] Optionally, the historical data includes: historical water supply and water use sequences, meteorological data, calendar attributes, and water use area type. The meteorological data includes at least one of the following: temperature, humidity, rainfall, and sunshine hours. The calendar attributes include at least one of the following: weekdays, holidays, and seasons.

[0013] Secondly, this application also provides a water consumption prediction device, the device comprising: The data acquisition module is used to collect historical data related to water consumption in the source and target areas. The source region model training module is used to train the RLMamba model based on historical data of the source region, and to learn the temporal dynamics and potential patterns of water use in the source region using the RLMamba model to obtain the RLMamba model of the source region; the RLMamba model of the source region is used to predict the water consumption of the source region. The target region model training module is used to fine-tune the RLMamba model of the source region based on the historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, so as to obtain the RLMamba model of the target region. The prediction module is used to predict water consumption in the target area for future periods based on the RLMamba model of the target area.

[0014] Optionally, the source region model training module is further configured to: Generate a time series corresponding to the historical data of the source region; The time dimension of the time series is compressed to a fixed embedding dimension through linear mapping to form a token representation; The token representation is iteratively calculated using multiple layers of RLMamba modules to extract the correlation features between time series and variables, and to obtain the auxiliary outputs of each layer of RLMamba modules; The residual output channels of the auxiliary outputs of each RLMamba module are aggregated and processed to obtain the predicted output of the RLMamba model. The training loss is determined based on the root mean square error between the predicted output and the true value of the RLMamba model, and the model parameters are optimized through backpropagation to complete the training of the RLMamba model.

[0015] Optionally, the source region model training module is further configured to: The token representation is iteratively computed using multiple layers of RLMamba modules to extract temporal and variable correlation features, obtaining auxiliary outputs from each layer of RLMamba modules, including: The Token representation is assigned as the initial hidden state matrix; The hidden state matrix of the previous layer RLMamba module is processed by the Mamba module to obtain the output of the current layer Mamba module; The output of the current layer Mamba module is regressed and normalized with the hidden state matrix of the previous layer to obtain the residual output of the current layer Mamba module. The residual output of the current layer Mamba module is processed by a feedforward neural network to obtain the feedforward layer output of the current layer; The hidden state matrix of the current layer is obtained based on the residual output of the current layer Mamba module and the feedforward output of the current layer; The output of the current layer's Mamba module is concatenated with the output of the current layer's feedforward layer, linearly mapped, and activated using sigmoid to obtain the auxiliary output of the current layer.

[0016] Optionally, the source region model training module is further configured to: The hidden state matrix output from the previous layer is processed by a first branch and a second branch. The first branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it. The second branch includes linearly mapping the hidden state matrix output from the previous layer, then reactivating it through a convolutional layer, and then modeling it through selective state space. The processing results of the first branch and the second branch are merged to obtain the output of the current layer Mamba module.

[0017] Optionally, the target region model training module is also used for: The parameters of the RLMamba model in the source region are initialized to those in the target region, serving as the initial parameters of the RLMamba model in the target region. The historical data of the target region is divided into sliding window segments to construct the input sequence of the target region and its corresponding target value sequence. Based on the input sequence of the target region and its corresponding target value sequence, the RLMamba model of the source region is fine-tuned and trained to obtain the RLMamba model of the target region.

[0018] Optionally, the historical data includes: historical water supply and water use sequences, meteorological data, calendar attributes, and water use area type. The meteorological data includes at least one of the following: temperature, humidity, rainfall, and sunshine hours. The calendar attributes include at least one of the following: weekdays, holidays, and seasons.

[0019] Thirdly, this application also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the water consumption prediction method as described above.

[0020] Fourthly, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the water consumption prediction method as described above.

[0021] Fifthly, this application also provides a computer program product, including a computer program that, when executed by a processor, implements the water consumption prediction method as described above. Attached Figure Description

[0022] To more clearly illustrate the technical solutions in this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0023] Figure 1 A flowchart illustrating a water consumption prediction method provided in this application embodiment. Figure 1 ; Figure 2 This is a schematic diagram of the structure of an RLMamba model provided in an embodiment of this application; Figure 3 This is a schematic diagram of the structure of a water consumption prediction device provided in an embodiment of this application; Figure 4 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation

[0024] To make the objectives, technical solutions, and advantages of this application clearer, the application will be further described in detail below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments in this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0025] All actions involving the acquisition of signal information or data in this application are carried out in accordance with the relevant data protection laws and policies of the country where the application is located, and with the authorization granted by the owner of the relevant device.

[0026] In the embodiments of this application, "multiple" refers to two or more. Terms such as "first" and "second" are used only for descriptive purposes and should not be construed as indicating or implying relative importance or order.

[0027] Figure 1 This is a flowchart illustrating a water consumption prediction method provided in an embodiment of this application, as shown below. Figure 1 As shown, it includes the following steps: Step S1: Collect historical data related to water consumption in the source and target areas.

[0028] To address key drivers in short-term water use forecasting, data was collected from source and target regions, including historical water supply and usage sequences, meteorological data (such as temperature, humidity, rainfall, and sunshine hours), calendar attributes (such as weekdays, holidays, and seasons), and water use area types. Through time alignment, missing data imputation, feature encoding, and normalization, a unified and time-series-complete input feature matrix was constructed, providing a reliable data foundation for subsequent models to accurately predict future water consumption and for transfer learning.

[0029] In this embodiment, S1 includes the following steps: S101, Data Acquisition: First, select source areas with complete data records and relatively stable water usage behavior, and target areas with limited data but clear prediction tasks. It is important to note that the two types of areas should be geographically adjacent to each other as much as possible to ensure the effectiveness of subsequent steps. Based on this, acquire historical data and external driving data of the water supply system from both types of areas. The data content includes historical water supply and usage data; combined with meteorological data, including temperature, humidity, precipitation, and sunshine hours, and incorporating time attributes such as holidays, weekdays, and special events (such as water outages). In addition, background variables such as water usage area type should be considered as much as possible (preferably area area). All data must have a unified time resolution (preferably hourly scale), labeled areas, and a basic dataset constructed to facilitate subsequent alignment and modeling.

[0030] S102, Data Preprocessing, ensuring the integrity and consistency of the input samples. The method for imputing missing values ​​should be selected based on the characteristics of the variables and their spatiotemporal structure. For example, linear interpolation or moving averages can be used for continuous time series, while spatial interpolation can be performed by referring to historical statistical characteristics of neighboring regions for meteorological variables. In this embodiment, inverse distance weighted interpolation is preferred as the spatial interpolation method. In this embodiment, discontinuous data is converted into continuous time series data through encoding techniques. All features should be of uniform dimensions; this embodiment reduces scale differences through standardization (standardization is performed separately for the source and target regions). The processed data is organized into a time series input matrix with a time step sequence structure, containing multivariate features. The target variable is future water consumption, and the remaining features are used as model inputs to support subsequent training and transfer tasks.

[0031] Step S2: Based on historical data of the source region, train the RLMamba model, and use the RLMamba model to learn the temporal dynamics and potential patterns of water use in the source region to obtain the RLMamba model of the source region.

[0032] The RLMamba model for the source region is used to predict the water consumption of the source region. Figure 2This is a schematic diagram of the structure of an RLMamba model provided in an embodiment of this application. The source region RLMamba model is trained by selecting a region with relatively complete and representative data as the source region, and using multidimensional time-series data from this region to train an RLMamba network based on state-space modeling. By fully learning the temporal dynamics and potential patterns of water use in this region, short-term water consumption in the source region is predicted.

[0033] In this embodiment, S2 includes the following steps: S201, Generate the time series corresponding to the historical data of the source region.

[0034] The input sequence is generated using the sliding window method. The input historical multivariate time series data is denoted as: in, Indicates batch size, Indicates the number of time steps in historical observations. Indicates the dimension of the variable (e.g., in S101, ), Indicates the first In the nth sample, the nth The time step, the first The observed values ​​of each variable. First, the data is transposed to obtain a time series arranged by variable: The purpose of transposing here is to facilitate subsequent feature extraction based on variable dimensions.

[0035] S202, the time dimension of the time series is compressed to a fixed embedded dimension through linear mapping to form a token representation.

[0036] Time-dimensional embedding compresses the time dimension to a fixed embedding dimension through a linear mapping. This forms a token representation: in, Indicates the token embedding dimension. This is a fully connected layer whose function is to map the time series data of each variable into a fixed-dimensional vector. The purpose of this step is to map the original time series data into a high-dimensional vector that is easier for neural networks to process, thus capturing the complex temporal features of the variables.

[0037] S203, perform iterative calculations on the Token representation using multi-layer RLMamba modules to extract the correlation features between time series and variables, and obtain the auxiliary outputs of each layer of RLMamba modules.

[0038] RLMamba block iterative computation, for Sequence The RLMamba block is iterated layer by layer, with each layer used to further extract time-series and variable-related features. For network depth.

[0039] Specifically, S203 includes the following steps: S2031, the Token representation is assigned as the initial hidden state matrix.

[0040] Hidden state initialization: Assign the input token sequence to the level 0 hidden state: in, This represents the hidden state matrix of layer 0, containing the embedding features of all samples and variables; similarly, in the following text... Indicates the first The hidden state matrix of the layer, Indicates the current layer being processed.

[0041] S2032, perform Mamba module calculations on the hidden state matrix of the previous layer RLMamba module to obtain the output of the current layer Mamba module.

[0042] The hidden state matrix output from the previous layer is processed by a first branch and a second branch. The first branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it. The second branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it again through a convolutional layer. The processing results of the first branch and the second branch are fused together to obtain the hidden state matrix output by the current layer.

[0043] The Mamba module is designed to capture dynamic relationships between variables. It handles input hidden states. Perform two path transformations, the first branch being a linear mapping and activation, as shown below: in, It is a non-linear activation function.

[0044] The second branch involves linear mapping followed by convolutional layer activation, as shown below: Then, further processing is performed using the selective state-space model module: The two branches are merged (element-wise multiplication), and then the output of the Mamba module is obtained through a linear mapping: in, For element-wise multiplication, It is the first The output of the layer Mamba module represents the temporal characteristics between variables captured after complex transformations.

[0045] S2033: Perform residual concatenation and normalization on the output of the current layer Mamba module and the hidden state matrix of the previous layer to obtain the residual output of the current layer Mamba module.

[0046] Residual connections and normalization introduce residual structures to avoid gradient vanishing and improve training stability. First, [the following is done]... Random inactivation, then back to hidden state Subtract, then normalize: in, It is the first The residual output of the layer Mamba module reflects the differences between the input and the transformed data.

[0047] S2034, perform feedforward neural network processing on the residual output of the current layer Mamba module to obtain the feedforward layer output of the current layer.

[0048] Feedforward layer transformation, performing feedforward neural network processing on the residual output. in, It is the output of the feedforward layer, used to capture deeper temporal nonlinear features.

[0049] S2035, the hidden state matrix of the current layer is obtained based on the residual output of the current layer Mamba module and the feedforward layer output of the current layer; Gated residual hidden state update: The difference between the residual input and the feedforward output is used to generate a new hidden state through a gating mechanism. in, It is the sigmoid activation function. It is the first The updated hidden state of the layer serves as the input for the next iteration.

[0050] S2036: The output of the current layer's Mamba module is concatenated with the feedforward layer output of the current layer, linearly mapped, and activated by sigmoid to obtain the auxiliary output of the current layer.

[0051] Auxiliary output calculation, outputting the Mamba module. With feedforward layer output Concatenate along the feature dimension: After passing through a fully connected layer and a sigmoid activation function, the auxiliary output is obtained: in, For the first Layer auxiliary output, dimension This can be viewed as a prediction dimension or a feature compression dimension. The auxiliary output will be used in the residual output channel for differential aggregation of prediction results.

[0052] S204 aggregates and processes the residual output channels of the auxiliary outputs of each layer of RLMamba modules to obtain the RLMamba model prediction output.

[0053] Residual output channel aggregation prediction, in Iterative computation on blocks.

[0054] Specifically, S204 includes the following steps: S2041, set the initial residual as a zero matrix.

[0055] Residual output initialization: Define the initial residual output as a zero matrix. S2042, calculate the difference between the auxiliary output of the current layer and the auxiliary output of the previous layer.

[0056] Inter-layer output difference calculation: For each auxiliary output layer, calculate the difference between the current layer and the previous layer. This process is performed iteratively on all blocks, through... After iteration, we obtain Differential aggregation reduces prediction variance, which helps improve the model's generalization ability.

[0057] S2043 performs linear mapping on the iterated auxiliary output, projecting it onto the target dimension to obtain the auxiliary output in the target dimension.

[0058] Linear mapping adjusts the output dimension, which has undergone... Auxiliary output after the next iteration Its time dimension Not equal to the number of prediction time steps (Preferred) ), using a linear mapping to project the output onto the target dimension: S2044 performs a transpose and fully connected transformation on the auxiliary output of the target dimension to obtain the prediction output of the RLMamba model.

[0059] The final output is transposed, transforming the last layer's output into a commonly used format with the second dimension as the time step, and then outputting it through a fully connected layer. in, This is the final output of the model.

[0060] S205. Based on the root mean square error between the predicted output and the true value of the RLMamba model, determine the training loss and optimize the model parameters through backpropagation to complete the training of the RLMamba model.

[0061] The model is trained using the root mean square error (RMSE) as the training loss function to calculate the difference between the predicted and actual values. Error between: Optimize model parameters through backpropagation The model is trained by minimizing the loss function.

[0062] Step S3: Fine-tune the RLMamba model of the source region based on historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, and obtain the RLMamba model of the target region.

[0063] Specifically, the RLMamba model for the target region predicts water consumption in the target region for future periods. The model is then transferred to the target region by migrating the trained RLMamba model parameters from the source region to a neighboring target region where data is relatively scarce. The model is then fine-tuned using limited historical data from the target region to adapt to the water consumption patterns and environmental characteristics of the target region, thereby predicting water consumption in the target region for future periods.

[0064] In this embodiment, S3 includes the following steps: S301 initializes the parameters of the RLMamba model in the source region to the target region, using them as the initial parameters of the RLMamba model in the target region.

[0065] Parameter transfer initialization involves transferring the parameters of the RLMamba model trained in the source region. Initialize to the target region model, as the initial parameters of the target region model: in, This represents the model parameters obtained by training on the source region. These are the initial parameters for the target region model. This step represents the first step in knowledge transfer, namely, transferring the water dynamics learned from the source region to the target region.

[0066] S302, Perform sliding window partitioning on the historical data of the target region to construct the input sequence of the target region and its corresponding target value sequence.

[0067] Data preparation for the target area involves dividing the original water use time series of the target area into sliding window segments to construct the input series. Simultaneously construct the corresponding target value sequence ;in, This represents the number of samples in the target region. The preferred time step for prediction ).

[0068] S303, based on the input sequence of the target region and its corresponding target value sequence, fine-tunes the RLMamba model of the source region to obtain the RLMamba model of the target region.

[0069] Fine-tuning, building upon S302, uses a limited set of historical samples from the target region to fine-tune the model. Depending on the task requirements, strategies such as "freezing the bottom layer and updating only the top layer" or "full-layer fine-tuning" can be employed to update parameters with a small learning rate, adapting to local water usage patterns and environmental characteristics. The optimization objectives during training are as follows: in, Indicates the target region number The measured values ​​of each input sample. In this embodiment, the preferred strategy is "freeze the bottom layer and fine-tune the top layer only", which means only fine-tuning the parameters of the fully connected layers in S2043 and S2044, while freezing the parameters of the remaining layers (the gradient is always 0, and training is impossible), as shown below: in, These are the parameters of the fully connected layers in S2043 and S2044; For other parameters. Then, the parameters are optimized and updated based on the gradient: in, For optimizer; The learning rate is preferably one-tenth of the source model's rate.

[0070] S4, based on the RLMamba model of the target area, predicts the water consumption of the target area in future periods.

[0071] Future prediction of the target region, using the test set of the target region. Input the finely tuned RLMamba model to generate water usage forecasts for the next 24 steps. : in The number of samples during the test period in the target region is the threshold. This step enables knowledge transfer and adaptation of the model from the source region to the target region, which can improve prediction accuracy when data in the target region is relatively scarce.

[0072] This invention provides a water consumption forecasting method aimed at addressing the challenges of weak feature capture capabilities and insufficient target area data in existing urban short-term water consumption forecasting models, leading to modeling difficulties and inadequate generalization. The method first selects a data-rich source region and trains a state-space model-based RLMamba time-series forecasting model by constructing a multi-dimensional feature sequence that integrates historical water consumption data, meteorological information, and temporal attributes. This allows for in-depth analysis of the multi-scale dynamic patterns and time-dependent structures inherent in the feature sequence. The RLMamba model integrates linear state-space representation with gated dynamic path modeling capabilities, effectively representing the multi-scale periodicity, abrupt changes, and externally driven nonlinear characteristics of urban water consumption. Through parallel convolutional state update structures, the model enhances its ability to model long-range dependencies while maintaining computational efficiency, exhibiting good scalability and cross-regional generalization performance. Subsequently, this invention employs a parameter migration strategy to transfer the RLMamba model trained in the source region to a nearby but data-scarce target region. Combining this with the limited historical data in the target region, a fine-tuning mechanism enables the model to quickly adapt and accurately predict in the new region. This invention balances model accuracy, generalization ability, and computational efficiency in urban water use forecasting tasks, making it suitable for large-scale deployment and real-time decision support. It has practical value and potential for widespread adoption.

[0073] The following describes a water consumption prediction device provided by the present invention. The water consumption prediction device described below can be referred to in correspondence with the water consumption prediction method described above.

[0074] Figure 3 This is a schematic diagram of the structure of a water consumption prediction device provided in an embodiment of this application, as shown below. Figure 3 As shown, the device 300 includes: Data acquisition module 310 is used for historical data related to water consumption; The source region model training module 320 is used to train the RLMamba model based on historical data of the source region, and to learn the temporal dynamics and potential patterns of water use in the source region using the RLMamba model to obtain the RLMamba model of the source region; the RLMamba model of the source region is used to predict the water consumption of the source region. The target region model training module 330 is used to fine-tune the RLMamba model of the source region based on the historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, so as to obtain the RLMamba model of the target region. The prediction module 340 is used to predict the water consumption of the target area in future periods based on the RLMamba model of the target area.

[0075] Optionally, the source region model training module 320 is further configured to: Generate a time series corresponding to the historical data of the source region; The time dimension of the time series is compressed to a fixed embedding dimension through linear mapping to form a token representation; The token representation is iteratively calculated using multiple layers of RLMamba modules to extract the correlation features between time series and variables, and to obtain the auxiliary outputs of each layer of RLMamba modules; The residual output channels of the auxiliary outputs of each RLMamba module are aggregated and processed to obtain the predicted output of the RLMamba model. The training loss is determined based on the root mean square error between the predicted output and the true value of the RLMamba model, and the model parameters are optimized through backpropagation to complete the training of the RLMamba model.

[0076] Optionally, the source region model training module 320 is further configured to: The token representation is iteratively computed using multiple layers of RLMamba modules to extract temporal and variable correlation features, obtaining auxiliary outputs from each layer of RLMamba modules, including: The Token representation is assigned as the initial hidden state matrix; The hidden state matrix of the previous layer RLMamba module is processed by the Mamba module to obtain the output of the current layer Mamba module; The output of the current layer Mamba module is regressed and normalized with the hidden state matrix of the previous layer to obtain the residual output of the current layer Mamba module. The residual output of the current layer Mamba module is processed by a feedforward neural network to obtain the feedforward layer output of the current layer; The hidden state matrix of the current layer is obtained based on the residual output of the current layer Mamba module and the feedforward output of the current layer; The output of the current layer's Mamba module is concatenated with the output of the current layer's feedforward layer, linearly mapped, and activated using sigmoid to obtain the auxiliary output of the current layer.

[0077] Optionally, the source region model training module 320 is further configured to: The hidden state matrix output from the previous layer is processed by a first branch and a second branch. The first branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it. The second branch includes linearly mapping the hidden state matrix output from the previous layer, then reactivating it through a convolutional layer, and then modeling it through selective state space. The processing results of the first branch and the second branch are merged to obtain the output of the current layer Mamba module.

[0078] Optionally, the target region model training module 330 is also used for: The parameters of the RLMamba model in the source region are initialized to those in the target region, serving as the initial parameters of the RLMamba model in the target region. The historical data of the target region is divided into sliding window segments to construct the input sequence of the target region and its corresponding target value sequence. Based on the input sequence of the target region and its corresponding target value sequence, the RLMamba model of the source region is fine-tuned and trained to obtain the RLMamba model of the target region.

[0079] Optionally, the historical data includes: historical water supply and water use sequences, meteorological data, calendar attributes, and water use area type. The meteorological data includes at least one of the following: temperature, humidity, rainfall, and sunshine hours. The calendar attributes include at least one of the following: weekdays, holidays, and seasons.

[0080] It should be noted that the water consumption prediction device provided in this application embodiment can implement all the method steps implemented in the above-mentioned water consumption prediction method embodiment and can achieve the same technical effect. Here, the parts that are the same as those in the method embodiment and the beneficial effects will not be described in detail.

[0081] Figure 4 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 4 As shown, the electronic device may include a processor 410, a communications interface 420, a memory 430, and a communication bus 440. The processor 410, communications interface 420, and memory 430 communicate with each other via the communication bus 440. The processor 410 can call logical instructions in the memory 430 to execute a water consumption prediction method.

[0082] Furthermore, the logical instructions in the aforementioned memory 430 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0083] On the other hand, this application also provides a computer program product, which includes a computer program that can be stored on a non-transitory computer-readable storage medium. When the computer program is executed by a processor, the computer is able to execute the water consumption prediction methods provided by the above methods.

[0084] In another aspect, this application also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the water consumption prediction methods provided by the above methods.

[0085] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.

[0086] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.

[0087] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of this application, and are not intended to limit them. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application.

Claims

1. A water amount prediction method characterized by comprising: The method includes: Collect historical data from the source and target regions; Based on historical data of the source region, the RLMamba model is trained, and the RLMamba model is used to learn the temporal dynamics and potential patterns of water use in the source region, thus obtaining the RLMamba model of the source region; the RLMamba model of the source region is used to predict the water consumption of the source region. The RLMamba model of the source region is fine-tuned based on historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, thus obtaining the RLMamba model of the target region. The RLMamba model based on the target area is used to predict water consumption in the target area in future periods.

2. The water consumption prediction method according to claim 1, characterized in that, The RLMamba model is trained based on historical data from the source region. This RLMamba model is then used to learn the temporal dynamics and potential patterns of water use in the source region, resulting in an RLMamba model for the source region, including: Generate a time series corresponding to the historical data of the source region; The time dimension of the time series is compressed to a fixed embedding dimension through linear mapping to form a token representation; The token representation is iteratively calculated using multiple layers of RLMamba modules to extract the correlation features between time series and variables, and to obtain the auxiliary outputs of each layer of RLMamba modules; The residual output channels of the auxiliary outputs of each RLMamba module are aggregated and processed to obtain the predicted output of the RLMamba model. The training loss is determined based on the root mean square error between the predicted output and the true value of the RLMamba model, and the model parameters are optimized through backpropagation to complete the training of the RLMamba model.

3. The water consumption prediction method according to claim 2, characterized in that, The token representation is iteratively computed using multiple layers of RLMamba modules to extract temporal and variable correlation features, obtaining auxiliary outputs from each layer of RLMamba modules, including: The Token representation is assigned as the initial hidden state matrix; The hidden state matrix of the previous layer RLMamba module is processed by the Mamba module to obtain the output of the current layer Mamba module; The output of the current layer Mamba module is regressed and normalized with the hidden state matrix of the previous layer to obtain the residual output of the current layer Mamba module. The residual output of the current layer Mamba module is processed by a feedforward neural network to obtain the feedforward layer output of the current layer; The hidden state matrix of the current layer is obtained based on the residual output of the current layer Mamba module and the feedforward output of the current layer; The output of the current layer's Mamba module is concatenated with the output of the current layer's feedforward layer, linearly mapped, and activated using sigmoid to obtain the auxiliary output of the current layer.

4. The water consumption prediction method according to claim 3, characterized in that, The step of performing Mamba module calculations on the hidden state matrix of the upper-layer RLMamba module to obtain the output of the current-layer Mamba module includes: The hidden state matrix output from the previous layer is processed by a first branch and a second branch. The first branch includes linearly mapping the hidden state matrix output from the previous layer and then activating it. The second branch includes linearly mapping the hidden state matrix output from the previous layer, then reactivating it through a convolutional layer, and then modeling it through selective state space. The processing results of the first branch and the second branch are merged to obtain the output of the current layer Mamba module.

5. The water consumption prediction method according to claim 1, characterized in that, The RLMamba model of the source region is fine-tuned based on historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, resulting in the RLMamba model of the target region, including: The parameters of the RLMamba model in the source region are initialized to those in the target region, serving as the initial parameters of the RLMamba model in the target region. The historical data of the target region is divided into sliding window segments to construct the input sequence of the target region and its corresponding target value sequence. Based on the input sequence of the target region and its corresponding target value sequence, the RLMamba model of the source region is fine-tuned and trained to obtain the RLMamba model of the target region.

6. The water consumption prediction method according to claim 1, characterized by, The historical data includes: historical water supply and water use sequences, meteorological data, calendar attributes, and water use area types. The meteorological data includes at least one of the following: temperature, humidity, rainfall, and sunshine hours. The calendar attributes include at least one of the following: weekdays, holidays, and seasons.

7. A water amount prediction device characterized by comprising: The device includes: The data acquisition module is used to collect historical data related to water consumption in the source and target areas. The source region model training module is used to train the RLMamba model based on historical data of the source region, and to learn the temporal dynamics and potential patterns of water use in the source region using the RLMamba model to obtain the RLMamba model of the source region; the RLMamba model of the source region is used to predict the water consumption of the source region. The target region model training module is used to fine-tune the RLMamba model of the source region based on the historical data of the target region to adapt to the water use patterns and environmental characteristics of the target region, so as to obtain the RLMamba model of the target region. The prediction module is used to predict water consumption in the target area for future periods based on the RLMamba model of the target area.

8. An electronic device comprising a memory, a processor, and a computer program stored on the memory and running on the processor, characterized in that, When the processor executes the computer program, it implements the water consumption prediction method as described in any one of claims 1 to 6. 9.A non-transitory computer-readable storage medium having stored thereon a computer program, characterized in that, When the computer program is executed by the processor, it implements the water consumption prediction method as described in any one of claims 1 to 6.

10. A computer program product comprising a computer program, characterized in that, When the computer program is executed by the processor, it implements the water consumption prediction method as described in any one of claims 1 to 6.