Intelligent Acquisition System for Gas Meter Data Based on Machine Learning
By acquiring the activity level and historical evaluation index of gas data, the DBSCAN algorithm parameters are adaptively set, and the problem of inaccurate clustering results in the gas meter data acquisition system is solved, and more accurate sampling frequency adjustment and system load optimization are achieved.
Patent Information
- Application Number
- CN202510607673.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-05-13
- Publication Date
- 2025-08-05
- Estimated Expiration
- 2045-05-13
AI Technical Summary
In the existing gas meter data acquisition system, the clustering radius and minimum number of points of the DBSCAN algorithm are artificially set to inaccurate clustering results, resulting in deviations in adaptive sampling frequency adjustment, increasing the system processing load and redundant data.
By obtaining the gas usage activity and historical activity evaluation index in the gas data sequence, the clustering radius and minimum number of points in the DBSCAN algorithm are adaptively set, and multiple cluster clusters are obtained. The sampling frequency of the gas data is adjusted according to the clustering results.
More accurate gas data sampling frequency adjustment is achieved, reducing redundant data, reducing system load, and retaining effective gas usage information.
Smart Images

Figure CN120180165B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of natural gas technology, and in particular to a gas meter data intelligent collection system based on machine learning. Background Art
[0002] Existing IoT-enabled gas meters can automatically collect meter data and transmit it over the internet, greatly increasing user convenience. However, traditional gas meter data collection often occurs at a fixed interval (i.e., a fixed sampling frequency). This high frequency sampling method often results in high storage overhead and heavy processing load.
[0003] Existing technology uses a clustering algorithm (DBSCAN) to analyze the relationship between user behavior and time in historical usage records (gas meter data). This algorithm then divides the user's historical usage records (gas meter data) into multiple clusters, each representing a specific degree of gas usage. The sampling frequency of the user's gas meter data is then adaptively adjusted based on the cluster, resulting in an adaptive sampling frequency. However, the cluster radius R and the minimum number of points MinPts in the DBSCAN algorithm are manually set and susceptible to human intervention, leading to inaccurate clustering results, significant deviations in the adaptive sampling frequency adjustment, and the generation of redundant data, which increases the system processing load.
[0004] Therefore, how to set the clustering radius and minimum number of points in the DBSCAN algorithm to improve the accuracy of adjusting the sampling frequency of user gas meter data has become an urgent problem to be solved. Summary of the Invention
[0005] In view of this, an embodiment of the present invention provides a gas meter data intelligent collection system based on machine learning to solve the problem of how to set the neighborhood radius and minimum number of points in the DBSCAN algorithm to improve the accuracy of adjusting the sampling frequency of user gas meter data.
[0006] An embodiment of the present invention provides a gas meter data intelligent collection system based on machine learning, comprising a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when executing the computer program:
[0007] Obtain the target user's gas data at each sampling moment in the current cycle to obtain a gas data sequence;
[0008] For any gas data in the gas data sequence, the gas usage activity of the gas data is obtained based on the difference between the gas data and its neighboring gas data within a local range, and the historical activity evaluation index of the gas data is obtained based on the gas usage activity of historical gas data at the same time as the sampling time of the gas data within a historical period;
[0009] According to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence, setting the optimal clustering radius and the minimum number of points in the clustering algorithm, and clustering the gas data sequence according to the optimal clustering radius and the minimum number of points to obtain a plurality of clusters;
[0010] According to the gas usage activity of the gas data in each of the clusters, the gas data sampling frequency of the target user is adaptively obtained to collect the gas data of the target user in a next cycle after the current cycle.
[0011] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:
[0012] The present invention analyzes the gas data sequence of the target user in the current period to adaptively set the clustering radius and the minimum number of points during clustering, so that the parameters during clustering can be more closely aligned with the gas usage of the target user in the current period, thereby obtaining a more accurate clustering result. Furthermore, the sampling frequency of the target user's gas data in future periods is adaptively adjusted based on the clustering result, thereby realizing dynamic collection and adjustment of the target user's gas data, so that the sampling frequency is increased when the target user uses gas at a high frequency, and the sampling frequency is reduced when the target user uses gas at a low frequency, so as to avoid the occurrence of redundant data, reduce the system load processing, and retain the target user's effective gas usage information. BRIEF DESCRIPTION OF THE DRAWINGS
[0013] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are only some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0014] Figure 1 This is a method flow chart of a method for intelligently collecting gas meter data based on machine learning provided in Example 1 of the present invention;
[0015] Figure 2 This is an example diagram of a scatter plot provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0016] The embodiments of the present disclosure are described in detail below, and examples of the embodiments are shown in the accompanying drawings. The embodiments described below with reference to the accompanying drawings are exemplary and intended to be used to explain the present disclosure, but should not be understood as limiting the present disclosure.
[0017] It should be noted that the terms "first," "second," and the like in the specification of the present disclosure and the accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or precedence. It should be understood that the terms used in this manner are interchangeable where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure.
[0018] In order to illustrate the technical solution of the present invention, specific embodiments are provided below.
[0019] An embodiment of the present invention provides a gas meter data intelligent collection system based on machine learning, comprising a processor and a memory, wherein the processor executes a computer program stored in the memory to implement a gas meter data intelligent collection method based on machine learning, such as Figure 1 As shown, the gas meter data intelligent collection method based on machine learning includes the following steps:
[0020] Step S101: Obtain the gas data of the target user at each sampling moment in the current cycle to obtain a gas data sequence.
[0021] One of the users of an IoT-based gas meter is selected as the target user. A day is used as a cycle, with the i-th day as the current cycle. To analyze the target user's gas usage habits, the sampling frequency is set to once per minute. Gas data of the target user at each sampling moment on the i-th day is obtained and mapped to a gas data sequence in the time series. This is used for subsequent data feature distribution based on the new gas data sequence. The clustering radius and minimum number of points in the DBSCAN clustering algorithm are adaptively set. The sampling frequency of the target user's gas data is then adjusted based on the clustering results to reduce redundant data and reduce the system processing load.
[0022] Step S102: For any gas data in the gas data sequence, the gas usage activity of the gas data is obtained based on the difference between the gas data and the neighboring gas data within its local range, and the historical activity evaluation index of the gas data is obtained based on the gas usage activity of historical gas data at the same time as the sampling time of the gas data within the historical period.
[0023] Since changes in gas data are closely related to user usage habits and behavioral activities, gas data may change in different states during different time periods. Secondly, changes in gas meter gas data are generally due to gas usage. Therefore, gas usage is directly reflected in the data changes. Therefore, the gas data in the embodiment of the present invention includes gas usage and remaining gas, that is, two-dimensional monitoring data of the gas meter is collected at a sampling time. This is not limited here, and parameters such as the cumulative gas usage and unit gas usage of the gas meter can also be collected.
[0024] Since the clustering data in the DBSCAN clustering algorithm is at least two-dimensional data, in an embodiment of the present invention, each gas data in the gas data sequence is taken as a cluster sample, and two attribute parameters of each cluster sample are obtained according to the change of the gas data in the gas data sequence to construct a two-dimensional clustering space of the gas data sequence.
[0025] Taking any gas data in the gas data sequence as an example, for the first attribute parameter of any gas data, we can obtain the gas usage fluctuation at the corresponding sampling time of any gas data based on the gas usage of any gas data on the i-th day, which is the gas usage activity of any gas data. The specific process is as follows:
[0026] In the gas data sequence, taking the any gas data as the center, a gas data subsequence of a preset length is obtained, the standard deviation of all gas usage in the gas data subsequence is calculated, and the degree of fluctuation stability of the any gas data is obtained based on the inverse of the sum of the standard deviation and a constant 1;
[0027] Obtaining the previous gas data of any gas data in the gas data sequence, calculating the absolute value of the difference in gas remaining amount between the any gas data and the previous gas data, and obtaining the degree of stability of change of the any gas data according to the reciprocal of the sum of the absolute value of the difference and a constant 1;
[0028] An average value between the fluctuation stability and the change stability is calculated, and the gas usage activity of any gas data is obtained according to a difference between a constant 1 and the average value.
[0029] In one embodiment, to prevent the data change of any gas data from being reduced due to the length of the gas data subsequence being too long, or to prevent the data change of any gas data from being unable to be reflected due to the length of the gas data subsequence being too short, a gas data subsequence is formed with the five gas data adjacent to it on the left and right, with any gas data as the center. The calculation formula for the gas usage activity of any gas data is:
[0030]
[0031] in, Indicates the gas usage activity of any gas data x, 1 represents a constant, Represents the standard deviation of all gas usage in the gas data subsequence of any gas data x, Indicates the absolute value of the difference in the remaining gas amount between any gas data x and any gas data x-1.
[0032] It should be noted that The larger the value of , the greater the fluctuation of gas usage in the gas data subsequence, indicating that the target user uses gas frequently. In other words, the smaller the stability of any gas data x, the greater the gas usage activity of any gas data x. The larger the value, the greater the difference in gas usage status between any gas data x and any gas data x-1, and the gas usage is in an active stage. In other words, the smaller the stability of the change of any gas data x, the greater the gas usage activity of any gas data x.
[0033] After obtaining the gas usage activity of any gas data, for the second attribute parameter of any gas data, considering the regularity of user behavior habits, the historical daily gas usage activity of some cluster samples will remain consistent or similar. However, due to the uncontrollable nature of user behavior, there will be some occasional usage, and the longer the time, the higher the possibility of changes or variations in the corresponding user's behavior habits. Therefore, in this embodiment of the present invention, the gas data of the most recent few days is used as the main analysis object to analyze the gas usage activity of any gas data at the sampling time corresponding to the gas data in the past day, and then use it as the historical activity evaluation index of any gas data. The specific process is as follows:
[0034] Take the past 5 days as the historical period, and based on the sampling time corresponding to any gas data, obtain the gas data at the same sampling time every day in the past as the historical gas data. Refer to the method for obtaining the gas usage activity of any gas data mentioned above to obtain the gas usage activity of each historical gas data;
[0035] According to the interval period between each historical period and the current period, the weight corresponding to each historical period is obtained. The smaller the interval period, the larger the corresponding weight. According to the weight corresponding to each historical period, the gas usage activity of all historical gas data is weightedly summed to obtain the historical activity evaluation index of any gas data.
[0036] In one embodiment, the calculation formula for the weight corresponding to the t-th historical period is:
[0037]
[0038] in, represents the weight corresponding to the t-th historical period, represents the normalization function, Indicates the i-th day, which is the current cycle, represents the t-th historical period, Represents the interval between the tth historical period and the current period, and 1 represents a constant.
[0039] It should be noted that the longer the interval period, the lower the reference value of the historical gas data of the corresponding historical period and the smaller the corresponding weight.
[0040] The calculation expression of the historical activity evaluation index of any gas data x is:
[0041]
[0042] in, represents the historical activity evaluation index of any gas data x, N represents the number of historical cycles, represents the weight corresponding to the t-th historical period, Indicates the gas usage activity of historical gas data in the t-th historical period.
[0043] It should be noted that The larger the value, the more active the target user is in gas usage at the same time on multiple historical days.
[0044] At this point, the gas usage activity and historical activity evaluation index of any gas data are obtained. Similarly, the gas usage activity and historical activity evaluation index of each gas data in the gas data sequence are obtained.
[0045] Step S103: setting an optimal clustering radius and a minimum number of points in a clustering algorithm according to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence; clustering the gas data sequence according to the optimal clustering radius and the minimum number of points to obtain a plurality of clusters.
[0046] After obtaining the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence, a scatter plot is constructed with the gas usage activity as the vertical axis and the historical activity evaluation index as the horizontal axis, and according to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence, a scatter point corresponding to each gas data in the gas data sequence is mapped in the scatter plot.
[0047] Since users' gas usage status varies in different time periods, gas data will show phased characteristics, which are reflected as regional clustering in the scatter plot. Therefore, the clustering radius in the DBSCAN clustering algorithm can be set according to the influence degree and distribution characteristics between the scattered points in the scatter plot, which is the optimal clustering radius that meets the target user. The method for obtaining the optimal clustering radius is:
[0048] (1) For any scattered point in the scatter plot, the relative neighborhood radius of any scattered point is obtained according to the Euclidean distance, gas usage activity difference and historical activity evaluation index difference between the scattered point and each other scattered point.
[0049] Specifically, each scatter point in the scatter plot other than the any scatter point is regarded as another scatter point. For any other scatter point, the absolute value of the difference between the gas usage activity of the any other scatter point and the historical activity evaluation index is calculated, and the reciprocal of the absolute value of the difference is used as a first probability that the any scatter point is not an isolated point. The absolute value of the difference between the gas usage activity of the any other scatter point and the historical activity evaluation index is calculated, and the reciprocal of the absolute value of the difference is used as a second probability that the any other scatter point is not an isolated point.
[0050] Using the reciprocal of the absolute value of the difference between the first probability and the second probability as the state similarity between the any scatter point and the any other scatter point, obtaining the Euclidean distance between the any scatter point and the any other scatter point, and obtaining the correlation coefficient between the any scatter point and the any other scatter point based on the average of the reciprocal of the Euclidean distance and the state similarity;
[0051] According to all correlation coefficients corresponding to any scatter point, a correlation coefficient threshold corresponding to the any scatter point is obtained, other scatter points corresponding to correlation coefficients greater than or equal to the correlation coefficient threshold are used as reference scatter points for the any scatter point, and the maximum Euclidean distance between the any scatter point and each of the reference scatter points is obtained as the relative neighborhood radius of the any scatter point.
[0052] In one embodiment, taking the jth scatter point as an example, the scatter point is close to some scatter points in the scatter plot, and some scatter points are far away from it. The scatter points with closer distances may have an associated relationship with the scatter point. Then, the calculation expression of the correlation coefficient between the jth scatter point and each other scatter point is:
[0053]
[0054] in, Indicates the number of correlations between the jth scattered point and the bth other scattered points, represents the Euclidean distance between the jth scattered point and the bth other scattered points, represents the historical activity evaluation index of the j-th scatter point, represents the gas usage activity of the j-th scattered point, represents the historical activity evaluation index of the b-th scatter point, represents the gas usage activity of the b-th scattered point, and || represents the absolute value symbol.
[0055] It should be noted that The larger the value of , the greater the difference between the jth scattered point and the historical gas data, and the more likely it is to become an isolated point. Therefore, using Characterizes the first probability that the jth scattered point is not an isolated point. Similarly, The second probability used to characterize that the bth scattered point is not an isolated point, The greater the difference between them, the more dissimilar the gas usage status between the two scattered points is, and the smaller the correlation coefficient between them is. At the same time, the smaller the Euclidean distance between them is, the greater the probability that the two scattered points belong to the same cluster, and the larger the corresponding correlation coefficient is.
[0056] Similarly, the correlation coefficient between the jth scatter point and each other scatter point is obtained, and based on the correlation coefficient between the jth scatter point and each other scatter point, a statistical histogram of all correlation coefficients is constructed, where the horizontal axis of the statistical histogram is the correlation coefficient and the vertical axis is the number of correlation coefficients. According to the characteristics of cluster distribution, members of the same cluster are concentrated, while non-cluster members are dispersed. Therefore, the correlation coefficient between the jth scatter point and other scatter points will show a two-level performance, with some correlation coefficients increasing and some correlation coefficients decreasing, and there may be a gap in the correlation coefficient in the middle. Therefore, the correlation coefficient interval in which the number of statistical correlation coefficients in the statistical histogram is continuously 0 is obtained, and the middle value in the maximum correlation coefficient interval is used as the correlation coefficient threshold corresponding to the jth scatter point.
[0057] After obtaining the correlation coefficient threshold of the jth scatter point, the correlation coefficient between the jth scatter point and each other scatter point is compared with the correlation coefficient threshold respectively, and other scatter points with correlation coefficients greater than or equal to the correlation coefficient threshold are obtained as reference scatter points of the jth scatter point. These reference scatter points constitute the neighborhood of the jth scatter point, and then the maximum Euclidean distance is obtained from the Euclidean distances between the jth scatter point and each reference scatter point as the relative neighborhood radius of the jth scatter point.
[0058] Similarly, refer to the method for obtaining the relative neighborhood radius of the j-th scatter point to obtain the relative neighborhood radius of each scatter point in the scatter plot.
[0059] (2) Obtaining the relative neighborhood radius of each scattered point in the scatter plot, and selecting the best relative neighborhood radius from all relative neighborhood radii as the best clustering radius in the clustering algorithm.
[0060] Specifically, a radius interval consisting of all relative neighborhood radii is obtained, the radius interval is divided into a preset number of subintervals, the number of scattered points corresponding to the relative neighborhood radius contained in each subinterval is counted, and the proportion of the number of scattered points corresponding to each subinterval in the total number of scattered points is used as the frequency of each relative neighborhood radius contained in the corresponding subinterval;
[0061] For any relative neighborhood radius, a circular area is constructed with the scattered points corresponding to each other relative neighborhood radius as the center of the circle and the other relative neighborhood radius as the radius of the circle; the number of circular areas containing the scattered points corresponding to the any relative neighborhood radius is counted as the number of occurrences of the scattered points of the any relative neighborhood radius; and the preferred evaluation value of the any relative neighborhood radius is obtained based on the product of the number of occurrences of the scattered points of the any relative neighborhood radius and the frequency;
[0062] Obtain a preferred evaluation value for each relative neighborhood radius, and take the relative neighborhood radius corresponding to the largest preferred evaluation value as the optimal relative neighborhood radius.
[0063] In one embodiment, 10 is used as the basic interval division number, and the radius interval composed of all relative neighborhood radii is divided into subintervals according to the difference between the relative neighborhood radii. For example, if the minimum value of the relative neighborhood radius is 10.6 and the maximum value of the relative neighborhood radius is 16.3, the size of the subinterval is set to If the difference is too large, it can be appropriately increased by a multiple of 10.
[0064] Since the cluster center is the easiest to find, we can analyze each scattered point and find the scattered point with the most dense distribution and the most likely to become the cluster center. The relative neighborhood radius of this scattered point is most likely to be the appropriate cluster radius. Therefore, the scattered points corresponding to the relative neighborhood radius contained in each sub-interval are taken as the quantity value of the sub-interval, and the proportion of the quantity value corresponding to each sub-interval in the number of all scattered points is taken as the frequency of each relative neighborhood radius contained in the corresponding sub-interval.
[0065] At the same time, the number of times each scattered point appears in the relative neighborhood area of the remaining scattered points is calculated. That is, with the remaining scattered points as the center of the circle and the relative neighborhood radius of the remaining scattered points as the radius of the circle, when constructing the circular area, the number of times the selected scattered point (target scattered point) appears in these circular areas is taken as the number of scatter point appearances corresponding to the relative neighborhood radius.
[0066] Therefore, taking the kth relative neighborhood radius as an example, the calculation expression of the kth relative neighborhood radius as the optimal evaluation value of the optimal relative neighborhood radius is:
[0067]
[0068] in, represents the optimal evaluation value of the kth relative neighborhood radius, represents the frequency of the kth relative neighborhood radius, Indicates the number of occurrences of the k-th scattered point relative to the neighborhood radius.
[0069] It should be noted that if the frequency of the relative neighborhood radius is large and the number of corresponding scattered points is large, the preferred evaluation value of the relative neighborhood radius is larger. The larger the preferred evaluation value, the more likely the relative neighborhood radius is to be the cluster radius of the cluster center.
[0070] Similarly, obtain the priority evaluation value of each relative neighborhood radius, take the relative neighborhood radius corresponding to the largest preferred evaluation value as the optimal relative neighborhood radius, and then take the optimal relative neighborhood radius as the optimal clustering radius when clustering all scattered points in the scatter plot.
[0071] Furthermore, after obtaining the optimal clustering radius, the minimum number of points MinPts in the DBSCAN clustering algorithm is set according to the scatter density distribution within the neighborhood range corresponding to the optimal clustering radius. Due to differences in user habits, the scatter plot may not necessarily show multiple obvious clusters, but may also show other characteristics. For example, when users maintain consistent gas usage habits every day, the gas usage activity of most scattered points is consistent with the historical activity evaluation index, showing Figure 2 The scatter distribution is shown.
[0072] Since the scatter plot may contain discrete points, the discrete points will affect the judgment results when analyzing user behavior habits. Secondly, when clustering, a standard cluster should have the characteristics of dense distribution of cluster members and no obvious discrete points within the cluster. Therefore, if the minimum number of points in the cluster is too small, it is easy to make the discrete points become pseudo clusters, affecting the judgment results. However, for Figure 2 If the minimum number of points is too large, it is easy to cause the real cluster to be divided into noise. In this embodiment of the present invention, the minimum number of points MinPts in the DBSCAN clustering algorithm is obtained according to the optimal clustering radius obtained above and the scatter point distribution in the scatter plot.
[0073] First, determine whether the scatter distribution in the scatter plot meets the requirements. Figure 2 The distribution in the graph is to determine whether the user's gas usage habits are consistent every day. Then, based on the judgment result, the minimum number of points when performing DBSCAN clustering on the scatter plot is adaptively obtained. The specific process is as follows:
[0074] The scatter point corresponding to the optimal clustering radius is used as the target scatter point. A sliding window is constructed with the target scatter point as the center and the optimal clustering radius as the side length. The sliding window is used to partition the scatter plot into regions, obtaining multiple scatter regions containing scatter points. The size of the scatter region is the same as the size of the sliding window, while regions without scatter points are ignored. Each scatter region is then analyzed. For each scatter region, the region center of the region is obtained. The distance between each scatter point in the region and the region center is obtained, and the scatter point with the minimum distance is used as the central scatter point of the region.
[0075] Similarly, the central scatter point of each scatter plot region is obtained, and a straight line is fitted to all central scatter points in the scatter plot to obtain a fitted line and the corresponding line slope. Based on the fitted line, a fitted value for the gas usage activity of each central scatter point is obtained. The difference between the gas usage activity of each central scatter point and the corresponding fitted value is calculated to obtain the mean of the differences. The inverse of the mean of the differences is used as the distribution uniformity indicator of the central scatter points. It should be noted that the least squares method is used for straight line fitting, and this method is a state of the art and will not be described in detail here.
[0076] According to experimental statistics, the distribution uniformity index threshold is set to 0.8. If the distribution uniformity index of the central scatter point is greater than or equal to the preset distribution uniformity index threshold, it means that the scatter point distribution in the scatter plot meets the requirements. Figure 2 The scatter point distribution in the graph reflects that the target user's gas usage habits remain consistent every day, and the probability of isolated points is low. Therefore, the number of scatter points in each scatter point area is counted to obtain the maximum number of scatter points, and the data dimension corresponding to the scatter plot is used as the scatter point number threshold, that is, the scatter point number threshold is 2, and the scatter point areas with a scatter point number less than or equal to 2 are deleted.
[0077] In order to prevent the real cluster from being divided into noise, the minimum number of points is obtained according to the uniformity of the scatter point distribution in the remaining scatter point area. The acquisition method is as follows: based on the number of scatter points in each remaining scatter point area, a standard deviation analysis is performed on the number of scatter points greater than 2 to obtain the standard deviation of the number of scatter points; the absolute value of the difference between the reciprocal of the standard deviation of the number of scatter points and the constant 1 is calculated to obtain the product between the absolute value of the difference and the maximum number of scatter points, the product is used as the point adjustment amount, and the difference between the maximum number of scatter points and the point adjustment amount is rounded down to obtain the minimum number of points in the clustering algorithm.
[0078] In one embodiment, the minimum number of points is calculated as follows:
[0079]
[0080] in, Indicates the minimum number of points, Indicates the maximum number of scattered points, Indicates the standard deviation of the number of scattered points in all scatter areas after excluding the scatter areas with the number of scattered points less than or equal to the scatter point threshold. 1 represents a constant.
[0081] It should be noted that Indicates the uniformity of the scatter point distribution in each scatter point area. If the scatter point distribution in each scatter point area is relatively uniform, the minimum number of points can be close to the number of scatter points in the scatter point area with the most scatter points. If the scatter point distribution in each scatter point area is uneven, in order to ensure that the real clusters are not classified as noise, the minimum number of points needs to be set smaller. Therefore, the minimum number of points can be significantly different from the number of scatter points in the scatter point area with the most scatter points.
[0082] If the distribution uniformity index of the central scatter point is less than the preset distribution uniformity index threshold, it means that the distribution of the scatter points in the scatter plot does not meet the requirements. Figure 2 The scatter point distribution in the scatter plot needs to obtain the minimum number of points according to the distribution of isolated points in the scatter plot. The specific acquisition method is: obtain the probability that each scattered point in the scatter plot is an isolated point, screen and obtain at least one suspected isolated point, obtain the circular area of each suspected isolated point, count the number of suspected isolated points in the circular area of each suspected isolated point, obtain the maximum number of suspected isolated points and the mean number of suspected isolated points; calculate the difference between the constant 1 and the reciprocal of the mean number of suspected isolated points, obtain the product of the difference and the total number of suspected isolated points in the scatter plot, use the product as the point adjustment amount, round up the sum of the maximum number of suspected isolated points and the point adjustment amount, and obtain the minimum number of points in the clustering algorithm.
[0083] In one embodiment, the probability of each scattered point being an isolated point is obtained based on the historical activity evaluation index and gas usage activity corresponding to each scattered point in the scatter plot, and the calculation expression is: Since isolated points are accidental phenomena, a histogram is constructed for the probability of all scattered points being isolated points. The horizontal axis of the histogram is probability, and the vertical axis is the number of probabilities. Since there will be obvious low-frequency probabilities in the histogram, through experimental calculation and statistics, it can be obtained that the probability of obvious low frequency is in the range of 0.2. Therefore, the probability threshold is set to 0.2, and scattered points with an isolated point probability lower than 0.2 are regarded as suspected isolated points. At this point, at least one suspected isolated point is obtained in the scatter plot.
[0084] According to the above circular area construction method, the circular area of each suspected isolated point is obtained, and the minimum number of points is obtained according to the distribution of suspected isolated points in each circular area. The calculation formula for the minimum number of points is:
[0085]
[0086] in, Indicates the minimum number of points, represents the maximum number of suspected isolated points, H represents the number of suspected isolated points, It represents the number of suspected isolated points in the circular area of the vth suspected isolated point, and 1 represents a constant.
[0087] It should be noted that Characterizes the mean number of suspected isolated points in the area composed of all suspected isolated points. The larger the mean, the denser the distribution of suspected isolated points, and the larger the minimum number of points required. Conversely, the smaller the mean, the more discrete the distribution of suspected isolated points, and the smaller the minimum number of points required.
[0088] At this point, the optimal clustering radius and the minimum number of points when performing DBSCAN clustering on all the scattered points in the scatter plot are obtained. Then, based on the optimal clustering radius and the minimum number of points, the gas data series (that is, all the scattered points in the scatter plot) are clustered to obtain multiple clusters. Among them, DBSCAN clustering belongs to the existing technology and will not be repeated here.
[0089] Step S104 : adaptively acquiring the gas data sampling frequency of the target user according to the gas usage activity of the gas data in each cluster, so as to collect the gas data of the target user in a next cycle after the current cycle.
[0090] After clustering all the scattered points in the scatter plot to obtain multiple clusters, considering that each cluster represents the gas usage of the target user at different time periods on the i-th day, and secondly, each scatter point in the cluster corresponds to a gas data in the gas data sequence, therefore, according to the gas usage activity of the gas data in each of the clusters, the gas data sampling frequency of the target user is adaptively obtained to collect the gas data of the i+1-th day using the gas data sampling frequency.
[0091] The method of adaptively obtaining the gas data sampling frequency of the target user according to the gas usage activity of the gas data in each cluster includes:
[0092] (1) The cluster containing the most gas data is obtained as the target cluster, and the mean gas usage activity is obtained according to the gas usage activity corresponding to each gas data in the target cluster. The diversity index is obtained according to the difference between a constant 1 and the inverse of the number of clusters, and the sum of the mean gas usage activity and the diversity index is used as the gas usage activity status representation value of the target user in the current period.
[0093] In one embodiment, the calculation expression of the target user's gas usage activity status representation value on day i is:
[0094]
[0095] in, represents the target user’s gas usage activity status on day i, K represents the number of gas data in the target cluster, Indicates the gas usage activity corresponding to the k-th gas data in the target cluster, 1 represents a constant, and CN represents the number of clusters.
[0096] It should be noted that The larger the value of is, the more target users use gas and the more active they are in using gas. is a diversity indicator. The larger its value is, the more clusters there are. It means that the target user may have different degrees of gas usage habits. The larger the value representing the target user's gas usage activity on the i-th day is.
[0097] (2) According to the gas usage activity of each gas data in the gas data sequence, the difference between the number of gas data with a gas usage activity of 0 and the number of gas data with a gas usage activity not of 0 is used as the sampling frequency modification value.
[0098] (3) Similarly, according to the above method for obtaining the target user's gas usage activity status characterization value on day i, the target user's historical gas usage activity status characterization value in the previous cycle (i.e., day i-1) is obtained. If the gas usage activity status characterization value is greater than or equal to the historical gas usage activity status characterization value, the difference between the constant 1 and the gas usage activity mean is calculated, and the average value between the difference and the inverse of the number of clusters is calculated. The product of the average value and the sampling frequency modification value is obtained, and the sampling frequency in the current cycle is added to the product value to obtain the gas data sampling frequency of the target user.
[0099] In one embodiment, the calculation expression of the target user's gas data sampling frequency is:
[0100]
[0101] in, Indicates the gas data sampling frequency of the target user, that is, the gas data sampling frequency of the i+1th day. Indicates the sampling frequency in the current cycle, that is, the gas data sampling frequency of the i-th day, and G indicates the sampling frequency modification value.
[0102] It should be noted that the target user's gas usage activity status characterization value on day i is greater than the gas usage activity status characterization value on day i-1, indicating that the target user's gas usage has an increasing trend. The frequency of gas data collection on day i+1 should be increased to more efficiently detect the target user's gas usage habits on day i+1.
[0103] (4) If the gas usage activity state characterization value is less than the historical gas usage activity state characterization value, the difference between the constant 1 and the mean value of the gas usage activity is calculated, the average value between the difference and the inverse of the number of clusters is calculated, the multiplication value between the average value and the sampling frequency modification value is obtained, and the sampling frequency in the current period is subtracted from the multiplication value to obtain the gas data sampling frequency of the target user.
[0104] In one embodiment, the calculation expression of the target user's gas data sampling frequency is:
[0105]
[0106] in, Indicates the gas data sampling frequency of the target user, that is, the gas data sampling frequency of the i+1th day. Indicates the sampling frequency in the current cycle, that is, the gas data sampling frequency of the i-th day, and G indicates the sampling frequency modification value.
[0107] At this point, based on the target user's gas data sequence collected on day i, the target user's gas data sampling frequency on day i+1 is adaptively obtained. The target user's gas data sampling frequency on day i+1 can then be used to collect and store the target user's gas data, avoiding data redundancy and reducing system processing load. Similarly, for each user using an IoT-based gas meter, the user's daily gas data sampling frequency can be adaptively obtained for gas data collection.
[0108] The above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit the same. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. These modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention, and should all be included in the scope of protection of the present invention.
Claims
1. The gas meter data intelligent collection system based on machine learning is characterized by: The system comprises a memory, a processor, and a computer program stored in the memory and running on the processor, wherein the processor implements the following steps when executing the computer program: Obtain the target user's gas data at each sampling moment in the current cycle to obtain a gas data sequence; For any gas data in the gas data sequence, the gas usage activity of the gas data is obtained based on the difference between the gas data and its neighboring gas data within a local range, and the historical activity evaluation index of the gas data is obtained based on the gas usage activity of historical gas data at the same time as the sampling time of the gas data within a historical period; According to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence, setting the optimal clustering radius and the minimum number of points in the clustering algorithm, and clustering the gas data sequence according to the optimal clustering radius and the minimum number of points to obtain a plurality of clusters; Adaptively obtaining a gas data sampling frequency of the target user based on the gas usage activity of the gas data in each cluster, so as to collect the gas data of the target user in a next cycle after the current cycle; The step of setting the optimal clustering radius and the minimum number of points in the clustering algorithm according to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence includes: A scatter plot is constructed with gas usage activity as the vertical axis and the historical activity evaluation index as the horizontal axis. According to the gas usage activity and the historical activity evaluation index of each gas data in the gas data sequence, a scatter point corresponding to each gas data in the gas data sequence is mapped on the scatter plot; For any scatter point in the scatter plot, obtain a relative neighborhood radius of the scatter point based on the Euclidean distance, gas usage activity difference, and historical activity evaluation index difference between the scatter point and each other scatter point; obtain the relative neighborhood radius of each scatter point in the scatter plot, and select the best relative neighborhood radius from all relative neighborhood radii as the best clustering radius in the clustering algorithm; Taking the scattered point corresponding to the optimal clustering radius as the target scattered point, constructing a sliding window with the target scattered point as the center and the optimal clustering radius as the side length, and using the sliding window to divide the scatter plot into regions to obtain multiple scattered point regions containing scattered points, wherein the size of the scatter point region is the same as the size of the sliding window; For any scattered point area, obtain the area center of any scattered point area, obtain the distance between each scattered point in any scattered point area and the area center, take the scattered point corresponding to the minimum distance as the central scattered point of any scattered point area, and obtain the minimum number of points in the clustering algorithm based on the distribution characteristics of the central scattered points of all scattered point areas.
2. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: The gas data includes gas usage and gas remaining. The gas usage activity of any gas data is obtained based on the difference between any gas data and its neighboring gas data within a local range, including: In the gas data sequence, taking the any gas data as the center, a gas data subsequence of a preset length is obtained, the standard deviation of all gas usage in the gas data subsequence is calculated, and the degree of fluctuation stability of the any gas data is obtained based on the inverse of the sum of the standard deviation and a constant 1; Obtaining the previous gas data of any gas data in the gas data sequence, calculating the absolute value of the difference in gas remaining amount between the any gas data and the previous gas data, and obtaining the degree of stability of change of the any gas data according to the reciprocal of the sum of the absolute value of the difference and a constant 1; An average value between the fluctuation stability and the change stability is calculated, and the gas usage activity of any gas data is obtained according to a difference between a constant 1 and the average value.
3. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: The obtaining of a historical activity evaluation index of any gas data according to the gas usage activity of the historical gas data at the same time as the sampling time of the any gas data within the historical period includes: According to the interval period between each historical period and the current period, the weight corresponding to each historical period is obtained. The smaller the interval period, the larger the corresponding weight. According to the weight corresponding to each historical period, the gas usage activity of all historical gas data is weightedly summed to obtain the historical activity evaluation index of any gas data.
4. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: Obtaining the relative neighborhood radius of any scattered point based on the Euclidean distance, gas usage activity difference, and historical activity evaluation index difference between any scattered point and each other scattered point includes: Taking each scatter point in the scatter plot other than the any scatter point as another scatter point, for any other scatter point, calculating the absolute value of the difference between the gas usage activity of the any other scatter point and the historical activity evaluation index, and taking the reciprocal of the absolute value of the difference as a first probability that the any scatter point is not an isolated point; calculating the absolute value of the difference between the gas usage activity of the any other scatter point and the historical activity evaluation index, and taking the reciprocal of the absolute value of the difference as a second probability that the any other scatter point is not an isolated point; Using the reciprocal of the absolute value of the difference between the first probability and the second probability as the state similarity between the any scatter point and the any other scatter point, obtaining the Euclidean distance between the any scatter point and the any other scatter point, and obtaining the correlation coefficient between the any scatter point and the any other scatter point based on the average of the reciprocal of the Euclidean distance and the state similarity; According to all correlation coefficients corresponding to any scatter point, a correlation coefficient threshold corresponding to the any scatter point is obtained, other scatter points corresponding to correlation coefficients greater than or equal to the correlation coefficient threshold are used as reference scatter points for the any scatter point, and the maximum Euclidean distance between the any scatter point and each of the reference scatter points is obtained as the relative neighborhood radius of the any scatter point.
5. The gas meter data intelligent acquisition system based on machine learning according to claim 4 is characterized in that: The obtaining, based on all correlation coefficients corresponding to any scatter point, a correlation coefficient threshold corresponding to any scatter point, includes: Construct a statistical histogram of all correlation coefficients, where the horizontal axis of the statistical histogram is the correlation coefficient and the vertical axis is the number of correlation coefficients. In the statistical histogram, the correlation coefficient interval in which the number of statistical correlation coefficients is continuously 0 is obtained to obtain the maximum correlation coefficient interval, and the middle value in the maximum correlation coefficient interval is used as the correlation coefficient threshold corresponding to any scatter point.
6. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: The screening of the best relative neighborhood radius from all relative neighborhood radiuses as the best clustering radius in the clustering algorithm includes: Obtain a radius interval consisting of all relative neighborhood radii, divide the radius interval into a preset number of subintervals, count the number of scattered points corresponding to the relative neighborhood radius contained in each subinterval, and use the proportion of the number of scattered points corresponding to each subinterval in the total number of scattered points as the frequency of each relative neighborhood radius contained in the corresponding subinterval; For any relative neighborhood radius, a circular area is constructed with the scattered points corresponding to each other relative neighborhood radius as the center of the circle and the other relative neighborhood radius as the radius of the circle; the number of circular areas containing the scattered points corresponding to the any relative neighborhood radius is counted as the number of occurrences of the scattered points of the any relative neighborhood radius; and the evaluation value of the any relative neighborhood radius is obtained according to the product between the number of occurrences of the scattered points of the any relative neighborhood radius and the frequency; Obtain an evaluation value of each relative neighborhood radius, and take the relative neighborhood radius corresponding to the maximum evaluation value as the optimal relative neighborhood radius.
7. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: The step of obtaining the minimum number of points in the clustering algorithm according to the distribution characteristics of the central scattered points of all scattered point areas includes: Performing straight line fitting on all central scatter points in the scatter plot to obtain a fitted straight line and a corresponding straight line slope; obtaining a fitted value of the gas usage activity of each central scatter point based on the fitted straight line; calculating the difference between the gas usage activity of each central scatter point and the corresponding fitted value to obtain a mean of the differences; and using the reciprocal of the mean of the differences as a distribution uniformity indicator of the central scatter points; If the distribution uniformity index of the central scatter point is greater than or equal to a preset distribution uniformity index threshold, then counting the number of scatter points in each of the scatter point areas to obtain the maximum number of scatter points, and performing standard deviation analysis on the number of scatter points greater than the preset scatter point number threshold to obtain the standard deviation of the number of scatter points; Calculate the absolute value of the difference between the reciprocal of the standard deviation of the number of scattered points and a constant 1, obtain the product between the absolute value of the difference and the maximum number of scattered points, use the product as the point adjustment amount, round down the difference between the maximum number of scattered points and the point adjustment amount, and obtain the minimum number of points in the clustering algorithm.
8. The gas meter data intelligent acquisition system based on machine learning according to claim 7 is characterized in that: The step of obtaining the minimum number of points in the clustering algorithm based on the distribution characteristics of the central scattered points of all scattered point areas further includes: If the distribution uniformity index of the central scatter point is less than a preset distribution uniformity index threshold, then obtaining the probability that each scatter point in the scatter plot is an isolated point, screening to obtain at least one suspected isolated point, obtaining the circular area of each suspected isolated point, counting the number of suspected isolated points in the circular area of each suspected isolated point, and obtaining the maximum number of suspected isolated points and the mean number of suspected isolated points; Calculate the difference between the constant 1 and the reciprocal of the mean of the number of suspected isolated points, obtain the product of the difference and the total number of suspected isolated points in the scatter plot, use the product as the point number adjustment amount, round up the sum of the maximum number of suspected isolated points and the point number adjustment amount, and obtain the minimum number of points in the clustering algorithm.
9. The gas meter data intelligent acquisition system based on machine learning according to claim 1 is characterized in that: Adaptively obtaining the gas data sampling frequency of the target user according to the gas usage activity of the gas data in each cluster includes: The cluster containing the most gas data is obtained as the target cluster. The mean gas usage activity value is obtained based on the gas usage activity corresponding to each gas data in the target cluster. The diversity index is obtained based on the difference between a constant 1 and the inverse of the number of clusters. The sum of the mean gas usage activity value and the diversity index is used as the gas usage activity status representation value of the target user in the current period. Obtain a historical gas usage activity status representation value of the target user in the previous cycle, and based on the gas usage activity of each gas data in the gas data sequence, use the difference between the number of gas data with a gas usage activity of 0 and the number of gas data with a non-zero gas usage activity as a sampling frequency modification value; If the gas usage activity status characterization value is greater than or equal to the historical gas usage activity status characterization value, then the difference between a constant 1 and the mean gas usage activity value is calculated, and the average value of the difference and the inverse of the number of clusters is calculated. The product of the average value and the sampling frequency modification value is obtained, and the sampling frequency in the current period is added to the product value to obtain the gas data sampling frequency of the target user; If the gas usage activity status characterization value is less than the historical gas usage activity status characterization value, then the difference between the constant 1 and the mean gas usage activity is calculated, the average value between the difference and the inverse of the number of clusters is calculated, and the multiplication value between the average value and the sampling frequency modification value is obtained. The sampling frequency in the current period is subtracted from the multiplication value to obtain the gas data sampling frequency of the target user.
Citation Information
Patent Citations
Artificial intelligence energy-saving management method and system based on big data
CN117493921A
Communication integrated management and control system and method based on artificial intelligence
CN118965042A