Cell water consumption data supplementing method and device based on time period compensation
By dividing the cell water use data into multiple periods, calculating the water use coefficient and performing direct filling or curve fitting, the error problem of filling the cell water use data in the existing technology is solved, and a more accurate data filling effect is achieved.
Patent Information
- Application Number
- CN202411812969.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Priority Date
- 2024-03-14
- Filing Date
- 2024-12-11
- Publication Date
- 2025-01-07
- Estimated Expiration
- 2044-12-11
AI Technical Summary
The existing method of filling water data in the cell can easily lead to large errors in water data when processing missing days, and it is difficult to accurately fill the data in the missing period.
By dividing each complete day into multiple time periods, extracting the water use data for each time period, calculating the water use coefficient for each time period, and directly filling in the data for missing time periods based on the water use coefficient and the average value of the reference data, or in the presence of special events When fitting, use a water curve to make up.
It realizes accurate filling of community water use data, reduces water use data errors, and adapts to water use modes of emergencies and special events.
Smart Images

Figure CN119271659A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure belongs to the field of data processing technology, and more specifically, relates to a method and device for completing community water use data based on time period compensation. Background Art
[0002] Smart water data governance is to collect, process, analyze and apply water resources in an all-round, efficient and multi-dimensional manner through big data technology, cloud computing technology, artificial intelligence technology and other means to achieve scientific utilization and management of water resources. Smart water data governance is applied to community water management, which can fully and accurately understand the community's water use situation, predict and prevent excessive use and pollution of water resources, and promote the rational allocation and utilization of water resources.
[0003] The basis of smart water data management is accurate water consumption data. In actual applications, the data uploaded by water meters has problems such as power outages, data interruptions, and missing data, resulting in missing water consumption data. The existing data completion methods need to be improved. Summary of the invention
[0004] The purpose of the present disclosure is to provide a method and device for completing water usage data of a residential area based on time period compensation, so as to improve the accuracy of water usage data completion.
[0005] In a first aspect of an embodiment of the present disclosure, a method for completing community water usage data based on time period compensation is provided, comprising: Obtaining total water usage data of the community; the total water usage data of the community includes total water usage data of multiple missing days and total water usage data of multiple complete days, wherein the missing days are water usage dates with missing data, and the complete days are water usage dates other than the missing days; Divide each full day into multiple time periods according to preset intervals, extract water consumption data for each time period in each full day, and obtain reference data for multiple full days; Calculate the water use coefficient for each time period in the target complete day based on the reference data of the target complete day; wherein the water use coefficient for any time period is equal to the ratio of the average value of the reference data for that time period in the target complete day to the average value of the reference data for all time periods in the target complete day; the target complete day includes several complete days; Calculate the water consumption data for the missing time period of the missing day based on the water consumption coefficient for each time period of the target complete day and the average value of the reference data for all time periods of the target complete day; The total water consumption data for the missing day is supplemented according to the water consumption data for the missing period of the missing day.
[0006] A second aspect of the embodiments of the present disclosure provides a device for completing community water usage data based on time period compensation, including: A data acquisition unit, used to acquire total water use data of a community; the total water use data of the community includes total water use data of multiple missing days and total water use data of multiple complete days, wherein the missing days are water use dates with missing data, and the complete days are water use dates other than the missing days; A data extraction unit, used to divide each complete day into multiple time periods according to a preset interval time, and extract the water consumption data of each time period in each complete day to obtain reference data of multiple complete days; A first calculation unit is used to calculate the water use coefficient of each time period in the target complete day according to the reference data of the target complete day; wherein the water use coefficient of any time period is equal to the ratio of the average value of the reference data of the time period in the target complete day to the average value of the reference data of all time periods in the target complete day; the target complete day includes a plurality of complete days; The second calculation unit is used to calculate the water use data of the missing time period of the missing day according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; The data completion unit is used to complete the total water consumption data of the missing day according to the water consumption data of the missing time period of the missing day.
[0007] According to a third aspect of an embodiment of the present disclosure, an electronic device is provided, including a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the steps of the above-mentioned method for completing community water consumption data based on time period compensation when executing the computer program.
[0008] In a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the above-mentioned method for completing community water consumption data based on time period compensation are implemented.
[0009] The beneficial effects of the method and device for completing community water use data based on time period compensation provided by the embodiments of the present disclosure are: In the disclosed embodiment, the total water use data of the community on the missing day may be the total water use data of the community for the whole day, or the total water use data of the community for a part of the time period. The existing method for completing the total water use data of the community is usually to first estimate the daily water use data of the missing day, and then complete the data of the missing time period based on the daily water use data. This easily causes the existing water use data of the missing day to be greater than the estimated daily water use data of the missing day. Completing the data according to this method will result in a large error in the total water use data of the community. The embodiment of the present disclosure divides each complete day into multiple time periods and extracts the water use data of each time period in each complete day to obtain reference data for multiple complete days; then, based on the reference data for multiple complete days, the water use coefficient of each time period in all complete days or in certain complete days is calculated; finally, based on the water use coefficient of each time period in all complete days or in certain complete days, the water use data of the corresponding time period in the missing days is calculated, and the water use data of the missing days is supplemented based on the water use data of the corresponding time period in the missing days. Compared with the existing data completion method, the embodiment of the present disclosure adopts a method of directly completing the missing period data, which can achieve accurate data completion. BRIEF DESCRIPTION OF THE DRAWINGS
[0010] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present disclosure. For ordinary technicians in this field, other drawings can be obtained based on these drawings without creative work.
[0011] Figure 1 A schematic flow chart of a method for completing community water use data based on time period compensation provided in an embodiment of the present disclosure; Figure 2 A structural block diagram of a cell water use data completion device based on time period compensation provided by an embodiment of the present disclosure; Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0012] In the following description, specific details such as specific system structures and technologies are provided for the purpose of illustration rather than limitation, so as to provide a thorough understanding of the embodiments of the present disclosure. However, it should be clear to those skilled in the art that the present disclosure may be implemented in other embodiments without these specific details. In other cases, detailed descriptions of well-known systems, devices, circuits, and methods are omitted to avoid obstructing the description of the present disclosure with unnecessary details.
[0013] In order to make the purpose, technical solutions and advantages of the present disclosure more clear, specific embodiments will be described below in conjunction with the accompanying drawings.
[0014] Please refer to Figure 1 , Figure 1 A flow chart of a method for completing community water use data based on time period compensation provided in an embodiment of the present disclosure, the method comprising: S101: Obtain total water usage data for a community; the total water usage data for a community includes total water usage data for multiple missing days and total water usage data for multiple complete days, wherein a missing day is a water usage date with missing data, and a complete day is a water usage date other than a missing day.
[0015] In this embodiment, the total water usage data of the community can be obtained by obtaining the data of the community water usage total table in the most recent period (for example, one year). That is, the total water usage data of the community includes the total water usage data of multiple water usage dates, among which the total water usage data of some water usage dates are completely or partially missing, and these water usage dates are called missing days, and other dates are called complete days.
[0016] S102: Divide each complete day into multiple time periods according to a preset interval time, extract water consumption data of each time period in each complete day, and obtain reference data of multiple complete days.
[0017] In this embodiment, each full day is a complete date, that is, 24 hours, and each full day can be divided according to a preset interval time to obtain multiple time periods. Each time period has two endpoints, that is, a first time point and a second time point, and the water consumption data of each time period can be obtained by subtracting the total water consumption data corresponding to the two time points.
[0018] Considering that the water use data of each time period is related to the daily water use habits of residents, for example, 6-9 am is the first small water use peak after residents get up, and this period is mainly used for washing, including brushing teeth, washing face, washing hands, etc.; 5-10 pm is another water use peak, after getting home from get off work, residents will take a bath, cook, etc.; after 10 pm, water use activities gradually decrease. Therefore, water use data of multiple time periods can be used as reference data to fill in the water use data of the corresponding time periods on missing days.
[0019] Those skilled in the art can flexibly design the preset time interval, such as 5 minutes, 10 minutes, etc. Taking the preset time interval equal to 5 minutes as an example, the preset time interval divides the 24 hours of a complete day into 24×60÷5=288 time periods, namely the first time period, the second time period, ... the 288th time period. If there is missing data in the second time period of a missing day, the water consumption data of the second time period of the missing day is supplemented according to the water consumption data of the second time period of the complete day.
[0020] S103: Calculate the water use coefficient of each time period in the target complete day based on the reference data of the target complete day; wherein the water use coefficient of any time period is equal to the ratio of the average value of the reference data of the time period in the target complete day to the average value of the reference data of all time periods in the target complete day; the target complete day includes several complete days.
[0021] In this embodiment, part or all of the complete days can be selected as the target complete days according to actual needs. For example, only the data of all Mondays in all complete days are selected to fill in the missing period data of Monday. For each period in the target complete day, the average value of the reference data of the period is first calculated. For example, for the period from 0:00 to 0:05, the water consumption data of the period in all selected target complete days is added, and then divided by the number of target complete days to obtain the average value of the reference data of the period.
[0022] Then calculate the average value of the reference data for all time periods within the target complete day, that is, add up all the reference data for each time period within the target complete day, and then divide it by the total number of time periods to get the average value of the reference data.
[0023] Finally, the water use coefficient of any period is equal to the ratio of the average value of the reference data of that period within the target full day to the average value of the reference data of all periods within the target full day. The water use coefficient represents the relative proportion of any period to the water use of the whole day, which can reflect the difference in water use in different periods; while the average value of the reference data ensures the overall water use situation.
[0024] S104: Calculate the water consumption data of the missing time period of the missing day according to the water consumption coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day.
[0025] In this embodiment, based on the average value of the reference data of all time periods of the target complete day, the water consumption coefficient of each time period is multiplied to obtain the water consumption data of the corresponding time period of the missing day, thereby achieving targeted compensation for the missing data of each time period.
[0026] For example, if there is missing data in the first period of a missing day, the water consumption coefficient of the first period is multiplied by the average value of the reference data of all periods of the target complete day to obtain the water consumption data of the first period of the missing day. S105: Completing the total water consumption data of the missing day according to the water consumption data of the missing time period of the missing day.
[0027] In this embodiment, after the water consumption data of each (missing) time period of a missing day is supplemented according to steps S101 to S105, the total water consumption data of the missing day is supplemented.
[0028] From the above, it can be concluded that this embodiment divides each complete day into multiple time periods and extracts the water consumption data of each time period in each complete day to obtain reference data for multiple complete days; then, based on the reference data of multiple complete days, the water consumption coefficient of each time period in all complete days or certain complete days is calculated; finally, based on the water consumption coefficient of each time period in all complete days or certain complete days, the water consumption data of the corresponding time period in the missing days is calculated, and the water consumption data of the missing days is supplemented according to the water consumption data of the corresponding time period in the missing days. Compared with the existing data completion method, the embodiment of the present disclosure adopts a method of directly completing the missing period data, which can achieve accurate data completion.
[0029] In one embodiment of the present disclosure, the water use data of the missing time period of the missing day is calculated according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day, including: If the first correlation coefficient between the existing data of the missing day and the water use coefficient of the corresponding time period is greater than or equal to the first threshold, the water use data of the missing time period of the missing day is calculated according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; If the first correlation coefficient between the existing data of the missing day and the water consumption coefficient of the corresponding time period is less than the first threshold, the water consumption curve of the missing day is fitted according to the existing data of the missing day, and the water consumption data of the missing time period of the missing day is calculated based on the water consumption curve.
[0030] In this embodiment, it is considered that when a special event or abnormal situation occurs on a missing day, the water consumption in each time period will be quite different from the water consumption pattern of a normal complete day. For example, if a large-scale event is held in a community on a missing day, such as an outdoor wedding, a community sports meeting, etc., the water consumption will increase significantly during the event period; or a water pipe in the community will rupture, resulting in an increase in water consumption. This increase may be continuous or phased, and it is difficult to match the water consumption coefficient of each time period calculated based on the complete day. In this case, if the water consumption data of the missing time period of the missing day is still calculated based on the water consumption coefficient of each time period of the target complete day, it will cause a large error in the water consumption data of the missing time period.
[0031] To solve the above problem, considering that the water consumption behavior of residents and communities has a certain continuity, the water consumption of the missing period can be inferred based on the changing trend of water consumption in adjacent time periods. For example, if the water consumption in the previous period shows an upward trend, and the water consumption in the next period continues to rise, then it can be inferred that the water consumption in the missing period is also in the process of rising. Therefore, this embodiment combines the water consumption data of the target complete day with the existing data of the missing day to complete the water consumption data of the missing period of the missing day. Among them, the existing data of the missing day is the water consumption data of the non-missing period of the missing day.
[0032] Specifically, we can first calculate the first correlation coefficient between the existing data of the missing day and the water use coefficient of the corresponding time period. The water use coefficient is used to characterize the degree of correlation between the existing data of the missing day and the water use coefficient of the corresponding time period. The higher the first correlation coefficient, the stronger the correlation. The existing Pearson correlation coefficient can be used to calculate the first correlation coefficient between the existing data and the water use coefficient of the corresponding time period.
[0033] When the first correlation coefficient is greater than or equal to the first threshold, it indicates that there is a strong linear relationship between the existing data of the missing day and the water use coefficient. At this time, the method of the above embodiment can be used to calculate the water use data of the missing period of the missing day based on the water use coefficient of each period of the target complete day and the average value of the reference data of all periods of the target complete day. Among them, the first threshold is a preset constant, which can be determined by those skilled in the art based on historical water use data.
[0034] When the first correlation coefficient is less than the first threshold, it indicates that the linear relationship between the existing data of the missing day and the water use coefficient is weak. At this time, if the water use data of the missing period of the missing day is calculated based on the water use coefficient of the target complete day and the average value of the reference data, the calculation result may deviate greatly from the actual situation. Therefore, the water use curve of the missing day can be fitted based on the existing data of the missing day. By fitting the curve, the water use law of the missing day itself can be mined from the existing data, and the water use change trend of the missing day can be intuitively understood, and then the water use data of the missing period of the missing day can be calculated based on this trend.
[0035] Exemplarily, the water usage curve may be fitted by polynomial fitting, spline curve fitting, etc. The horizontal axis of the curve may be the time period, and the vertical axis may be the water usage data. Based on the water usage curve, the water usage data corresponding to the missing time period may be obtained.
[0036] From the above, it can be concluded that in this embodiment, when the first correlation coefficient between the existing data of the missing day and the water usage coefficient of the corresponding time period is greater than the first threshold, the water usage data of the missing day is calculated using the water usage pattern of the complete day; when the first correlation coefficient between the existing data of the missing day and the water usage coefficient of the corresponding time period is less than the first threshold, the water usage data is calculated by fitting the water usage curve of the missing day itself, which can better adapt to emergencies and make the completed water usage data more consistent with the actual water usage pattern of the community, thereby improving the accuracy of data completion.
[0037] In one embodiment of the present disclosure, fitting the water usage curve of the missing day according to the existing data of the missing day includes: If the amount of existing data for the missing day is less than or equal to the second threshold, fitting the water use curve for the missing day based on a polynomial fitting method; If the amount of existing data on the missing day is greater than a second threshold, calculating a second correlation coefficient between the existing data on the first time interval of the missing day and the existing data on the second time interval; If the amount of existing data for the missing day is greater than the second threshold, and the second correlation coefficient is greater than or equal to the third threshold, fitting the water use curve for the missing day based on a polynomial fitting method; If the amount of existing data for the missing day is greater than the second threshold and the second correlation coefficient is less than the third threshold, the water usage curve for the missing day is fitted based on the spline curve fitting method.
[0038] In this embodiment, the first time interval of the missing day is the morning period of the missing day, that is, 6:00-12:00 of the missing day; the second time interval of the missing day is the afternoon period of the missing day, that is, 12:00-18:00 of the missing day.
[0039] Considering that the spline curve fitting method is implemented by constructing a piecewise polynomial function between data points, compared with the polynomial fitting method, the spline curve fitting method requires a larger amount of data and a larger amount of calculation. Correspondingly, the spline curve fitting method has higher accuracy.
[0040] Therefore, if the amount of existing data on the missing day is less than or equal to the second threshold, it indicates that the amount of existing data on the missing day is small. In this case, it is easier to accurately fit the water usage curve of the missing day by using the polynomial fitting method.
[0041] If the amount of existing data on the missing day is greater than the second threshold, it indicates that the amount of existing data on the missing day is large. At this time, the specific fitting method can be determined based on the second correlation coefficient between the existing data in the first time interval and the second time interval of the missing day. Specifically, if the second correlation coefficient is greater than or equal to the third threshold, it indicates that the change trend of the water use data is relatively simple. At this time, the polynomial fitting method can still be used to fit the water use curve of the missing day to reduce the calculation amount of curve fitting; if the second correlation coefficient is less than the third threshold, it indicates that there are complex fluctuations in the water use data, such as multiple local peaks and troughs. At this time, the spline curve fitting method can be used to fit the water use curve of the missing day to better capture the change characteristics of each local area. The second threshold and the third threshold are both preset constants, which can be set by technicians in this field based on empirical values. The second correlation coefficient can use the existing Pearson correlation coefficient.
[0042] It can be concluded from the above that this embodiment selects a corresponding curve fitting method to fit the water use curve according to different situations of data volume and data correlation, and can reduce the amount of data calculation as much as possible on the basis of ensuring the fitting accuracy.
[0043] In one embodiment of the present disclosure, the method for completing community water use data further includes: If the sampling period of the total water consumption data of the community for multiple complete days is greater than or equal to the preset time length, the sampling period is determined as the interval time; If the sampling period of the total water consumption data of the community for multiple complete days is less than the preset time length, the preset time length is determined as the interval time.
[0044] In this embodiment, the sampling period of the total water consumption data of the community is also the collection period of the total water consumption meter of the community. When dividing the time periods of a complete day based on the preset interval time, it is considered that too small an interval time will increase the data processing burden, and too large an interval time will affect the accuracy of data completion; at the same time, considering that the sampling period of the total water consumption data of each community is different, in order to unify the setting standard of the interval time, taking into account the requirements of data processing burden and data completion accuracy, this embodiment first sets a preset duration based on experience, and then compares the preset duration with the sampling period of the total water consumption data of the community. When the sampling period is greater than or equal to the preset duration, it indicates that the sampling period itself is relatively long. At this time, the sampling period is divided into time periods using the sampling period as the interval time, which can match the data collection rhythm; when the sampling period is less than the preset duration, it indicates that the sampling period is relatively short. At this time, if the sampling period is still divided into time periods using the sampling period as the interval time, it will result in too many and too detailed divided time periods, increasing the data processing burden. Therefore, determining the preset duration as the interval time can make the number of divided time periods more reasonable.
[0045] From the above, it can be concluded that this embodiment determines the interval time by comparing the sampling period of the total water usage data of the community with the preset time length, which can make the time period division in the process of completing the community water usage data more reasonable, taking into account the data processing burden and the requirements of data completion accuracy.
[0046] In one embodiment of the present disclosure, the method for completing community water use data based on time period compensation further includes: In a specified time period of each complete day, the preset duration is determined as the first duration; In other time periods of each complete day, the preset duration is determined as the second duration; the other time periods are time periods other than the specified time period in each complete day, and the first duration is greater than the second duration.
[0047] In this embodiment, the specified time period can be selected according to the actual characteristics and rules of the community's water use. For example, between 1:00 a.m. and 5:00 a.m., most residents are asleep, and household water use activities such as washing clothes, bathing, cooking, etc. are basically stopped. At this time, except for some possible small-flow water use situations (such as a small amount of flushing of the toilet, etc.), the total water consumption of the community will be relatively stable, basically maintained at a low level, and will not fluctuate too much. In this case, there is no need to divide the time period too finely, and the preset time length can be set to a larger first time length, such as 30 minutes, 1 hour, etc. The larger first time length can reduce the amount of data calculation.
[0048] In other time periods, such as between 6 and 9 in the morning, residents get up and start washing, making breakfast, going to the toilet, etc., which is the peak period of water use. A large number of residents use water at the same time, which will cause a sharp increase in the water consumption of the community. In addition, different households have different water use habits and water equipment usage, making the total water consumption in this period more complex and drastic. In this case, the preset duration needs to be set to a smaller second duration to more finely capture the changes in water use, such as 5 minutes, 10 minutes, etc.
[0049] It can be concluded from the above that this embodiment uses different preset durations of equipment based on water usage characteristics in different time periods, which is beneficial to further reduce the amount of data calculation on the basis of ensuring data completion accuracy.
[0050] In one embodiment of the present disclosure, each complete day is divided into multiple time periods according to a preset interval time, and before the water consumption data of each time period in each complete day is extracted respectively, the method further includes: Based on the total water use data for a complete day, extract the time series data of water use quantity, time series data of water use time, and time series data of water use frequency; Processing the time series data of water consumption based on the first neural network to extract the first feature in the time dimension; The time series data of water use time and the time series data of water use frequency are processed based on the second neural network, and the long-term dependency relationship in the time series is extracted to obtain the second feature; Fusing the first feature and the second feature to obtain a fused feature; Perform cluster analysis on the fusion features, and obtain abnormal data in the total water consumption data based on the cluster analysis results; Remove outliers from total water use data.
[0051] In this embodiment, during the collection and transmission of the total water consumption data for a complete day, data transmission errors or garbled data may be generated due to interference signals. Therefore, before completing the water consumption data for the missing day based on the water consumption data for a complete day, it is necessary to eliminate abnormal data to avoid erroneous reference to these abnormal data when completing the data, which will lead to deviations in the completed results.
[0052] Specifically, the following method can be used to extract the time series data of water consumption, time series data of water use, and time series data of water use frequency: (1) Time series data of water consumption: The total water consumption data of each complete day can be divided into multiple first time periods according to a first time interval, and the difference between the total water consumption data of the two end points of each first time period is calculated to obtain the water consumption of each first time period. The first time interval is greater than the interval time in the aforementioned embodiment, for example, the first time interval can be set to 15 minutes.
[0053] Arrange the water consumption of each first period in the order of timestamps to form a one-dimensional array or list, and you can get the time series data of water consumption. Taking the first time interval of 15 minutes as an example, the time series data of water consumption for a full day can be: [0:00 water consumption, 0:15 water consumption, 0:30 water consumption, …, 23:45 water consumption].
[0054] (2) Time series data of water use: Traverse the time series data of water consumption for a full day, and determine the specific time point of each water use based on the water consumption that is not zero. For example, if the timestamp of a record is 9:15 am and the water consumption is greater than zero, then 9:15 am is a water use time point.
[0055] Arrange all water use time points in chronological order to form time series data of water use time. For example, the time series data of water use time for a full day can be: [8:00 am, 9:15 am, 11:30 am, ...].
[0056] (3) Divide the total water consumption data of each complete day into multiple second time periods according to the second time interval, and count the number of water consumption behaviors (i.e., water consumption greater than zero) occurring in each second time period. The second time interval is greater than the first time interval in the aforementioned embodiment. For example, the second time interval can be set to 1 hour.
[0057] Arrange the water usage times counted in each second time period in chronological order to form the time series data of water usage frequency. Taking 1 hour as an example, the time series data of water usage frequency for a full day can be: [water usage times between 8:00 am and 9:00 am, water usage times between 9:00 am and 10:00 am, …, water usage times between 23:00 am and 0:00 am]. The time series data of water usage frequency is also a one-dimensional array or list, reflecting the water usage frequency in different time periods of a day.
[0058] Based on the time series data of water consumption, time series data of water use time and time series data of water use frequency, the first neural network can be used to process the time series data of water consumption to extract features in the time dimension; at the same time, the second neural network can be used to process the series data of water use time and frequency to extract long-term dependencies in the time series, and then the features of the two modes are fused to obtain fused features.
[0059] Among them, the first neural network can specifically adopt convolutional neural network (CNN), temporal convolutional network (TCN), etc., and the second neural network can specifically adopt long short-term memory network (LSTM), gated recurrent unit (GRU), self-attention mechanism, etc.
[0060] Based on the above fusion features, cluster analysis can be performed to obtain abnormal data points. For example, the density-based clustering method DBSCAN can be used. DBSCAN determines whether it is abnormal based on the density of the data point. In the time-frequency-water consumption space of normal water use, there will be other data points of a certain density around the normal data point. If the density around a data point is very low, lower than the set density threshold (such as not enough data points within a specific radius), then this data point is judged as an abnormal data point. The total water consumption data of the complete day corresponding to the abnormal data point is the abnormal data in the total water consumption data. The above abnormal data can be deleted from the total water consumption data to obtain accurate total water consumption data.
[0061] In one embodiment of the present disclosure, the first neural network is a convolutional neural network, and the method for completing community water use data based on time period compensation further includes: The water use time series data is divided into a first data set, a second data set and a third data set; the first data set is a data set containing the water use time series data on weekdays, the second data set is a data set containing the water use time series data on weekends, and the third data set is a data set containing the water use time series data on designated holidays; the water use time series includes the time series data of water use amount, the time series data of water use time and the time series data of water use frequency; When processing the first type of data in the first data set based on the first neural network, the size of the convolution kernel of the first neural network is set to a first value; the first type of data is time series data of water consumption; When processing the first type of data in the second data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a second value; When processing the first type of data in the third data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a third value; The first value, the second value, and the third value increase in sequence.
[0062] In this embodiment, the designated holidays are traditional holidays such as the Spring Festival, Qingming Festival, Labor Day, Dragon Boat Festival, Mid-Autumn Festival, National Day and New Year's Day. Considering the different water use patterns in different time periods on weekdays, weekends and designated holidays, for example, on weekdays, the water use pattern of community residents is relatively regular, mainly concentrated in the morning and evening periods; on weekends, residents spend more time at home, and water use activities are more diverse, and the water use time and water use amount may vary greatly compared with weekdays; on designated holidays, residents spend more time at home, and there may be more special water use activities, such as waterscape opening, frequent family gatherings, etc., which leads to different water use patterns from weekdays and weekends. Therefore, in this embodiment, the water use time series data (including water use time series data, water use time time series data and water use frequency time series data) are divided into a first data set corresponding to weekdays, a second data set corresponding to weekends and a third data set corresponding to designated holidays. When processing the data of the first data set, the second data set and the third data set, different convolution kernel sizes are used to more accurately capture the characteristics of water use data in different time periods.
[0063] Specifically, when processing the data of the first data set (weekdays), since the water consumption pattern on weekdays is relatively simple and the peak and trough periods of water consumption are relatively fixed, a smaller convolution kernel size (first value) can more finely capture the rapid changes in the morning and evening peak periods of weekdays. For example, a smaller convolution kernel can better focus on the changes in water consumption within a few consecutive hours and accurately extract detailed features such as the upward and downward trends of water consumption.
[0064] When processing the data of the second data set (weekends), since residents’ water use activities on weekends are more diverse, the water use time distribution is more dispersed, and the water consumption changes are more complex than on weekdays, a larger convolution kernel size (the second value) can cover a wider time range, which helps to capture the water use trend during various leisure activities from morning to evening, and extract overall water use characteristics such as the small peak that may occur at noon and the changes in water use for leisure activities in the afternoon.
[0065] When processing the data of the third data set (specified holidays), since residents spend a long time at home during designated holidays, water use activities are frequent and diverse, which may involve changes in water use at various times of the day. For example, the opening of water features may lead to continuous water use during the day, and family gatherings may cause a significant increase in water use at night. A larger convolution kernel size (the third value) can obtain the overall trend of water use over a whole day or longer time span, ignoring small local fluctuations, and better focusing on the changes in the total water use during holidays, the correlation between water use activities at different times, and other macro water use characteristics.
[0066] Exemplarily, a baseline value of the convolution kernel size, a first proportional parameter corresponding to weekdays, a second proportional parameter corresponding to weekends, and a third proportional parameter corresponding to designated holidays can be pre-set, and then the baseline value of the convolution kernel size is multiplied by the first proportional parameter to obtain a first value, the baseline value of the convolution kernel size is multiplied by the second proportional parameter to obtain a second value, and the baseline value of the convolution kernel size is multiplied by the third proportional parameter to obtain a third value.
[0067] It can be concluded from the above that this embodiment divides the time series data of water consumption into a first data set corresponding to weekdays, a second data set corresponding to weekends, and a third data set corresponding to designated holidays. When processing the data of the first data set, the second data set, and the third data set, different convolution kernel sizes are used to more accurately capture the characteristics of water consumption data in different time periods.
[0068] In one embodiment of the present disclosure, the second neural network is a long short-term memory network, and the method for completing the water use data of a residential area based on time period compensation further includes: When processing the second type of data of the first data set based on the second neural network, the number of hidden layers of the second neural network is set to the first number; the first type of data includes time series data of water use time and time series data of water use frequency; When processing the second type of data of the second data set based on the second neural network, setting the number of hidden layers of the second neural network to a second number; When processing the second type of data of the third data set based on the second neural network, setting the number of hidden layers of the second neural network to a third number; The first number, the second number, and the third number increase sequentially.
[0069] In this embodiment, the same method as the above embodiment is adopted. Considering that the water consumption data on weekdays, weekends, and designated holidays have different complexities and time dependencies, different numbers of hidden layers are set in the long short-term memory network when processing the first data set, the second data set, and the third data set based on the second neural network.
[0070] Specifically, when processing the data of the first data set (weekdays), since the water use time and frequency on weekdays are relatively regular and mainly concentrated in the morning and evening periods, the time dependency is relatively simple, and fewer hidden layers (the first number) can effectively capture this relatively simple time series feature. For example, the first number can be set to 1-2 layers to learn the basic time series features of the morning and evening peaks, such as the time of the peak and the approximate changes in water use frequency.
[0071] When processing the data of the second data set (weekends), since residents spend more time at home on weekends, the changes in water use time and frequency are more complex, and there may be multiple small peaks or water use activities are more dispersed throughout the day. More hidden layers (the second number) can better handle this complex time dependency. For example, the second number can be set to 2-3 layers. The first layer can capture the main features such as the late morning peak and the evening peak. The second layer can learn the association between the small peak at noon or the change in water use frequency caused by afternoon leisure activities and the morning and evening peaks. The third layer can combine the above information to extract more complex long-term dependencies between water use time and frequency throughout the weekend, such as the water use sequence and mutual influence between different activities.
[0072] When processing the data of the third data set (specified holidays), since the water use time of the specified holidays covers almost the entire day, the water use frequency is also very high, and there may be special water use activities (such as family gatherings, holiday celebrations, etc.), the complexity and long-term dependencies of its time series data are the strongest, and more hidden layers (third quantity) help to dig deeper into these complex features. For example, the third quantity can be set to 3-4 layers, and the front layers can gradually learn the time sequence and frequency changes of various water use activities from washing after getting up in the morning to going to bed at night, as well as the impact of special holiday activities on water use. The latter layers can integrate this information to construct a comprehensive and deep feature representation of the water use time and frequency during the entire holiday period, so as to better process and understand this highly complex data.
[0073] It can be concluded from the above that this embodiment sets different numbers of hidden layers for the first data set corresponding to weekdays, the second data set corresponding to weekends, and the third data set corresponding to designated holidays, so as to effectively extract time series features of different complexities.
[0074] Corresponding to the method for completing the water use data of a residential area based on time period compensation in the above embodiment, Figure 2 This is a structural block diagram of a cell water usage data completion device based on time period compensation provided by an embodiment of the present disclosure. For ease of explanation, only the parts related to the embodiment of the present disclosure are shown. Figure 2The community water consumption data completion device 20 based on time period compensation includes: a data acquisition unit 21, a data extraction unit 22, a first calculation unit 23, a second calculation unit 24 and a data completion unit 25. The data acquisition unit 21 is used to acquire the total water use data of the community; the total water use data of the community includes the total water use data of multiple missing days and the total water use data of multiple complete days, the missing days are the water use dates with missing data, and the complete days are the water use dates other than the missing days; The data extraction unit 22 is used to divide each complete day into multiple time periods according to a preset interval time, and respectively extract the water consumption data of each time period in each complete day to obtain reference data of multiple complete days; The first calculation unit 23 is used to calculate the water use coefficient of each time period in the target complete day according to the reference data of the target complete day; wherein the water use coefficient of any time period is equal to the ratio of the average value of the reference data of the time period in the target complete day to the average value of the reference data of all time periods in the target complete day; the target complete day includes a plurality of complete days; The second calculation unit 24 is used to calculate the water use data of the missing time period of the missing day according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; The data completion unit 25 is used to complete the total water consumption data of the missing day according to the water consumption data of the missing time period of the missing day.
[0075] In one embodiment of the present disclosure, the second computing unit 24 is specifically configured to: If the first correlation coefficient between the existing data of the missing day and the water use coefficient of the corresponding time period is greater than or equal to the first threshold, the water use data of the missing time period of the missing day is calculated according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; If the first correlation coefficient between the existing data of the missing day and the water consumption coefficient of the corresponding time period is less than the first threshold, the water consumption curve of the missing day is fitted according to the existing data of the missing day, and the water consumption data of the missing time period of the missing day is calculated based on the water consumption curve.
[0076] In one embodiment of the present disclosure, the data extraction unit 22 is specifically used for: If the sampling period of the total water consumption data of the community for multiple complete days is greater than or equal to the preset time length, the sampling period is determined as the interval time; If the sampling period of the total water consumption data of the community for multiple complete days is less than the preset time length, the preset time length is determined as the interval time.
[0077] In one embodiment of the present disclosure, the data extraction unit 22 is further configured to: In a specified time period of each complete day, the preset duration is determined as the first duration; In other time periods of each complete day, the preset duration is determined as the second duration; the other time periods are time periods other than the specified time period in each complete day, and the first duration is greater than the second duration.
[0078] In one embodiment of the present disclosure, the data extraction unit 22 is specifically used for: Based on the total water use data for a complete day, extract the time series data of water use quantity, time series data of water use time, and time series data of water use frequency; Processing the time series data of water consumption based on the first neural network to extract the first feature in the time dimension; The time series data of water use time and the time series data of water use frequency are processed based on the second neural network, and the long-term dependency relationship in the time series is extracted to obtain the second feature; Fusing the first feature and the second feature to obtain a fused feature; Perform cluster analysis on the fusion features, and obtain abnormal data in the total water consumption data based on the cluster analysis results; Remove outliers from total water use data.
[0079] In one embodiment of the present disclosure, the data extraction unit 22 is further configured to: The water use time series data is divided into a first data set, a second data set and a third data set; the first data set is a data set containing the water use time series data on weekdays, the second data set is a data set containing the water use time series data on weekends, and the third data set is a data set containing the water use time series data on designated holidays; the water use time series includes the time series data of water use amount, the time series data of water use time and the time series data of water use frequency; When processing the first type of data in the first data set based on the first neural network, the size of the convolution kernel of the first neural network is set to a first value; the first type of data is time series data of water consumption; When processing the first type of data in the second data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a second value; When processing the first type of data in the third data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a third value; The first value, the second value, and the third value increase in sequence.
[0080] In one embodiment of the present disclosure, the data extraction unit 22 is further configured to: When processing the second type of data of the first data set based on the second neural network, the number of hidden layers of the second neural network is set to the first number; the first type of data includes time series data of water use time and time series data of water use frequency; When processing the second type of data of the second data set based on the second neural network, setting the number of hidden layers of the second neural network to a second number; When processing the second type of data of the third data set based on the second neural network, setting the number of hidden layers of the second neural network to a third number; The first number, the second number, and the third number increase sequentially.
[0081] See also Figure 3 , Figure 3 A schematic block diagram of an electronic device provided by an embodiment of the present disclosure. Figure 3 The electronic device 300 in the embodiment shown may include: one or more processors 301, one or more input devices 302, one or more output devices 303 and one or more memories 304. The processors 301, input devices 302, output devices 303 and memories 304 communicate with each other via a communication bus 305. The memory 304 is used to store computer programs, which include program instructions. The processor 301 is used to execute the program instructions stored in the memory 304. The processor 301 is configured to call the program instructions to execute the functions of each module / unit in the above-mentioned device embodiments, such as Figure 2 The functions of modules 21 to 25 are shown.
[0082] It should be understood that in the embodiment of the present disclosure, the processor 301 may be a central processing unit (CPU), and the processor may also be other general-purpose processors, digital signal processors (DSP), application-specific integrated circuits (ASIC), field-programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or the processor may also be any conventional processor, etc.
[0083] The input device 302 may include a touch panel, a fingerprint collection sensor (for collecting the user's fingerprint information and fingerprint direction information), a microphone, etc., and the output device 303 may include a display (LCD, etc.), a speaker, etc.
[0084] The memory 304 may include a read-only memory and a random access memory, and provide instructions and data to the processor 301. A portion of the memory 304 may also include a non-volatile random access memory. For example, the memory 304 may also store information about the device type.
[0085] In a specific implementation, the processor 301, input device 302, and output device 303 described in the embodiments of the present disclosure can execute the implementation methods described in the first and second embodiments of the community water use data completion method based on time period compensation provided in the embodiments of the present disclosure, and can also execute the implementation methods of the electronic device described in the embodiments of the present disclosure, which will not be repeated here.
[0086] In another embodiment of the present disclosure, a computer-readable storage medium is provided, wherein the computer-readable storage medium stores a computer program, wherein the computer program includes program instructions, and when the program instructions are executed by the processor, all or part of the processes in the above-mentioned embodiment method are implemented, and the computer program can also be completed by instructing the relevant hardware through the computer program. The computer program can be stored in a computer-readable storage medium, and when the computer program is executed by the processor, the steps of each of the above-mentioned method embodiments can be implemented. Among them, the computer program includes computer program code, and the computer program code can be in source code form, object code form, executable file or some intermediate form, etc. The computer-readable medium can include: any entity or device capable of carrying computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software distribution medium, etc.
[0087] The computer-readable storage medium may be an internal storage unit of the electronic device of any of the aforementioned embodiments, such as a hard disk or memory of the electronic device. The computer-readable storage medium may also be an external storage device of the electronic device, such as a plug-in hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (SecureDigital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Furthermore, the computer-readable storage medium may also include both an internal storage unit of the electronic device and an external storage device. The computer-readable storage medium is used to store computer programs and other programs and data required by the electronic device. The computer-readable storage medium may also be used to temporarily store data that has been output or is to be output.
[0088] Those of ordinary skill in the art will appreciate that the units and algorithm steps of each example described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the composition and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of this disclosure.
[0089] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the electronic devices and units described above can refer to the corresponding processes in the aforementioned method embodiments, and will not be repeated here.
[0090] In the several embodiments provided in the present application, it should be understood that the disclosed electronic devices and methods can be implemented in other ways. For example, the device embodiments described above are only schematic, for example, the division of units is only a logical function division, and there may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces or units, or it can be an electrical, mechanical or other form of connection.
[0091] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the embodiments of the present disclosure.
[0092] In addition, each functional unit in each embodiment of the present disclosure may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0093] The above are only specific embodiments of the present disclosure, but the protection scope of the present disclosure is not limited thereto. Any technician familiar with the technical field can easily think of various equivalent modifications or replacements within the technical scope disclosed in the present disclosure, and these modifications or replacements should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure should be based on the protection scope of the claims.
Claims
1. A method for completing community water consumption data based on time period compensation, characterized in that: include: Obtaining total water usage data of the community; the total water usage data of the community includes total water usage data of multiple missing days and total water usage data of multiple complete days, wherein the missing days are water usage dates with missing data, and the complete days are water usage dates other than the missing days; Divide each full day into multiple time periods according to preset intervals, extract water consumption data for each time period in each full day, and obtain reference data for multiple full days; Calculate the water use coefficient for each time period in the target complete day based on the reference data of the target complete day; wherein the water use coefficient for any time period is equal to the ratio of the average value of the reference data for that time period in the target complete day to the average value of the reference data for all time periods in the target complete day; the target complete day includes several complete days; Calculate the water consumption data for the missing time period of the missing day based on the water consumption coefficient for each time period of the target complete day and the average value of the reference data for all time periods of the target complete day; The total water consumption data for the missing day is supplemented according to the water consumption data for the missing period of the missing day.
2. The method for completing community water consumption data based on time period compensation according to claim 1, characterized in that: The water use data of the missing time period of the missing day is calculated based on the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day, including: If the first correlation coefficient between the existing data of the missing day and the water use coefficient of the corresponding time period is greater than or equal to the first threshold, the water use data of the missing time period of the missing day is calculated according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; If the first correlation coefficient between the existing data of the missing day and the water usage coefficient of the corresponding time period is less than a first threshold, the water usage curve of the missing day is fitted according to the existing data of the missing day, and the water usage data of the missing time period of the missing day is calculated based on the water usage curve.
3. The method for completing community water consumption data based on time period compensation according to claim 1, characterized in that: Also includes: If the sampling period of the total water consumption data of the community for multiple complete days is greater than or equal to the preset time length, the sampling period is determined as the interval time; If the sampling period of the total water consumption data of the community for a plurality of complete days is less than a preset time length, the preset time length is determined as the interval time.
4. The method for completing community water consumption data based on time period compensation as claimed in claim 3, characterized in that: Also includes: In a specified time period of each complete day, the preset duration is determined as a first duration; In other time periods of each complete day, the preset duration is determined as the second duration; the other time periods are time periods other than the designated time period in each complete day, and the first duration is greater than the second duration.
5. The method for completing community water consumption data based on time period compensation according to claim 1, characterized in that: Before dividing each complete day into multiple time periods according to a preset interval time and extracting the water consumption data of each time period in each complete day, the method further includes: Based on the total water use data for a complete day, extract the time series data of water use quantity, time series data of water use time, and time series data of water use frequency; Processing the time series data of water consumption based on the first neural network to extract the first feature in the time dimension; The time series data of water use time and the time series data of water use frequency are processed based on the second neural network, and the long-term dependency relationship in the time series is extracted to obtain the second feature; Fusing the first feature and the second feature to obtain a fused feature; Performing cluster analysis on the fusion features, and obtaining abnormal data in the total water usage data based on the cluster analysis results; The abnormal data is deleted from the total water consumption data.
6. The method for completing community water consumption data based on time period compensation as claimed in claim 5, characterized in that: The first neural network is a convolutional neural network, and the method for completing community water consumption data based on time period compensation further includes: The water use time series data is divided into a first data set, a second data set and a third data set; the first data set is a data set containing the water use time series data on weekdays, the second data set is a data set containing the water use time series data on weekends, and the third data set is a data set containing the water use time series data on designated holidays; the water use time series includes the time series data of water use amount, the time series data of water use time and the time series data of water use frequency; When processing the first type of data in the first data set based on the first neural network, the size of the convolution kernel of the first neural network is set to a first value; the first type of data is time series data of water consumption; When processing the first type of data in the second data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a second value; When processing the first type of data in the third data set based on the first neural network, setting the size of the convolution kernel of the first neural network to a third value; The first value, the second value and the third value increase sequentially.
7. The method for completing community water consumption data based on time period compensation according to claim 6, characterized in that: The second neural network is a long short-term memory network, and the method for completing the water consumption data of a residential area based on time period compensation further includes: When processing the second type of data of the first data set based on the second neural network, the number of hidden layers of the second neural network is set to a first number; the first type of data includes time series data of water use time and time series data of water use frequency; When processing the second type of data of the second data set based on the second neural network, setting the number of hidden layers of the second neural network to a second number; When processing the second type of data of the third data set based on the second neural network, setting the number of hidden layers of the second neural network to a third number; The first number, the second number, and the third number increase sequentially.
8. A device for completing water consumption data of a residential area based on time period compensation, characterized in that: include: A data acquisition unit, used to acquire total water use data of a community; the total water use data of the community includes total water use data of multiple missing days and total water use data of multiple complete days, wherein the missing days are water use dates with missing data, and the complete days are water use dates other than the missing days; A data extraction unit, used to divide each complete day into multiple time periods according to a preset interval time, and extract the water consumption data of each time period in each complete day to obtain reference data of multiple complete days; A first calculation unit is used to calculate the water use coefficient of each time period in the target complete day according to the reference data of the target complete day; wherein the water use coefficient of any time period is equal to the ratio of the average value of the reference data of the time period in the target complete day to the average value of the reference data of all time periods in the target complete day; the target complete day includes a plurality of complete days; The second calculation unit is used to calculate the water use data of the missing time period of the missing day according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; The data completion unit is used to complete the total water consumption data of the missing day according to the water consumption data of the missing time period of the missing day.
9. The device for completing community water consumption data based on time period compensation according to claim 8, characterized in that: The second computing unit is specifically used for: If the first correlation coefficient between the existing data of the missing day and the water use coefficient of the corresponding time period is greater than or equal to the first threshold, the water use data of the missing time period of the missing day is calculated according to the water use coefficient of each time period of the target complete day and the average value of the reference data of all time periods of the target complete day; If the first correlation coefficient between the existing data of the missing day and the water usage coefficient of the corresponding time period is less than a first threshold, the water usage curve of the missing day is fitted according to the existing data of the missing day, and the water usage data of the missing time period of the missing day is calculated based on the water usage curve.
10. The device for completing community water consumption data based on time period compensation according to claim 8, characterized in that: The data extraction unit is specifically used for: If the sampling period of the total water consumption data of the community for multiple complete days is greater than or equal to the preset time length, the sampling period is determined as the interval time; If the sampling period of the total water consumption data of the community for a plurality of complete days is less than a preset time length, the preset time length is determined as the interval time.
Citation Information
Patent Citations
Industrial and commercial tenant clustering method based on time sequence water consumption data
CN113205368A
Method and system for supplementing missing data of water meter of user
CN115809237A
Method and system for analyzing total water flow data of community
CN116415123A
Intelligent early warning method and system for urban flood control
CN117010726A
Community water consumption total data cleaning method and device, terminal equipment and storage medium
CN117370331A