A water consumption prediction method, a water consumption prediction model, a device, and a medium
Patent Information
- Application Number
- CN202610953391.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-29
- Publication Date
- 2026-11-03
AI Technical Summary
Existing water consumption forecasting schemes struggle to capture the long-term dependencies and nonlinear characteristics in water consumption time-series data, resulting in low forecast accuracy and an inability to adapt to differentiated business scenarios in water supply networks, such as real-time water supply scheduling and medium- to long-term water production planning.
A water consumption prediction model based on historical water consumption time series data is constructed. By using LSTM network and attention mechanism, context vectors are generated through encoder, attention module and decoder to realize multi-time scale prediction of water consumption, including short-term and medium-to-long-term demand.
It significantly improves the accuracy and robustness of water consumption forecasting, enabling it to meet the needs of refined scheduling and energy conservation and loss reduction in water supply networks, and providing more reliable data support.
Smart Images

Figure CN123031918A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the fields of smart water management and artificial intelligence technology, and in particular to a water consumption prediction method, water consumption prediction model, equipment and medium. Background Technology
[0002] The refined scheduling and energy conservation and loss reduction of water supply networks rely heavily on accurate prediction of regional water demand. Currently, the mainstream water consumption forecasting methods in the industry are divided into statistical regression methods and engineering experience methods. Among them, traditional statistical methods, represented by the ARIMA time series model, are the most widely used. However, traditional statistical models are difficult to capture the long-term dependencies and nonlinear characteristics in water consumption time series data. In addition, actual water consumption data superimposed multiple patterns such as daily, weekly, and seasonal cycles, resulting in low overall prediction accuracy of traditional methods. Summary of the Invention
[0003] This application provides a water consumption prediction method, water consumption prediction model, equipment, and medium to solve the problem of low prediction accuracy in existing water consumption prediction schemes.
[0004] The first aspect of this application provides a water consumption prediction method, comprising: acquiring water consumption time series data corresponding to a preset number of time steps; and using a pre-trained water consumption prediction model to determine the water consumption corresponding to the prediction time step based on the water consumption time series data; wherein the water consumption prediction model is trained based on historical water consumption time series data.
[0005] In some embodiments of this application, the water consumption prediction model is trained based on historical water consumption data corresponding to a preset historical time period. The steps include: acquiring the original water consumption time-series data of the target user within the historical time period and constructing a dataset based on it; wherein the dataset includes training samples and corresponding labels; the training samples are feature vectors composed of preset historical time steps and their corresponding water consumption within the historical time period; and the labels are the actual water consumption values corresponding to one or more prediction time steps after the preset historical time steps; constructing an initial water consumption prediction model, wherein the initial water consumption prediction model takes the dataset as input and outputs the predicted water consumption values corresponding to one or more prediction time steps after the preset historical time steps; and iteratively training the initial water consumption prediction model multiple times using the dataset until convergence to obtain the water consumption prediction model.
[0006] In some embodiments of this application, the initial water consumption prediction model includes: an encoder LSTM network module for encoding the feature vector to obtain the water consumption time series features; an attention module for calculating the dynamic weight of the prediction time step with respect to the historical time step, and weighting and summing the dynamic weight with the water consumption time series features to generate a context vector containing historical periodic features; and a decoder LSTM network module for obtaining the water consumption prediction value corresponding to the prediction time step based on the context vector.
[0007] In some embodiments of this application, the attention module is configured to obtain the dynamic weights in the following manner:
[0008] in, This represents the time-series feature of water consumption corresponding to the i-th historical time step. and These are the preset parameters of the attention module. This represents the dynamic weight of the t-th prediction time step relative to the ith historical time step.
[0009] In some embodiments of this application, the attention module is further configured to obtain the context vector in the following manner:
[0010] in, This represents the context vector corresponding to the t-th prediction time step. The number of historical time steps.
[0011] In some embodiments of this application, the step of using the dataset to iteratively train the initial water consumption prediction model until convergence includes: in each iteration of training, determining the loss function based on the actual water consumption value and the predicted water consumption value, and updating the parameters of the water consumption prediction model based on the loss function.
[0012] In some embodiments of this application, the training sample is a feature vector composed of three historical time steps in the historical time period and their corresponding water consumption, and the label is the actual water consumption value corresponding to one predicted time step after the three historical time steps; and / or the training sample is a feature vector composed of three historical time steps in the historical time period and their corresponding water consumption, and the label is the actual water consumption value corresponding to two predicted time steps after the three historical time steps.
[0013] A second aspect of this application provides a water consumption prediction model, comprising: an encoder LSTM network module for encoding water consumption time series data corresponding to a preset number of time steps to obtain water consumption time series features; an attention module for calculating the dynamic weights of the prediction time step for the preset number of time steps, and weighting and summing the dynamic weights with the water consumption time series features to generate a context vector containing historical periodic features; and a decoder LSTM network module for obtaining the predicted water consumption value corresponding to the prediction time step based on the context vector.
[0014] A third aspect of this application 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 steps of the water consumption prediction method described in any of the first aspects of the above embodiments.
[0015] A fourth aspect of this application provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the water consumption prediction method described in any of the first aspects of the above embodiments.
[0016] This application has the following beneficial effects: This application constructs a water consumption prediction model trained based on historical water consumption time series data. This model can effectively capture the long-term dependencies and nonlinear characteristics in water consumption data, and achieve more accurate time series pattern recognition and trend prediction of regional water demand, thereby significantly improving prediction accuracy and providing more reliable data support for the refined scheduling and energy conservation and loss reduction of water supply networks. Attached Figure Description
[0017] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with this application and, together with the specification, serve to explain the technical solutions of this application.
[0018] Figure 1 This is a flowchart illustrating an embodiment of the water consumption prediction method provided in this application; Figure 2 This is a schematic diagram of the framework of an embodiment of the initial water consumption prediction model provided in this application; Figure 3 This is a schematic diagram of the framework of an embodiment of the electronic device provided in this application; Figure 4 This is a schematic diagram of a framework of an embodiment of the computer-readable storage medium provided in this application. Detailed Implementation
[0019] In the following description, specific details such as particular system architectures, interfaces, and technologies are presented for illustrative purposes rather than for limiting purposes, in order to provide a thorough understanding of this application.
[0020] In this document, the term "and / or" is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " generally indicates that the preceding and following related objects have an "or" relationship. Furthermore, "many" in this document means two or more. Moreover, the term "at least one" in this document means any combination of at least two of any one or more of a plurality of objects. For example, including at least one of A, B, and C can mean including any one or more elements selected from the set consisting of A, B, and C.
[0021] As described in the background section, existing water consumption forecasting schemes suffer from low forecasting accuracy. To address this issue, this application proposes a water consumption forecasting method, such as... Figure 1 As shown, the method includes: acquiring water consumption time series data corresponding to a preset number of time steps; using a pre-trained water consumption prediction model based on the water consumption time series data to determine the water consumption corresponding to the prediction time step; wherein, the water consumption prediction model is trained based on historical water consumption time series data.
[0022] Therefore, the above embodiments construct a water consumption prediction model based on historical water consumption time series data. This model can effectively capture the long-term dependencies and nonlinear characteristics in water consumption data, and achieve more accurate time series pattern recognition and trend prediction of regional water demand, thereby significantly improving prediction accuracy and providing more reliable data support for the refined scheduling and energy conservation and loss reduction of water supply networks.
[0023] The inventors' research also found that existing forecasting methods are limited in function, only able to forecast water consumption at a single time scale, unable to distinguish between short-term and medium-term forecasting needs, and difficult to match differentiated business scenarios such as real-time water supply scheduling and medium- to long-term water production planning.
[0024] Therefore, in this embodiment, the water consumption prediction model is trained based on historical water consumption data corresponding to a preset historical time period. The steps include: acquiring the original water consumption time series data of the target user within the historical time period and constructing a dataset based on it. The dataset includes training samples and corresponding labels. The training samples are feature vectors composed of preset historical time steps and their corresponding water consumption within the historical time period. The labels are the actual water consumption values corresponding to one or more prediction time steps after the preset historical time steps. An initial water consumption prediction model is constructed, wherein the initial water consumption prediction model takes the dataset as input and outputs the predicted water consumption values corresponding to one or more prediction time steps after the preset historical time steps. The initial water consumption prediction model is iteratively trained multiple times using the dataset until convergence to obtain the water consumption prediction model.
[0025] Therefore, the above embodiments effectively solve the problems of existing prediction methods being limited in function and unable to adapt to differentiated business scenarios by constructing a dataset containing feature vectors at different time steps and corresponding prediction labels, and training an initial model capable of simultaneously outputting single-step or multi-step prediction values. This solution enables the trained water consumption prediction model to have flexible time-series prediction capabilities, meeting both short-term prediction needs to support real-time water supply scheduling and medium- to long-term multi-step predictions to match water production planning and other business operations. Thus, a single model achieves accurate water consumption prediction across multiple time scales, significantly improving the practicality and business adaptability of the prediction method.
[0026] In this embodiment, as Figure 2 As shown, the initial water consumption prediction model includes: an encoder LSTM network module, used to encode the feature vector to obtain the water consumption time series features; an attention module, used to calculate the dynamic weight of the prediction time step with respect to the historical time step, and to perform a weighted summation of the dynamic weight and the water consumption time series features to generate a context vector containing historical periodic features; and a decoder LSTM network module, used to obtain the water consumption prediction value corresponding to the prediction time step based on the context vector.
[0027] In this embodiment, the attention module is configured to obtain dynamic weights in the following manner:
[0028] in, This represents the time-series feature of water consumption corresponding to the i-th historical time step. and These are the preset parameters of the attention module. This represents the dynamic weight of the t-th prediction time step relative to the ith historical time step.
[0029] In this embodiment, the attention module is also configured to obtain the context vector in the following manner:
[0030] in, This represents the context vector corresponding to the t-th prediction time step. The number of historical time steps.
[0031] Therefore, the above embodiments effectively improve the model's ability to capture and predict complex water consumption patterns by constructing an initial prediction model composed of an encoder LSTM, an attention mechanism, and a decoder LSTM. The encoder LSTM can deeply extract temporal features from historical water consumption sequences, while the attention mechanism dynamically focuses on the historical key information most relevant to the prediction time and generates a context vector rich in periodic patterns. Finally, the decoder LSTM accurately generates the predicted value based on this context information. This architecture not only enhances the model's modeling of long-term dependencies and nonlinear features but also explicitly integrates multiple periodic patterns such as daily, weekly, and seasonal patterns through the attention mechanism, thereby significantly improving the accuracy and robustness of water consumption prediction at different time scales.
[0032] In this embodiment, the water consumption prediction model further includes a normalization module, which is configured to normalize the dynamic weights in the following manner:
[0033] Therefore, the above embodiments, by normalizing the dynamic weights, ensure that the sum of the weights at each historical time step is one, effectively avoiding the problems of model training instability or convergence difficulties caused by differences in the numerical scale of the weights. This processing enables the attention mechanism to allocate the importance of different historical moments to the current prediction more reasonably and smoothly, enhancing the model's ability to focus on key temporal features and its interpretability, thereby improving the accuracy and robustness of the prediction.
[0034] In this embodiment, step S2 includes: during each iteration of training, determining a loss function based on the actual water consumption and the predicted water consumption, and updating the parameters of the water consumption prediction model based on the loss function.
[0035] In this embodiment, the loss function is:
[0036] in, To predict the total number of time steps, This represents the actual water consumption value corresponding to the i-th prediction time step. This represents the predicted water consumption value corresponding to the i-th prediction time step.
[0037] Therefore, the above embodiments can accurately quantify the deviation between the model prediction results and the actual water consumption. When updating the water consumption prediction model parameters based on this loss function, it can effectively guide the model optimization direction, enabling the model to gradually narrow the gap between the predicted value and the actual value, thereby improving the accuracy and stability of water consumption prediction and providing reliable data support for subsequent water resource management, scheduling and other application scenarios.
[0038] In this embodiment, the training sample is a feature vector consisting of three historical time steps and their corresponding water consumption, and the label is the actual water consumption value corresponding to one predicted time step after the three historical time steps; and / or the training sample is a feature vector consisting of three historical time steps and their corresponding water consumption, and the label is the actual water consumption value corresponding to two predicted time steps after the three historical time steps. It should be noted that the training samples and labels in this application are not limited to the above embodiment. Specifically, other numbers of historical time steps and their corresponding water consumption feature vectors can be used as training samples, and other numbers of predicted time steps' actual water consumption values can be used as labels.
[0039] Therefore, the above embodiments, by flexibly constructing the correspondence between training samples and labels, use the water consumption feature vectors of historical time steps to predict the true water consumption values of one or more future time steps, and clearly demonstrate that this configuration is scalable (i.e., the number of historical time steps and prediction time steps can be adjusted according to actual needs). This design not only makes full use of the time series correlation of historical water consumption data to uncover potential patterns, but also endows the model with the ability to adapt to different prediction span scenarios. At the same time, the open sample construction method breaks the limitations of fixed parameters, enabling the model to flexibly adapt the input and output dimensions according to specific business needs (such as short-term precise scheduling or long-term trend prediction), thereby significantly improving the versatility, generalization ability, and application value of the water consumption prediction model in real complex scenarios.
[0040] Therefore, through the above embodiments, this application obtains a water consumption prediction model, including: an encoder LSTM network module, used to encode water consumption time series data corresponding to a preset number of time steps to obtain water consumption time series features; an attention module, used to calculate the dynamic weights of the prediction time step with respect to the preset number of time steps, and to perform a weighted summation of the dynamic weights and the water consumption time series features to generate a context vector containing historical periodic features; and a decoder LSTM network module, used to obtain the predicted water consumption value corresponding to the prediction time step based on the context vector.
[0041] Based on the above analysis, compared with existing water consumption prediction schemes, this application constructs a water consumption prediction model trained on historical water consumption time series data. This model can effectively capture the long-term dependencies and nonlinear characteristics in water consumption data, and achieve more accurate time series pattern recognition and trend prediction of regional water demand, thereby significantly improving prediction accuracy and providing more reliable data support for the refined scheduling and energy conservation and loss reduction of water supply networks.
[0042] Based on the inventive concept of the above embodiments, 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. When the processor executes the computer program, it implements the steps of the method described in the above embodiments. The following is in conjunction with... Figure 3 Please provide a detailed explanation.
[0043] like Figure 3 As shown, it illustrates the electronic device 100 of this application, which may specifically include a processor 110 and a memory 120. The memory 120 is coupled to the processor 110.
[0044] Processor 110 is used to control the operation of electronic devices. Processor 110 may also be referred to as a CPU (Central Processing Unit). Processor 110 may be an integrated circuit chip with signal processing capabilities. Processor 110 may also be a general-purpose processor, digital signal processor (DSP), application-specific integrated circuit (ASIC), field-programmable gate array (FPGA), or other programmable logic device, discrete gate or transistor logic device, or discrete hardware component. The general-purpose processor may be a microprocessor, or processor 110 may be any conventional processor.
[0045] The memory 120 is used to store computer programs and may be RAM, ROM, or other types of storage terminals. Specifically, the memory 120 may include one or more computer-readable storage media, which may be non-transitory or transient. The memory 120 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage terminals or flash memory terminals. In some embodiments, the non-transitory computer-readable storage media in the memory 120 is used to store at least one line of program code.
[0046] The processor 110 is used to execute computer programs stored in the memory 120 to implement the methods described in the various method embodiments of this application.
[0047] In some embodiments, the electronic device may further include a peripheral terminal interface 130 and at least one peripheral terminal. The processor 110, memory 120, and peripheral terminal interface 130 may be connected via a bus or signal line. Each peripheral terminal may be connected to the peripheral terminal interface 130 via a bus, signal line, or circuit board. Specifically, the peripheral terminal includes at least one of a radio frequency circuit 140, a display screen 150, an audio circuit 160, and a power supply 170.
[0048] The peripheral terminal interface 130 can be used to connect at least one I / O (Input / Output) related peripheral terminal to the processor 110 and the memory 120. In some embodiments, the processor 110, memory 120 and peripheral terminal interface 130 are integrated on the same chip or circuit board; in some other embodiments, any one or two of the processor 110, memory 120 and peripheral terminal interface 130 can be implemented on separate chips or circuit boards, which is not limited in this embodiment.
[0049] The radio frequency (RF) circuit 140 is used to receive and transmit RF (Radio Frequency) signals, also known as electromagnetic signals. The RF circuit 140 communicates with communication networks and other IoT devices via electromagnetic signals; it is the communication circuit of the electronic device. The RF circuit 140 converts electrical signals into electromagnetic signals for transmission, or converts received electromagnetic signals back into electrical signals. Optionally, the RF circuit 140 includes: an antenna system, an RF transceiver, one or more amplifiers, a tuner, an oscillator, a digital signal processor, a codec chipset, an operator identification module card, etc. The RF circuit 140 can communicate with other terminals through at least one wireless communication protocol. This wireless communication protocol includes, but is not limited to: the World Wide Web, metropolitan area networks, intranets, various generations of mobile communication networks (2G, 3G, 4G, and 5G), wireless local area networks, and / or WiFi (Wireless Fidelity) networks. In some embodiments, the RF circuit 140 may also include circuitry related to NFC (Near Field Communication), which is not limited in this application.
[0050] Display screen 150 is used to display a UI (User Interface). This UI may include graphics, text, icons, videos, and any combination thereof. When display screen 150 is a touch display screen, it also has the ability to collect touch signals on or above its surface. These touch signals can be input as control signals to processor 110 for processing. In this case, display screen 150 can also be used to provide virtual buttons and / or a virtual keyboard, also known as soft buttons and / or a soft keyboard. In some embodiments, there may be one display screen 150, located on the front panel of the electronic device; in other embodiments, there may be at least two display screens, located on different surfaces of the electronic device or in a folded design; in still other embodiments, display screen 150 may be a flexible display screen, located on a curved or folded surface of the electronic device. Furthermore, display screen 150 may be configured as a non-rectangular, irregular shape, i.e., a non-rectangular screen. Display screen 150 may be made of materials such as LCD (Liquid Crystal Display) or OLED (Organic Light-Emitting Diode).
[0051] The audio circuit 160 may include a microphone and a speaker. The microphone is used to collect sound waves from the operator and the environment, converting the sound waves into electrical signals that are input to the processor 110 for processing, or input to the radio frequency circuit 140 for voice communication. For stereo sound acquisition or noise reduction purposes, multiple microphones may be used, each positioned in a different part of the electronic device. The microphone may also be an array microphone or an omnidirectional microphone. The speaker is used to convert electrical signals from the processor 110 or the radio frequency circuit 140 into sound waves. The speaker may be a conventional film speaker or a piezoelectric ceramic speaker. When the speaker is a piezoelectric ceramic speaker, it can convert electrical signals not only into audible sound waves but also into inaudible sound waves for purposes such as distance measurement. In some embodiments, the audio circuit 160 may also include a headphone jack.
[0052] Power supply 170 is used to supply power to various components in an electronic device. Power supply 170 can be alternating current, direct current, a disposable battery, or a rechargeable battery. When power supply 170 includes a rechargeable battery, the rechargeable battery can be a wired rechargeable battery or a wireless rechargeable battery. A wired rechargeable battery is a battery that is charged via a wired line, while a wireless rechargeable battery is a battery that is charged via a wireless coil. The rechargeable battery can also be used to support fast charging technology.
[0053] For a detailed description of the functions and execution processes of each functional module or component in the electronic device embodiments of this application, please refer to the descriptions in the above-described method embodiments of this application, which will not be repeated here.
[0054] In the embodiments provided in this application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the embodiments of the electronic devices described above are merely illustrative. For instance, the division of modules or units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some data may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, devices, or units, and may be electrical, mechanical, or other forms.
[0055] 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 units can be selected to achieve the purpose of this embodiment, depending on actual needs.
[0056] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0057] Based on the inventive concept of the above embodiments, this application also provides a computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, performs the steps of the method described in any of the above embodiments. The following is in conjunction with... Figure 4 This describes the execution process of the above embodiments on a computer-readable storage medium.
[0058] like Figure 4As shown, it illustrates the computer-readable storage medium of this application. The integrated units described above, if implemented as software functional units and sold or used as independent products, can be stored in the computer-readable storage medium 200. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or 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 / computer programs to cause an Internet of Things device (which may be a personal computer, server, or network terminal, etc.) or processor to execute all or part of the steps of the methods of various embodiments of this application. The aforementioned storage medium includes various media such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks, as well as electronic terminals such as computers, mobile phones, laptops, tablets, and cameras that have the aforementioned storage media.
[0059] The execution process of program data in a computer-readable storage medium can be described with reference to the above-described method embodiments of this application, and will not be repeated here.
[0060] The above description is merely an embodiment of this application and does not limit the patent scope of this application. Any equivalent structural or procedural transformations made using the content of this application's specification and drawings, or direct or indirect applications in other related technical fields, are similarly included within the patent protection scope of this application.
[0061] Those skilled in the art will understand that, in the above-described method of the specific implementation, the order in which each step is written does not imply a strict execution order and does not constitute any limitation on the implementation process. The specific execution order of each step should be determined by its function and possible internal logic.
Claims
1. A method for predicting water consumption, characterized in that, include: Obtain water consumption time-series data corresponding to a preset number of time steps; The water consumption prediction model is used to determine the water consumption corresponding to the prediction time step based on the water consumption time series data; wherein the water consumption prediction model is trained based on historical water consumption time series data.
2. The water consumption prediction method according to claim 1, characterized in that, The steps involved in training the water consumption prediction model based on historical water consumption data corresponding to a preset historical time period include: Obtain the original water consumption time series data of the target user within a historical time period and construct a dataset based on it. The dataset includes training samples and corresponding labels. The training samples are feature vectors composed of a preset number of historical time steps in the historical time period and their corresponding water consumption. The labels are the actual water consumption values corresponding to one or more predicted time steps after the preset number of historical time steps. Construct an initial water consumption prediction model, wherein the initial water consumption prediction model takes the dataset as input and outputs the water consumption prediction value corresponding to one or more prediction time steps after the preset number of historical time steps; The initial water consumption prediction model is trained iteratively multiple times using the dataset until convergence, to obtain the water consumption prediction model.
3. The water consumption prediction method according to claim 2, characterized in that, The initial water consumption prediction model includes: An encoder LSTM network module is used to encode the feature vector to obtain the water consumption time series features; The attention module is used to calculate the dynamic weight of the predicted time step with respect to the historical time step, and to perform a weighted summation of the dynamic weight with the water consumption time series features to generate a context vector containing historical periodic features. The decoder LSTM network module is used to obtain the predicted water consumption value corresponding to the prediction time step based on the context vector.
4. The water consumption prediction method according to claim 3, characterized in that, The attention module is configured to obtain the dynamic weights in the following manner: in, This represents the time-series feature of water consumption corresponding to the i-th historical time step. and These are the preset parameters of the attention module. This represents the dynamic weight of the t-th prediction time step relative to the ith historical time step.
5. The water consumption prediction method according to claim 4, characterized in that, The attention module is also configured to obtain the context vector in the following manner: in, This represents the context vector corresponding to the t-th prediction time step. The number of historical time steps.
6. The water consumption prediction method according to claim 2, characterized in that, The step of iteratively training the initial water consumption prediction model using the dataset until convergence includes: During each iteration of training, the loss function is determined based on the actual water consumption and the predicted water consumption, and the parameters of the water consumption prediction model are updated based on the loss function.
7. The water consumption prediction method according to claim 2, characterized in that, The training sample is a feature vector consisting of three historical time steps and their corresponding water consumption in the historical time period, and the label is the actual water consumption value corresponding to the one predicted time step after the three historical time steps; and / or the training sample is a feature vector consisting of three historical time steps and their corresponding water consumption in the historical time period, and the label is the actual water consumption value corresponding to the two predicted time steps after the three historical time steps.
8. A water consumption prediction model, characterized in that, include: The encoder LSTM network module is used to encode the water consumption time series data corresponding to a preset number of time steps to obtain water consumption time series features; The attention module is used to calculate the dynamic weights corresponding to the preset number of time steps for the prediction time step, and to perform a weighted summation of the dynamic weights with the water consumption time series features to generate a context vector containing historical periodic features. The decoder LSTM network module is used to obtain the predicted water consumption value corresponding to the prediction time step based on the context vector.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the steps of the method as described in any one of claims 1-7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the steps of the method according to any one of claims 1-7.
