CN116703003A - Prediction method for residential water consumption - Google Patents
Prediction method for residential water consumption Download PDFInfo
- Publication number
- CN116703003A CN116703003A CN202310783082.0A CN202310783082A CN116703003A CN 116703003 A CN116703003 A CN 116703003A CN 202310783082 A CN202310783082 A CN 202310783082A CN 116703003 A CN116703003 A CN 116703003A
- Authority
- CN
- China
- Prior art keywords
- frequency
- water consumption
- data
- subsequence
- signal
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Pending
Links
- XLYOFNOQVPJJNP-UHFFFAOYSA-N water Substances O XLYOFNOQVPJJNP-UHFFFAOYSA-N 0.000 title claims abstract description 81
- 238000000034 method Methods 0.000 title claims abstract description 41
- 230000002159 abnormal effect Effects 0.000 claims abstract description 8
- 238000000354 decomposition reaction Methods 0.000 claims abstract description 8
- 238000004140 cleaning Methods 0.000 claims abstract description 4
- 230000007246 mechanism Effects 0.000 claims description 23
- 239000013598 vector Substances 0.000 claims description 16
- 238000010606 normalization Methods 0.000 claims description 15
- 238000013528 artificial neural network Methods 0.000 claims description 12
- 239000011159 matrix material Substances 0.000 claims description 9
- 101100460203 Schizosaccharomyces pombe (strain 972 / ATCC 24843) new2 gene Proteins 0.000 claims description 6
- 101100273916 Schizosaccharomyces pombe (strain 972 / ATCC 24843) wip1 gene Proteins 0.000 claims description 6
- 238000012353 t test Methods 0.000 claims description 6
- 238000001914 filtration Methods 0.000 claims description 5
- 108010076504 Protein Sorting Signals Proteins 0.000 claims description 3
- 230000006870 function Effects 0.000 claims description 3
- 230000000873 masking effect Effects 0.000 claims description 3
- 238000012360 testing method Methods 0.000 claims description 3
- 241000287196 Asthenes Species 0.000 claims description 2
- 230000008569 process Effects 0.000 claims description 2
- 125000004122 cyclic group Chemical group 0.000 description 3
- 238000000692 Student's t-test Methods 0.000 description 2
- 238000010276 construction Methods 0.000 description 2
- 230000007547 defect Effects 0.000 description 2
- 238000010801 machine learning Methods 0.000 description 2
- 230000000630 rising effect Effects 0.000 description 2
- OKTJSMMVPCPJKN-UHFFFAOYSA-N Carbon Chemical compound [C] OKTJSMMVPCPJKN-UHFFFAOYSA-N 0.000 description 1
- 230000009286 beneficial effect Effects 0.000 description 1
- 238000004364 calculation method Methods 0.000 description 1
- 229910052799 carbon Inorganic materials 0.000 description 1
- 238000010586 diagram Methods 0.000 description 1
- 230000000694 effects Effects 0.000 description 1
- 238000004134 energy conservation Methods 0.000 description 1
- 238000005265 energy consumption Methods 0.000 description 1
- 230000007774 longterm Effects 0.000 description 1
- 238000005086 pumping Methods 0.000 description 1
- 230000009467 reduction Effects 0.000 description 1
- 230000008439 repair process Effects 0.000 description 1
- 238000006467 substitution reaction Methods 0.000 description 1
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/04—Forecasting or optimisation specially adapted for administrative or management purposes, e.g. linear programming or "cutting stock problem"
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/045—Combinations of networks
- G06N3/0455—Auto-encoder networks; Encoder-decoder networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/04—Architecture, e.g. interconnection topology
- G06N3/0499—Feedforward networks
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06N—COMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
- G06N3/00—Computing arrangements based on biological models
- G06N3/02—Neural networks
- G06N3/08—Learning methods
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q10/00—Administration; Management
- G06Q10/06—Resources, workflows, human or project management; Enterprise or organisation planning; Enterprise or organisation modelling
- G06Q10/063—Operations research, analysis or management
- G06Q10/0639—Performance analysis of employees; Performance analysis of enterprise or organisation operations
- G06Q10/06393—Score-carding, benchmarking or key performance indicator [KPI] analysis
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06Q—INFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
- G06Q50/00—Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
- G06Q50/06—Energy or water supply
Landscapes
- Engineering & Computer Science (AREA)
- Business, Economics & Management (AREA)
- Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Human Resources & Organizations (AREA)
- Economics (AREA)
- General Physics & Mathematics (AREA)
- Strategic Management (AREA)
- Health & Medical Sciences (AREA)
- General Health & Medical Sciences (AREA)
- Biomedical Technology (AREA)
- Artificial Intelligence (AREA)
- Software Systems (AREA)
- General Business, Economics & Management (AREA)
- Mathematical Physics (AREA)
- Marketing (AREA)
- General Engineering & Computer Science (AREA)
- Entrepreneurship & Innovation (AREA)
- Computing Systems (AREA)
- Molecular Biology (AREA)
- Evolutionary Computation (AREA)
- Data Mining & Analysis (AREA)
- Life Sciences & Earth Sciences (AREA)
- Tourism & Hospitality (AREA)
- Development Economics (AREA)
- Biophysics (AREA)
- Computational Linguistics (AREA)
- Game Theory and Decision Science (AREA)
- Educational Administration (AREA)
- Operations Research (AREA)
- Quality & Reliability (AREA)
- Primary Health Care (AREA)
- Water Supply & Treatment (AREA)
- Public Health (AREA)
- Management, Administration, Business Operations System, And Electronic Commerce (AREA)
Abstract
The invention discloses a prediction method of residential water consumption, which comprises the following steps: s1, acquiring water consumption data of a research area in a research period through an intelligent water meter; s2, cleaning the data by adopting a Z-Score method, and removing and repairing abnormal values in the original data; s3, decomposing resident water consumption data into a plurality of subsequences with high frequency from high to low frequency through empirical mode decomposition of a time-varying filter; s4, dividing the subsequence into a high-frequency subsequence and a low-frequency subsequence according to the frequency, and reconstructing water consumption data into the high-frequency subsequence and the low-frequency subsequence; s5, respectively predicting the subsequences by using a transducer model; and S6, superposing the predicted values of the subsequences to obtain predicted water consumption of residents. According to the invention, the TVF-EMD is adopted to decompose the original data, so that the nonlinearity and the non-stationarity of the data are improved, and the prediction is easier; the transducer model increases the prediction accuracy and increases the running speed.
Description
Technical Field
The invention relates to a water consumption prediction method, in particular to a prediction method for residential water consumption.
Background
In recent years, energy conservation and emission reduction in the water supply industry become hot spots, and accurate prediction of the water quantity of users is a basis for realizing accurate pumping of the water quantity of a water supply pump room, so that the energy consumption of a water plant is reduced, and the carbon emission of a water supply system is reduced. The prediction of the water quantity of the user is divided into long-term prediction, medium-term prediction and short-term prediction, wherein the short-term prediction mainly refers to the water quantity prediction on three scales of day, time and minute. Short-term prediction of water quantity becomes a challenge to be solved in order to scientifically schedule the water quantity of users.
The traditional water quantity prediction method has the defect of low precision and granularity. In recent years, more and more scholars have proposed a machine learning method to predict the amount of water of users. When the traditional machine learning predicts the water consumption of residents, time sequence information of the water consumption cannot be contained, the prediction effect is not ideal, and the time sequence information of data is considered by a cyclic neural network developed in recent years, so that short-term prediction of the water consumption of users is possible. Most of the existing water consumption prediction methods use a cyclic neural network, however, the cyclic neural network cannot perform parallel operation due to the structural problem, the prediction efficiency is low, and more memory is occupied. In addition, the existing water consumption prediction is basically a prediction of daily water consumption and time-consuming water consumption, and a minute-level water consumption prediction is lacking.
Disclosure of Invention
The invention aims to: in order to overcome the defects in the prior art, the invention aims to provide a prediction method for the residential water consumption, which has high prediction precision, high granularity and short running time.
The technical scheme is as follows: the invention relates to a prediction method of residential water consumption, which comprises the following steps:
s1, acquiring water consumption data of a research area in a research period through an intelligent water meter;
s2, cleaning the data by adopting a Z-Score method, and removing and repairing abnormal values in the original data;
s3, decomposing resident water consumption data into a plurality of subsequences with high frequency from high to low frequency through empirical mode decomposition of a time-varying filter;
s4, dividing the subsequence into a high-frequency subsequence and a low-frequency subsequence according to the frequency, and reconstructing water consumption data into the high-frequency subsequence and the low-frequency subsequence;
s5, respectively predicting the two subsequences by using a transducer model;
and S6, superposing the predicted values of the subsequences to obtain predicted water consumption of residents.
Further, the step S2 specifically includes the following steps:
the Z score of the water consumption data is calculated by the following steps:
wherein Z is i Z score, x for the ith data i For the data value of the i-th data,is a flat of the data setMean, σ is the standard deviation of the dataset;
the critical Z-score (Z t ) If |Z i |>Z t And recognizing the data as abnormal values, replacing the abnormal values by using a random interpolation method, and judging and selecting according to the specific condition of the data set.
Further, the step S3 specifically includes the following steps:
s3-1, calculating local cut-off frequency, wherein the formula is as follows:
in the method, in the process of the invention,is the local cut-off frequency, eta 1 (t),η 2 (t),a 1 (t),a 2 (t) are all functions of construction, and the construction method is detailed in the specific embodiment;
rearranging the local cut-off frequency to obtain a final local cut-off frequency;
s3-2, filtering an input signal by using a time-varying filter to obtain an approximation result;
after the local cut-off frequency is acquired, a signal h (t) is obtained:
taking the time point of the extremum of the signal h (t) as a node m, constructing a B spline approximation time-varying filter, and setting the cut-off frequency of the filter asThen B spline approximation time-varying filtering is carried out on the input signal, and an approximation result is recorded as m (t);
s3-3, judging whether m (t) meets the narrow-band signal condition, if yes, stopping decomposing the input signal, if not, enabling x (t) =x (t) -m (t), repeating the steps S3-1 and S3-2, and continuing decomposing the input signal until the stopping condition is reached.
Further, the method for judging whether m (t) meets the condition of the narrow-band signal is as follows: if θ (t) is less than or equal to Δ, the signal may be considered as a narrowband signal, and θ (t) is calculated as:
wherein B is Loughlin (t) is the instantaneous bandwidth of Loughlin,is a weighted average instantaneous frequency;
s3-4, m (t) obtained through S3-1 and S3-2 are all subsequences obtained by decomposing an initial signal through a TVF-EMD method, and the subsequences are recorded and named as C1 and C2 … Cn according to the sequence of m (t), so that n subsequences with the frequency from high to low are obtained.
Further, the step S4 specifically includes the following steps:
s4-1, marking C1 as index 1, taking C1+C2 as index 2, and so on, taking the sum of the first i C sequences as index i, calculating the average value of indexes 1 to n, and performing t test on whether the average value is significantly different from 0, if t test is significantly different from 0 at index k, classifying C1-C (k-1) as high-frequency components, and classifying Ck-Cn as low-frequency components;
s4-2, reconstructing the subsequence according to the signal frequency to reduce the number of established models, wherein C1-C (k-1) represent high-frequency components, and the reconstructed high-frequency components Cnew1 are as follows:
Cnew1=C1+C2+…+C(k-1)
ck to Cn represent low frequency components, and the reconstructed low frequency component Cnew2 is:
Cnew2=Ck+C(k+1)+…+Cn。
further, the step S5 specifically includes the following steps:
s5-1, converting water consumption data of an input sequence into embedded vectors, and then carrying out position coding on each vector;
s5-2, adding the embedded vector of the water data and the position code to obtain a vector representation matrix of the input sequence, and transmitting the vector representation matrix of the input sequence into an encoder, wherein the encoder comprises a plurality of encoder layers, and each encoder layer comprises a multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network, residual connection and layer normalization;
s5-3, the decoder comprises a plurality of decoder layers corresponding to the encoder, wherein each decoder layer comprises a mask multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network, residual connection and layer normalization;
s5-4, using the first 80% of the data as a training set and the last 20% of the data as a test set, inputting a water consumption data decomposition reconstruction signal sequence into a transducer model for training and result prediction, and outputting a model prediction sequence.
Further, the formula of the position encoding in step S5-1 is:
in PE 2i (p) encoding for even positions, PE 2i+1 And (p) is an odd position code, p is the position of the water consumption at the moment in n moments, and d is the dimension of PE.
Further, in step S5-2, the output of the multi-head attention mechanism is accelerated to converge through residual connection and layer normalization, and finally the final output coding information is obtained through the feedforward neural network by using a plurality of full-connection layers.
Further, in S5-3, the masking multi-headed attention mechanism adds an upper triangular matrix to mask the information of the future sequence based on the multi-headed attention mechanism, Q, K of the multi-headed attention mechanism of the decoder portion is derived from the output of the corresponding encoder layer, and V is derived from the input features of the decoder.
Further, the superposition formula of step S6 is:
W pred =W new1,p +W new2,p
in which W is pred For the predicted value of the water quantity of the user, W new1,p And W is equal to new2,p The high frequency component subsequence predictor and the low frequency component subsequence predictor are respectively.
The beneficial effects are that: compared with the prior art, the invention has the following remarkable characteristics:
1. the original data is decomposed by adopting TVF-EMD, so that the nonlinearity and the non-stationarity of the data are obviously improved, and the data are easier to predict;
2. the decomposition subsequence is reconstructed, so that the number of models to be built is reduced, and the running requirement and the running time of equipment are reduced;
3. the method has the advantages that the transducer model is used for prediction, the data position association operation is not limited, the modeling capacity is strong, the universality is strong, the expandability is strong, and the parallel operation can be better carried out;
4. the TVF-EMD-transducer mixed model can better predict the minute-level user water quantity, and achieves the prediction result of granularity and high precision.
Drawings
FIG. 1 is a flow chart of the present invention;
FIG. 2 is a diagram of the architecture of a transducer model of the present invention.
Detailed Description
Referring to fig. 1, a method for predicting water consumption of residents includes the steps of:
s1, acquiring water consumption data of a research area in a research period through an intelligent water meter, wherein the time interval of the data is 15min.
S2, cleaning the data by adopting a Z-Score method to remove and repair abnormal values in the original data, wherein the method specifically comprises the following steps of:
the Z score of the water consumption data is calculated by the following steps:
wherein Z is i Z score for the ith data; x is x i A data value that is the i-th data;is the average of the dataset; σ is the standard deviation of the dataset, and the mean and standard deviation of the dataset are calculated by equations (2) - (3), respectively.
The critical Z-score (Z t ). If |Z i |>Z t This data is considered to be outliers and replaced using random interpolation. Z is Z t Usually 2.5, 3.0 and 3.5, and is judged and selected according to the specific condition of the data set.
Formulas (2) - (3):
wherein n is the data quantity of the data set, and other symbols are as in formula (1).
S3, considering the complexity of water consumption data, decomposing the resident water consumption data into a plurality of subsequences with frequencies from high to low by using time-varying filter empirical mode decomposition (TVF-EMD), wherein the method specifically comprises the following steps of:
s3-1, calculating the local cut-off frequency.
The instantaneous amplitude and instantaneous frequency of the input signal x (t) are calculated using the hilbert transform, namely:
wherein A (t),Respectively the instantaneous amplitude and the instantaneous frequency of the input signal; x (t) and->Representing the original input signal (time-series data of the residential water consumption) and the input signal after the hilbert transform, respectively.
Then, the maximum value sequence and the minimum value sequence of the instantaneous amplitude A (t) are determined and are recorded as { t } max Sum { t } min }. Its resolved signal z (t) can be expressed as:
wherein a is i Andthe amplitude and phase of the i-th order component, respectively.
After the formula (6) is treated, the following steps are obtained:
when t=t min When available from formula (7):
substitution of formula (9) into formula (7) and formula (8) yields:
A(t min )=|a 1 (t min )-a 2 (t min )| (10)
due to A (t min ) Is a local minimum, so there is A' (t) min ) =0, then:
a′ 1 (t min )-a′ 2 (t min )=0 (12)
a can be obtained by solving the above-mentioned steps (9) - (12) 1 (t min ),a 2 (t min ),And->Similarly, a can be obtained according to formulas (13) - (16) 1 (t max ),a 2 (t max ),/>And->
A(t max )=a 1 (t max )+a 2 (t max ) (14)
a′ 1 (t max )+a′ 2 (t max )=0 (16)
And (3) making:
β 1 (t)=|a 1 (t)-a 2 (t)| (17)
β 2 (t)=a 1 (t)+a 2 (t) (18)
let t=t min And t=t max Substituting the formula (17) and the formula (18) to obtain:
β 1 (t min )=|a 1 (t min )-a 2 (t min )|=A(t min ) (19)
β 2 (t max )=a 1 (t max )+a 2 (t max )=A(t max ) (20)
because a 1 (t) and a 2 (t) slow variation, beta 1 (t) and beta 2 (t) can be performed by the sequence A { t } min Sum A { t } max Interpolation, thus:
similarly, the following functions were constructed:
let t=t min And t=t max Substituting the formula (23) and the formula (24) to obtain:
similarly, by solving the formula (23) and the formula (24):
substituting each parameter solved in the steps into the local cut-off frequencyThe calculation formula can be obtained:
in order to solve the problem that the cut-off frequency is affected by noise, the cut-off frequency is rearranged according to the following rule:
find the local maximum of the signal x (t), denoted as u i (i=1, 2,3 …), if u i Satisfying the following, then it is denoted as e j =u i (j=1,2,3…)。
Where ρ is a threshold parameter, taken as 0.25. If it isThen e j The rising edge and the falling edge are the opposite. For each e j Make a judgment, if at the rising edge, +.>For the bottom, if at the falling edge +.>The remainder, the bottom, is the peak. Interpolation is performed between the two peaks to obtain the final cut-off frequency.
S3-2, filtering the input signal by using a time-varying filter to obtain an approximation result.
After the local cut-off frequency is acquired, a signal h (t) is obtained:
taking the time point of the extremum of the signal h (t) as a node m, constructing a B spline approximation time-varying filter, and setting the cut-off frequency of the filter asThe input signal is then B-spline approximation time-varying filtered, and the approximation result is recorded as m (t).
S3-3, judging a stop condition.
Judging whether m (t) meets the narrow-band signal condition, if yes, stopping decomposing the input signal, if not, making x (t) =x (t) -m (t) and repeating the steps S3-1 and S3-2, and continuing decomposing the input signal until the stopping condition is reached.
The method for judging whether the signal meets the condition of the narrowband signal comprises the following steps: if θ (t). Ltoreq.Δ, the signal may be considered a narrowband signal. θ (t) is calculated by the formula (32), where θ (t) is a criterion value;calculating by equation (33) for a weighted average instantaneous frequency; b (B) Loughlin And (t) is the instantaneous bandwidth of Loughlin, and is calculated by the formula (34).
S3-4, obtaining and storing the subsequence.
M (t) obtained through S3-1 and S3-2 in each step is a subsequence obtained by decomposing an initial signal by a TVF-EMD method, and is recorded and named as C1 and C2 … Cn according to the sequence of m (t). N subsequences with frequencies from high to low are obtained in total.
S4, dividing the subsequence into a high-frequency subsequence and a low-frequency subsequence according to frequency, and reconstructing water consumption data into the high-frequency subsequence and the low-frequency subsequence, wherein the method specifically comprises the following steps:
s4-1, judging the signal frequency of the subsequence.
And (3) marking C1 as index 1, C1 and C2 as index 2, and so on, adding the sum of the first i C sequences as index i, calculating the average value of the indexes 1 to n, and performing t-test on whether the average value is significantly different from 0. If the t-test is significantly different from 0 at index k, then C1-C (k-1) is classified as a high frequency component and Ck-Cn is classified as a low frequency component.
S4-2, carrying out component reconstruction according to the signal frequency.
Because there are a plurality of subsequences decomposed according to the original signal, if each subsequence is modeled, the number of models to be built is large, and the required computer memory and operation time are increased, the subsequences are reconstructed according to the signal frequency to reduce the number of models to be built, and the prediction efficiency is improved.
C1-C (k-1) represents the high frequency component, the reconstructed high frequency component Cnew1 is:
Cnew1=C1+C2+…+C(k-1) (35)
Ck-Cn represents the low frequency component, the reconstructed low frequency component Cnew2 is:
Cnew2=Ck+C(k+1)+…+Cn (36)
s5, as shown in FIG. 2, the two subsequences are respectively predicted by using a transducer model, and specifically include:
s5-1, word embedding and position coding.
The water consumption data of the Input sequence is converted into embedded vectors through Input encoding, and then each vector is subjected to position encoding, wherein the position encoding formula is shown in formulas (37) - (38). Similarly, similar word embedding and position encoding operations are performed on the water usage data of the target sequence.
In PE 2i (p) encoding for even positions, PE 2i+1 (p) is an odd number of position codes, p is the position of the water consumption at the moment in n moments; d is the dimension of PE.
S5-2, the encoder operates.
Adding the embedded vector of the water data and the position code to obtain a vector representation matrix X of the input sequence n×d N is the window size, i.e., n preamble time data are used to predict the n+1th time series data; d is the embedding dimension, taken generally at 512. The resulting sequence vector representation matrix is passed into an encoder, which is made up of a plurality of encoder layers, typically six encoder layers are selected, and the present invention uses six encoder layers as encoder structures. Each encoder layer is composed of four parts, namely a multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network, residual connection and layer normalization. The principle of the multi-head attention mechanism and the input and output of the encoder layer are shown below.
(1) Multi-headed attention mechanism
First, on a self-attention basis, Q, K, V is split according to the number of heads. Q (Query), K (Key), and V (Value) are derived from the input features themselves, and are vectors generated from the input features. The second bit parameter of the superscript is then Q, K, V (e.g.Q 1 、K 1 、V 1 ) Is classified as Head1.Head2, …, headn is the same. The output of each head is:
splice the outputs of each Head and then multiply the spliced outputs byAn output of the multi-headed attention mechanism is obtained. Where there is d k =d v =d model And/h, h is the number of heads of the multi-head attention mechanism, and the number of heads of the multi-head attention mechanism used by the transducer is 8, namely h=8.
(2) Input and output of encoder layer
The output of the multi-head attention mechanism is accelerated to converge through residual connection and layer normalization, and finally the final output coding information is obtained through a feedforward neural network by using a plurality of full-connection layers.
The input and output of the encoder layer are shown in equations (39) - (40).
e 0 =Embedding(inputs)+pos_Enc(inputs position ) (39)
e i =EncoderLayer(e i-1 ) (40)
In the formula e 0 Is the input to the encoder; e, e i-1 And e i The output of the i-1 layer and the i layer of the encoder respectively; encoderLayer (·) represents encoder layer operation; i epsilon [1, N]N is the number of encoder layers.
S5-3, the decoder operates.
The decoder also includes a plurality of decoder layers corresponding to the encoder, and since the present invention uses six encoder layers, a decoder is formed using six decoder layers corresponding to the decoder. Each decoder layer consists of six parts, namely a mask multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network and residual connection and layer normalization. Masking multi-headed attention mechanisms an upper triangular matrix is added to mask information of future sequences based on the multi-headed attention mechanism. The multi-headed attention mechanism of the decoder portion is similar to that of the encoder, except that Q, K is derived not from the decoder input features but from the output of the corresponding encoder layer, V is derived from the decoder input features. The input and output of the decoder layer is as follows:
e 0 =Embedding(outputs)+pos_Enc(outputs position ) (41)
e i =DecoderLayer(e i-1 ) (42)
e 0 is the input to the decoder; e, e i-1 And e i The outputs of the i-1 th layer and the i-th layer of the decoder respectively; decoderLayer (·) represents decoder layer operations; i epsilon [1, N]N is the number of decoder layers.
S5-4, predicting the two reconstruction subsequences.
The first 80% of the data was used as the training set and the last 20% of the data was used as the test set. And (3) inputting the water consumption data decomposition and reconstruction signal sequence into a transducer model for training and result prediction, and outputting a model prediction sequence.
S6, overlapping predicted values of the subsequences to obtain predicted residential water consumption, wherein the method specifically comprises the following steps:
and 5, adding the predicted values of the two subsequences in the step S5 to obtain a predicted value of the user water quantity, namely:
W pred =W new1,p +W new2,p (43)
in which W is pred For the predicted value of the water quantity of the user, W new1,p And W is equal to new2,p The high frequency component subsequence predictor and the low frequency component subsequence predictor are respectively.
Claims (10)
1. A method for predicting water consumption of residents, comprising the steps of:
s1, acquiring water consumption data of a research area in a research period through an intelligent water meter;
s2, cleaning the data by adopting a Z-Score method, and removing and repairing abnormal values in the original data;
s3, decomposing resident water consumption data into a plurality of subsequences with high frequency from high to low frequency through empirical mode decomposition of a time-varying filter;
s4, dividing the subsequence into a high-frequency subsequence and a low-frequency subsequence according to the frequency, and reconstructing water consumption data into the high-frequency subsequence and the low-frequency subsequence;
s5, respectively predicting the two subsequences by using a transducer model;
and S6, superposing the predicted values of the subsequences to obtain predicted water consumption of residents.
2. The prediction method of residential water consumption according to claim 1, wherein: the step S2 specifically includes the following steps:
the Z score of the water consumption data is calculated by the following steps:
wherein Z is i Z score, x for the ith data i For the data value of the i-th data,the sigma is the standard deviation of the data set;
the critical Z-score (Z t ) If |Z i |>Z t And recognizing the data as abnormal values, replacing the abnormal values by using a random interpolation method, and judging and selecting according to the specific condition of the data set.
3. The prediction method of residential water consumption according to claim 1, wherein: the step S3 specifically comprises the following steps:
s3-1, calculating local cut-off frequency, wherein the formula is as follows:
in the method, in the process of the invention,is the local cut-off frequency, eta 1 (t),η 2 (t),a 1 (t),a 2 (t) are all functions of the construct;
rearranging the local cut-off frequency to obtain a final local cut-off frequency;
s3-2, filtering an input signal by using a time-varying filter to obtain an approximation result;
after the local cut-off frequency is acquired, a signal h (t) is obtained:
taking the time point of the extremum of the signal h (t) as a node m, constructing a B spline approximation time-varying filter, and setting the cut-off frequency of the filter asThen B spline approximation time-varying filtering is carried out on the input signal, and an approximation result is recorded as m (t);
s3-3, judging whether m (t) meets the narrow-band signal condition, if yes, stopping decomposing the input signal, if not, enabling x (t) =x (t) -m (t) and repeating the steps S3-1 and S3-2, and continuing decomposing the input signal until the stopping condition is reached;
s3-4, m (t) obtained through S3-1 and S3-2 are all subsequences obtained by decomposing an initial signal through a TVF-EMD method, and the subsequences are recorded and named as C1 and C2 … Cn according to the sequence of m (t), so that n subsequences with the frequency from high to low are obtained.
4. A method for predicting residential water consumption as claimed in claim 3, wherein: in the S3-3, the method for judging whether m (t) meets the condition of the narrow-band signal is as follows: if θ (t) is less than or equal to Δ, the signal may be considered as a narrowband signal, and θ (t) is calculated as:
wherein B is Loughlin (t) is the instantaneous bandwidth of Loughlin,is a weighted average instantaneous frequency.
5. The prediction method of residential water consumption according to claim 1, wherein: the step S4 specifically includes the following steps:
s4-1, marking C1 as index 1, taking C1+C2 as index 2, and so on, taking the sum of the first i C sequences as index i, calculating the average value of indexes 1 to n, and performing t test on whether the average value is significantly different from 0, if t test is significantly different from 0 at index k, classifying C1-C (k-1) as high-frequency components, and classifying Ck-Cn as low-frequency components;
s4-2, reconstructing the subsequence according to the signal frequency to reduce the number of established models, wherein C1-C (k-1) represent high-frequency components, and the reconstructed high-frequency components Cnew1 are as follows:
Cnew1=C1+C2+…+C(k-1)
ck to Cn represent low frequency components, and the reconstructed low frequency component Cnew2 is:
Cnew2=Ck+C(k+1)+…+Cn。
6. the prediction method of residential water consumption according to claim 1, wherein: the step S5 specifically includes the following steps:
s5-1, converting water consumption data of an input sequence into embedded vectors, and then carrying out position coding on each vector;
s5-2, adding the embedded vector of the water data and the position code to obtain a vector representation matrix of the input sequence, and transmitting the vector representation matrix of the input sequence into an encoder, wherein the encoder comprises a plurality of encoder layers, and each encoder layer comprises a multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network, residual connection and layer normalization;
s5-3, the decoder comprises a plurality of decoder layers corresponding to the encoder, wherein each decoder layer comprises a mask multi-head attention mechanism, residual connection and layer normalization, a feedforward neural network, residual connection and layer normalization;
s5-4, using the first 80% of the data as a training set and the last 20% of the data as a test set, inputting a water consumption data decomposition reconstruction signal sequence into a transducer model for training and result prediction, and outputting a model prediction sequence.
7. The prediction method for residential water consumption as claimed in claim 6, wherein: the formula of the position coding in the step S5-1 is as follows:
in PE 2i (p) encoding for even positions, PE 2i+1 And (p) is an odd position code, p is the position of the water consumption at the moment in n moments, and d is the dimension of PE.
8. The prediction method for residential water consumption as claimed in claim 6, wherein: in the step S5-2, the output of the multi-head attention mechanism is accelerated to converge through residual connection and layer normalization, and finally the final output coding information is obtained through a feedforward neural network by using a plurality of full-connection layers.
9. The prediction method for residential water consumption as claimed in claim 6, wherein: in S5-3, the masking multi-headed attention mechanism adds an upper triangular matrix to mask the information of the future sequence based on the multi-headed attention mechanism, Q, K of the multi-headed attention mechanism of the decoder portion is derived from the output of the corresponding encoder layer, and V is derived from the input features of the decoder.
10. The prediction method of residential water consumption according to claim 1, wherein: the superposition formula of the step S6 is:
W pred =W new1,p +W new2,p
in which W is pred For the predicted value of the water quantity of the user, W new1,p And W is equal to new2,p The high frequency component subsequence predictor and the low frequency component subsequence predictor are respectively.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310783082.0A CN116703003A (en) | 2023-06-29 | 2023-06-29 | Prediction method for residential water consumption |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202310783082.0A CN116703003A (en) | 2023-06-29 | 2023-06-29 | Prediction method for residential water consumption |
Publications (1)
Publication Number | Publication Date |
---|---|
CN116703003A true CN116703003A (en) | 2023-09-05 |
Family
ID=87832243
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202310783082.0A Pending CN116703003A (en) | 2023-06-29 | 2023-06-29 | Prediction method for residential water consumption |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN116703003A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117391261A (en) * | 2023-12-11 | 2024-01-12 | 深圳鼎智达表计信息科技有限公司 | AI intelligent water service system of internet of things based on low-power consumption ultrasonic measurement |
-
2023
- 2023-06-29 CN CN202310783082.0A patent/CN116703003A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117391261A (en) * | 2023-12-11 | 2024-01-12 | 深圳鼎智达表计信息科技有限公司 | AI intelligent water service system of internet of things based on low-power consumption ultrasonic measurement |
CN117391261B (en) * | 2023-12-11 | 2024-03-22 | 深圳鼎智达表计信息科技有限公司 | AI intelligent water service system of internet of things based on low-power consumption ultrasonic measurement |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN113159361A (en) | Short-term load prediction method and system based on VDM and Stacking model fusion | |
CN107292446B (en) | Hybrid wind speed prediction method based on component relevance wavelet decomposition | |
CN102855385A (en) | Wind power generation short-period load forecasting method | |
CN109242212A (en) | A kind of wind-powered electricity generation prediction technique based on change Mode Decomposition and length memory network | |
CN108711847A (en) | A kind of short-term wind power forecast method based on coding and decoding shot and long term memory network | |
CN116502774B (en) | Time sequence prediction method based on time sequence decomposition and Legend projection | |
CN116703003A (en) | Prediction method for residential water consumption | |
CN112434891A (en) | Method for predicting solar irradiance time sequence based on WCNN-ALSTM | |
CN114548586B (en) | Short-term power load prediction method and system based on hybrid model | |
CN116596144B (en) | Hybrid deep learning power load prediction method and system integrating frequency attention | |
CN117390431A (en) | Port air quality prediction method based on STL decomposition and VAE-TCN network model | |
Huang et al. | An adversarial learning approach for machine prognostic health management | |
CN116843083A (en) | Carbon emission prediction system and method based on hybrid neural network model | |
CN116995668A (en) | Middle-long term power load prediction method and system based on improved seasonal ARIMA model | |
CN113627685B (en) | Wind driven generator power prediction method considering wind power internet load limit | |
Sun et al. | Short-term power load prediction based on VMD-SG-LSTM | |
CN110852522A (en) | Short-term power load prediction method and system | |
CN117852686A (en) | Power load prediction method based on multi-element self-encoder | |
CN117895486A (en) | Method and system for evaluating multisource co-generation capacity before, during and after extreme weather | |
CN107590557A (en) | Load forecasting method based on wavelet transformation and harmony search updated gray correlation analysis | |
CN116843012A (en) | Time sequence prediction method integrating personalized context and time domain dynamic characteristics | |
CN112232570A (en) | Forward active total electric quantity prediction method and device and readable storage medium | |
CN117009758A (en) | Oil well yield prediction method based on PSO-VMD-LSTM | |
CN116737521A (en) | HPC operation power consumption prediction method and system based on self-supervision comparison learning | |
Safari et al. | A spatiotemporal wind power prediction based on wavelet decomposition, feature selection, and localized prediction |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |