Electricity stealing detection method, device, equipment and medium
Patent Information
- Application Number
- CN202610862899.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-06-15
- Publication Date
- 2026-10-09
AI Technical Summary
[0004]本发明实施例提供一种窃电检测方法、装置、设备及介质,以解决相关技术中固定阈值无法适配不同场景的技术问题
[0013]综上,本公开的窃电检测方法、装置、设备及介质,该方法包括:获取正常用电样本特征数据,并对正常用电样本特征数据进行统计分析,得到多个用电特征向量;对多个用电特征向量进行距离计算,得到平均距离分布,并对平均距离分布进行曲线拟合,得到历史距离分布曲线;基于历史距离分布曲线的拐点确定目标缩放系数,并基于目标缩放系数,对平均距离分布的标准差进行缩放,得到距离阈值修正参数;基于距离阈值修正参数和平均距离分布的均值,确定目标离群距离阈值;获取待分析用电特征数据,并基于多个用电特征向量和目标离群距离阈值,识别待分析用电特征数据对应的用电用户是否存在窃电风险,得到窃电检测结果。本方法通过对用电特征向量进行距离计算并拟合得到历史距离分布曲线,确定正常用电行为的距离分布规律;通过历史距离分布曲线的拐点确定目标缩放系数,将目标缩放系数结合平均距离分布的均值与标准差自适应生成目标离群距离阈值,提高了目标离群距离阈值对不同场景的适配性,从而进一步提高了窃电检测的准确率。
Smart Images

Figure CN122885565A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of power management technology, and in particular to a method, device, equipment and medium for detecting electricity theft. Background Technology
[0002] With the continuous advancement of smart grid construction, electricity information collection systems have achieved coverage of massive numbers of electricity users. Real-time collection of multi-dimensional electricity consumption data, such as voltage, current, and power, forms the core data foundation for power supply companies to conduct anti-electricity theft investigations. Electricity theft not only causes huge losses in electricity revenue but also damages metering equipment, disrupts distribution network load balance, and can even cause electrical fires and other safety accidents, seriously threatening the safe and stable operation of the power grid. Therefore, achieving automated and high-precision electricity theft detection based on big data has become a core technological requirement in the power marketing and operation and maintenance field.
[0003] In related technologies, electricity theft detection often employs fixed threshold judgments or traditional outlier detection algorithms. In practical applications, the detection thresholds rely heavily on manual experience for pre-setting, failing to adapt to the varying electricity consumption behaviors of users in different regions and with different electricity usage types, thus leading to insufficient reliability. Therefore, there is an urgent need for an electricity theft detection method capable of dynamically determining the detection threshold. Summary of the Invention
[0004] This invention provides a method, apparatus, device, and medium for detecting electricity theft, in order to solve the technical problem that fixed thresholds cannot be adapted to different scenarios in related technologies.
[0005] In a first aspect, the present invention provides a method for detecting electricity theft, comprising: Obtain characteristic data of normal electricity consumption samples, and perform statistical analysis on the characteristic data of normal electricity consumption samples to obtain multiple electricity consumption feature vectors; Distance calculations are performed on multiple electricity consumption feature vectors to obtain the average distance distribution, and curve fitting is performed on the average distance distribution to obtain the historical distance distribution curve; The target scaling factor is determined based on the inflection point of the historical distance distribution curve, and the standard deviation of the average distance distribution is scaled based on the target scaling factor to obtain the distance threshold correction parameter. The target outlier distance threshold is determined based on the distance threshold correction parameter and the mean of the average distance distribution. The system acquires electricity consumption feature data to be analyzed, and based on multiple electricity consumption feature vectors and target outlier distance thresholds, identifies whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, thus obtaining the electricity theft detection results.
[0006] In some embodiments, the normal electricity consumption sample characteristic data includes timestamps; Statistical analysis of normal electricity consumption sample data yielded multiple electricity consumption feature vectors, including: Based on timestamps, the characteristic data of normal electricity consumption samples are segmented by a preset sliding window to obtain multiple sample time-series feature groups. Perform statistical calculations on multiple sample time series feature groups to obtain at least two of the mean, variance, skewness, and kurtosis of the multiple sample time series feature groups; At least two of the mean, variance, skewness and kurtosis are concatenated to obtain multiple multidimensional feature vectors corresponding to multiple sample time series feature groups respectively; Dimensionality reduction is performed on multiple multidimensional feature vectors to obtain multiple electricity consumption feature vectors.
[0007] In some embodiments, dimensionality reduction processing is performed on multiple multidimensional feature vectors to obtain multiple electricity consumption feature vectors, including: Identify the feature types contained in multiple multidimensional feature vectors, including at least two of the following feature types: voltage feature type, current feature type, power feature type, and time feature type; Based on the preset type weights corresponding to the feature types, multiple multidimensional feature vectors are weighted separately to obtain multiple feature weighted vectors; Principal component analysis was performed on multiple feature weighted vectors to reduce dimensionality, resulting in multiple electricity consumption feature vectors.
[0008] In some embodiments, determining the target scaling factor based on the inflection point of the historical distance distribution curve includes: The average distance value corresponding to the inflection point is determined as the candidate outlier distance threshold, and the mean and standard deviation of the average distance distribution are obtained. Divide the difference between the candidate outlier distance threshold and the mean by the standard deviation to obtain the candidate scaling factor; Using the candidate scaling factor as the center and combining it with a preset value range, a set of candidate scaling factors is obtained; Based on the candidate scaling factor set, outlier detection is performed on the electricity consumption feature vector to obtain the outlier detection results. Based on the outlier detection results, the false detection rate corresponding to the candidate scaling factor set is determined. Generate a mapping curve between the candidate scaling factor set and the false detection rate. Use the elbow rule to determine the elbow point of the mapping curve and determine the candidate scaling factor corresponding to the elbow point as the target scaling factor.
[0009] In some embodiments, based on multiple electricity consumption feature vectors and a target outlier distance threshold, the system identifies whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, and obtains electricity theft detection results, including: Feature extraction is performed on the electricity consumption characteristic data to be analyzed to obtain multiple electricity consumption feature vectors to be analyzed; Calculate the distances between multiple electricity consumption feature vectors to be analyzed and the distances between these multiple electricity consumption feature vectors to obtain multiple vector distances; Determine the number of distances greater than the target outlier distance threshold among multiple vector distances; Based on the ratio between the number of distances and the total number of distances from multiple vectors, it is determined whether an electricity user is at risk of electricity theft, and the electricity theft detection result is obtained.
[0010] In some embodiments, based on a ratio, it is determined whether an electricity user is at risk of electricity theft, resulting in an electricity theft detection result, including: When the ratio is greater than or equal to the preset risk threshold, the detection result is determined to indicate that the electricity user is at risk of electricity theft. When the ratio is less than the preset risk threshold, the detection result is determined to be that there is no risk of electricity theft for the electricity user.
[0011] In some embodiments, after obtaining the electricity theft detection result, the method further includes: Obtain the actual electricity consumption verification results of electricity users; Based on the actual electricity consumption verification results, the detection accuracy of the electricity theft detection results is determined; When the detection accuracy is less than the preset accuracy threshold, adjust the target scaling factor.
[0012] Secondly, the present invention provides an electricity theft detection device, comprising: a sample acquisition module, used to acquire normal electricity consumption sample feature data, and to perform statistical analysis on the normal electricity consumption sample feature data to obtain multiple electricity consumption feature vectors; The distance determination module is used to calculate the distance to multiple electricity consumption feature vectors, obtain the average distance distribution, and perform curve fitting on the average distance distribution to obtain the historical distance distribution curve. The correction parameter determination module is used to determine the target scaling factor based on the inflection point of the historical distance distribution curve, and to scale the standard deviation of the average distance distribution based on the target scaling factor to obtain the distance threshold correction parameter. The threshold determination module is used to determine the target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution. The electricity theft detection module is used to acquire electricity consumption feature data to be analyzed, and based on multiple electricity consumption feature vectors and target outlier distance thresholds, to identify whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, and obtain the electricity theft detection results.
[0013] In summary, the electricity theft detection method, apparatus, equipment, and medium disclosed herein include: acquiring characteristic data of normal electricity consumption samples and performing statistical analysis on the characteristic data to obtain multiple electricity consumption feature vectors; calculating the distance between the multiple electricity consumption feature vectors to obtain an average distance distribution and performing curve fitting on the average distance distribution to obtain a historical distance distribution curve; determining a target scaling factor based on the inflection point of the historical distance distribution curve and scaling the standard deviation of the average distance distribution based on the target scaling factor to obtain a distance threshold correction parameter; determining a target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; acquiring electricity consumption feature data to be analyzed and identifying whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft based on the multiple electricity consumption feature vectors and the target outlier distance threshold, thereby obtaining an electricity theft detection result. This method calculates the distance of electricity consumption feature vectors and fits them to obtain historical distance distribution curves, thereby determining the distance distribution pattern of normal electricity consumption behavior. The inflection point of the historical distance distribution curve is used to determine the target scaling factor. The target scaling factor is combined with the mean and standard deviation of the average distance distribution to adaptively generate the target outlier distance threshold, which improves the adaptability of the target outlier distance threshold to different scenarios, thereby further improving the accuracy of electricity theft detection. Attached Figure Description
[0014] To more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings used in the description of the embodiments of the present invention will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0015] Figure 1 This is a flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 2 This is another flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 3 This is another flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 4 This is another flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 5 This is another flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 6 This is another flowchart of an embodiment of the electricity theft detection method of the present invention; Figure 7 This is a schematic block diagram of an electricity theft detection device according to an embodiment of the present invention; Figure 8 This is a schematic block diagram of a computer device according to an embodiment of the present invention. Detailed Implementation
[0016] As an example, such as Figure 1 As shown, a method for detecting electricity theft is provided, including: S101, acquire normal electricity consumption sample feature data, and perform statistical analysis on the normal electricity consumption sample feature data to obtain multiple electricity consumption feature vectors; S102, calculate the distance to multiple electricity consumption feature vectors to obtain the average distance distribution, and perform curve fitting on the average distance distribution to obtain the historical distance distribution curve; S103, determine the target scaling factor based on the inflection point of the historical distance distribution curve, and scale the standard deviation of the average distance distribution based on the target scaling factor to obtain the distance threshold correction parameter; S104, Determine the target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; S105: Obtain the electricity consumption feature data to be analyzed, and based on multiple electricity consumption feature vectors and the target outlier distance threshold, identify whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, and obtain the electricity theft detection result.
[0017] As an example, in step S101, user electricity consumption data that has been verified and confirmed to have no electricity theft within a preset statistical period can be obtained as normal electricity consumption sample feature data; multi-dimensional statistical analysis and feature standardization processing are performed on the normal electricity consumption sample feature data to output a unified electricity consumption feature vector with multiple dimensions, which serves as the benchmark sample set for subsequent outlier detection.
[0018] In one embodiment, the normal electricity consumption sample feature data includes multiple types of electricity consumption parameters (such as voltage, current, power, and time) with time identifiers (i.e., timestamps). The sample data is processed by time-series segmentation based on the time dimension, and the statistical features in each segment are extracted and concatenated into a high-dimensional feature set. Then, redundant information is compressed through feature dimensionality reduction processing to obtain multiple electricity consumption feature vectors.
[0019] In some optional embodiments, before statistical analysis, the characteristic data of normal electricity consumption samples can be preprocessed, including operations such as missing value completion, outlier removal, and unit normalization, to filter invalid data caused by noise in the acquisition link and improve the data quality of the benchmark sample set. Furthermore, the benchmark sample set can be grouped according to the user's electricity consumption type to construct benchmark feature vector sets for different user types such as residential, commercial, and industrial users, improving the detection adaptability under different electricity consumption scenarios.
[0020] As an example, in step S102, pairwise distance calculations are performed on all electricity consumption feature vectors to obtain the vector distance between each electricity consumption feature vector and the other electricity consumption feature vectors. The mean of the vector distances corresponding to each electricity consumption feature vector is then calculated to obtain the corresponding average distance (i.e., each electricity consumption feature vector corresponds to an average distance, which is used to indicate the average distance between the electricity consumption feature vector and the other electricity consumption feature vectors). The average distances of all electricity consumption feature vectors are used to construct an average distance distribution. Then, curve fitting is performed on the average distance distribution to obtain a smooth and continuous historical distance distribution curve. This historical distance distribution curve is used to quantitatively represent the distribution pattern of normal electricity consumption behavior.
[0021] In some optional embodiments, before calculating the average distance, the corresponding distance measurement rules can be configured according to business needs to adapt to the calculation requirements of different feature spaces; at the same time, the smoothness of the historical distance distribution curve can be balanced by adjusting the fitting accuracy parameters to ensure the accuracy of subsequent inflection point identification.
[0022] As an example, in step S103, inflection points on the historical distance distribution curve are identified, and the average distance corresponding to the inflection point is used as a benchmark. The candidate scaling coefficient is calculated in reverse based on the statistical characteristics of the average distance distribution. The candidate scaling coefficient is then optimized and screened based on the detection performance index to determine the final target scaling coefficient. The standard deviation of the average distance distribution is scaled proportionally based on the target scaling coefficient to obtain the distance threshold correction parameter.
[0023] In one embodiment, the average distance value corresponding to the inflection point of the historical distance distribution curve is extracted as the candidate outlier determination threshold; the difference between the candidate threshold and the mean and the standard deviation of the average distance distribution is divided by the standard deviation to obtain the initial candidate scaling factor; the false detection rate of normal samples is used as the evaluation index to optimize and verify the candidate scaling factor to obtain the target scaling factor; the target scaling factor is multiplied by the standard deviation of the average distance distribution to output the distance threshold correction parameter.
[0024] In some alternative embodiments, a feasible range of scaling factors can be preset to limit the optimization range within this range, thereby avoiding detection failure caused by extreme output parameters.
[0025] As an example, in step S104, the mean of the average distance distribution is used as the benchmark value, and the calculated distance threshold correction parameter is superimposed to finally determine the target outlier distance threshold, which is used as the criterion for determining whether the electricity consumption behavior belongs to the outlier anomaly.
[0026] In one embodiment, the sum of the mean of the average distance distribution and the scaled standard deviation is determined as the target outlier distance threshold. This is based on the central distribution of normal electricity consumption behavior and the judgment boundary is adjusted by the target scaling factor to achieve dynamic determination of the target outlier distance threshold.
[0027] In some alternative embodiments, the calculated target outlier distance threshold is adjusted proportionally according to different electricity consumption areas; for example, the target outlier distance threshold can be appropriately lowered for areas with high line loss to improve the detection sensitivity of electricity theft; the target outlier distance threshold can be appropriately raised for high-quality areas with stable electricity consumption to reduce false detections caused by normal electricity fluctuations.
[0028] As an example, in step S105, the electricity consumption data of the user to be detected is obtained as the electricity consumption feature data to be analyzed; after obtaining the feature vector to be analyzed by using the same processing logic as the feature data of normal electricity consumption samples (i.e. the processing process of step S101), the distance between it and all electricity consumption feature vectors is calculated; based on the target outlier distance threshold, the outlier ratio is statistically analyzed, and combined with the preset judgment rules, it is identified whether there is a risk of electricity theft for the electricity users, and the final electricity theft detection result is output.
[0029] In one embodiment, the power consumption feature data to be analyzed is processed using feature processing rules consistent with those of normal power consumption sample feature data to generate a power consumption feature vector to be analyzed with dimensions consistent with the power consumption feature vector; the distance between the feature vector to be analyzed and each power consumption feature vector is calculated, and the proportion of distances exceeding the target outlier distance threshold is counted to the total number of distances; based on this proportion and a preset judgment rule, the detection result of whether the user has a risk of electricity theft is output.
[0030] In some optional embodiments, when a user is determined to be at risk of electricity theft, an electricity theft risk alarm is generated simultaneously, along with associated information such as user identification, detection period, and risk quantification score. This alarm is then pushed to the corresponding audit management system to support on-site inspectors in conducting precise audits. Furthermore, each detection result can be simultaneously stored in a database along with the actual on-site electricity consumption verification results. The target outlier distance threshold can be periodically updated to further improve the accuracy of electricity theft detection.
[0031] In summary, this disclosure proposes a method for detecting electricity theft, comprising: acquiring characteristic data of normal electricity consumption samples, and performing statistical analysis on the characteristic data of normal electricity consumption samples to obtain multiple electricity consumption feature vectors; calculating the distance between the multiple electricity consumption feature vectors to obtain an average distance distribution, and performing curve fitting on the average distance distribution to obtain a historical distance distribution curve; determining a target scaling factor based on the inflection point of the historical distance distribution curve, and scaling the standard deviation of the average distance distribution based on the target scaling factor to obtain a distance threshold correction parameter; determining a target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; acquiring electricity consumption feature data to be analyzed, and identifying whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft based on the multiple electricity consumption feature vectors and the target outlier distance threshold, thereby obtaining an electricity theft detection result. This method calculates the distance of electricity consumption feature vectors and fits them to obtain historical distance distribution curves, thereby determining the distance distribution pattern of normal electricity consumption behavior. The inflection point of the historical distance distribution curve is used to determine the target scaling factor. The target scaling factor is combined with the mean and standard deviation of the average distance distribution to adaptively generate the target outlier distance threshold, which improves the adaptability of the target outlier distance threshold to different scenarios, thereby further improving the accuracy of electricity theft detection.
[0032] As an example, the characteristic data of normal electricity consumption samples includes timestamps, such as... Figure 2 As shown, step S101 involves statistically analyzing the characteristic data of normal electricity consumption samples to obtain multiple electricity consumption feature vectors, including: S201, based on timestamps, segment the characteristic data of normal electricity consumption samples through a preset sliding window to obtain multiple sample time-series feature groups; S202, Perform statistical calculations on multiple sample time series feature groups respectively, and obtain at least two of the mean, variance, skewness and kurtosis of multiple sample time series feature groups; S203, concatenate at least two of the mean, variance, skewness and kurtosis to obtain multiple multidimensional feature vectors corresponding to multiple sample time series feature groups respectively; S204 performs dimensionality reduction on multiple multidimensional feature vectors to obtain multiple electricity consumption feature vectors.
[0033] As an example, in step S201, the timestamp carried by the normal electricity consumption sample feature data is used as the time reference, and a preset sliding window is used to slide the continuous electricity consumption time series data (i.e. the above-mentioned normal electricity consumption sample feature data) into equal-interval segments. The electricity consumption data in each time window constitutes a sample time series feature group, and all windows correspond to multiple sample time series feature groups.
[0034] In one embodiment, the preset sliding window includes a fixed window length and a sliding step size, which can be pre-configured according to the sampling frequency and detection granularity of the normal power consumption sample feature data; and the segmentation process maintains time axis alignment to ensure that all data in the same sample time sequence feature group belong to the same time interval.
[0035] In some alternative embodiments, differentiated sliding window parameters can be configured according to different user types, such as using a longer window length for industrial users and a shorter window length for residential users, to adapt to the fluctuation cycle characteristics of different electricity consumption behaviors.
[0036] As an example, in step S202, for each sample time series feature group, statistical feature calculations are performed on the various electricity consumption features included in the group to obtain the statistical feature values of the corresponding feature dimensions. The statistical data may include at least two of the mean, variance, skewness and kurtosis.
[0037] In one embodiment, statistical features are independently calculated for each type of electricity consumption feature within a single sample time-series feature group: the mean is used to characterize the overall level of the electricity consumption feature within that time period, the variance is used to characterize the degree of fluctuation of the electricity consumption feature, the skewness is used to characterize the asymmetry of the distribution of the electricity consumption feature, and the kurtosis is used to characterize the steepness of the distribution of the electricity consumption feature; the electricity consumption behavior characteristics within the time period are comprehensively characterized through multi-level statistical features.
[0038] In some optional embodiments, the combination of statistical features can be flexibly selected according to the needs of the detection scenario. For example, in scenarios that focus on detecting abnormal load fluctuations, variance and skewness can be selected first, while in scenarios that focus on detecting horizontal load shifts, mean and kurtosis can be selected first, taking into account both detection specificity and computational efficiency.
[0039] As an example, in step S203, according to the preset feature arrangement order, the statistical features corresponding to all electricity consumption features under the same sample time series feature group are sequentially spliced together to form a multi-dimensional feature vector; each sample time series feature group corresponds to a multi-dimensional feature vector, and all sample time series feature groups correspond to multiple multi-dimensional feature vectors.
[0040] In one embodiment, the features are arranged sequentially according to the categories of electricity consumption features to ensure that all multidimensional feature vectors have the same dimension and the physical meaning of the corresponding positions are consistent, thus providing a standardized feature basis for subsequent distance calculation.
[0041] In some optional embodiments, after feature stitching is completed, normalization processing can be performed on all multidimensional feature vectors to map features of different magnitudes to the same numerical range, eliminate the influence of dimensional differences on subsequent distance calculations, and improve the stability of detection results.
[0042] As an example, in step S204, feature dimensionality reduction processing is performed on all the spliced multidimensional feature vectors to eliminate redundant information and correlations between feature dimensions. While retaining the core electricity consumption behavior features, the feature dimensions are compressed to obtain multiple low-dimensional electricity consumption feature vectors.
[0043] In one embodiment, principal component analysis can be used to perform dimensionality reduction. Specifically, the covariance matrix and eigenvectors can be calculated based on the feature matrix composed of all multidimensional feature vectors. The first few principal components are selected according to a preset cumulative contribution rate. The high-dimensional features are projected onto the low-dimensional principal component space, and the corresponding electricity consumption feature vector is output. However, it is not limited to this. Other dimensionality reduction methods can also be used to obtain the electricity consumption feature vector.
[0044] As an example, such as Figure 3 As shown, step S204 involves dimensionality reduction of multiple multidimensional feature vectors to obtain multiple electricity consumption feature vectors, including: S301 identifies the feature types contained in multiple multidimensional feature vectors; S302, based on the preset type weights corresponding to the feature types, perform weighted processing on multiple multidimensional feature vectors respectively to obtain multiple feature weighted vectors; S303 performs principal component analysis to reduce the dimensionality of multiple feature weighted vectors, resulting in multiple electricity consumption feature vectors.
[0045] As an example, in step S301, for the multi-dimensional feature vector generated by splicing, the feature type of each dimension is identified, and the electrical attribute category corresponding to each feature dimension is clarified, providing a classification basis for subsequent differential weighting processing. The feature type may include at least two of the following: voltage feature type, current feature type, power feature type, and time feature type.
[0046] As an example, in step S302, based on the identified feature types, the preset type weights corresponding to each type are matched, and the weighted scaling processing is performed on the values of each dimension in the multidimensional feature vector. After the weighting is completed, the corresponding feature weighted vector is output.
[0047] In one embodiment, a preset type weight is configured for each feature type in advance, wherein the weight values for voltage and current feature types can be higher than those for power and time feature types. For each multi-dimensional feature vector, the feature value of each dimension is multiplied by the weight coefficient corresponding to its respective feature type to obtain a weighted dimension value. All weighted dimensions are combined to form a feature weighted vector. By configuring differentiated weights, the influence of electrical features that are more sensitive to electricity theft on subsequent distance calculations is amplified, thereby improving the accuracy of electricity theft detection.
[0048] In some optional embodiments, the preset type weights can be configured differently according to the electricity consumption characteristics of different regions. For example, the weight of power characteristic type can be appropriately increased for industrial user areas, while the weight of voltage and current characteristic type can be emphasized for residential user areas, adapting to the detection needs of different regions. Furthermore, the weight values of each type can be iteratively optimized by combining historical detection accuracy data to continuously improve the detection effect.
[0049] As an example, in step S303, the weighted vector after weighting is used as input, and principal component analysis is performed to reduce the dimensionality, eliminate redundant information and linear correlation between feature dimensions, compress feature dimensions while retaining core electricity consumption behavior features, and output multiple electricity consumption feature vectors.
[0050] In one embodiment, a high-dimensional feature matrix is constructed based on all feature weighted vectors, the covariance matrix of the feature matrix is calculated, and the eigenvalues and eigenvectors corresponding to the covariance matrix are obtained. The eigenvalues are sorted in descending order, and the first few eigenvectors whose cumulative contribution rate meets the preset requirements are selected as principal component axes. All feature weighted vectors are projected onto the low-dimensional feature space formed by the principal component axes to obtain multiple electricity consumption feature vectors with uniform dimension.
[0051] In some optional embodiments, the cumulative contribution rate threshold of principal component analysis can be flexibly configured according to the detection accuracy requirements. While ensuring that the core feature information is not lost, the feature dimension is compressed to the maximum extent, reducing the computational load of subsequent distance calculation and distribution fitting, and improving the overall detection efficiency.
[0052] As an example, such as Figure 4 As shown, step S103, which is to determine the target scaling factor based on the inflection point of the historical distance distribution curve, includes: S401, determine the average distance value corresponding to the inflection point as the candidate outlier distance threshold, and obtain the mean and standard deviation of the average distance distribution; S402, divide the difference between the candidate outlier distance threshold and the mean by the standard deviation to obtain the candidate scaling factor; S403, using the candidate scaling factor as the center and combining it with the preset value range, obtain the set of candidate scaling factors; S404, based on the candidate scaling factor set, outlier detection is performed on the electricity consumption feature vector to obtain the outlier detection results, and based on the outlier detection results, the false detection rate corresponding to the candidate scaling factor set is determined; S405, generate a mapping curve between the candidate scaling factor set and the false detection rate, determine the elbow point of the mapping curve using the elbow rule, and determine the candidate scaling factor corresponding to the elbow point as the target scaling factor.
[0053] As an example, in step S401, the distribution abrupt change inflection point on the historical distance distribution curve is identified, and the average distance value corresponding to the inflection point is extracted as a preliminary candidate outlier distance threshold; at the same time, the average distance distribution is statistically calculated to obtain its corresponding mean and standard deviation, providing a statistical benchmark for the subsequent calculation of the scaling factor.
[0054] In one embodiment, the inflection point of the historical distance distribution curve is identified by curvature calculation. Specifically, the curvature value of each point on the curve is calculated, and the point corresponding to the maximum curvature value is taken as the effective inflection point to eliminate the interference of false inflection points at the beginning and end of the curve. The average distance value corresponding to the inflection point is determined as the candidate outlier distance threshold. At the same time, the mean and the overall standard deviation of the average distance distribution are calculated based on all average distance samples.
[0055] In some alternative embodiments, inflection points can be identified by other methods such as the second derivative zero-crossing method and the slope mutation method to adapt to the morphological characteristics of different fitted curves; when there are multiple inflection points on the curve, the first significant inflection point of the rising segment of the distance distribution is selected as the effective inflection point to ensure the rationality of the candidate threshold.
[0056] As an example, in step S402, the deviation of the candidate outlier distance threshold from the mean of the average distance distribution is calculated based on the mean of the average distance distribution. This deviation is then converted into a scaling factor in units of standard deviation to obtain the initial candidate scaling factor.
[0057] In one embodiment, the candidate outlier distance threshold can be subtracted from the mean of the average distance distribution, and the difference can be divided by the standard deviation of the average distance distribution. The resulting quotient is the candidate scaling factor. The candidate scaling factor is used to indicate the standard deviation multiple by which the candidate outlier distance threshold deviates from the mean of the distribution center.
[0058] In some optional embodiments, after the candidate scaling coefficient is calculated, its boundary rationality can be checked. If the candidate scaling coefficient exceeds the preset reasonable range, it is automatically corrected to the range boundary value to avoid extreme values of the candidate outlier distance threshold due to inflection point identification deviation.
[0059] As an example, in step S403, with the initial candidate scaling factor as the center value, a preset range of values is expanded to both sides of the value increase and decrease, and multiple discrete candidate scaling factor values are generated according to a preset step size. All values together constitute a candidate scaling factor set.
[0060] In some optional embodiments, the expansion range and step size of the value range can be flexibly configured according to the detection accuracy requirements: for scenarios with high detection accuracy requirements, a smaller value step size and a larger expansion range can be used; for scenarios with high computational efficiency requirements, the step size can be appropriately increased and the value range can be reduced to balance computational accuracy and computational overhead.
[0061] As an example, in step S404, each candidate scaling factor in the candidate scaling factor set is traversed, and a corresponding outlier distance threshold is generated. Outlier detection is performed on all electricity consumption feature vectors based on each threshold. The proportion of normal samples that are misclassified as outliers is calculated based on the detection results, and the false detection rate corresponding to each candidate scaling factor is obtained.
[0062] In one embodiment, for each candidate scaling factor, the average distance distribution is multiplied by the standard deviation of the average distance distribution and the mean is summed to obtain the outlier distance threshold corresponding to the factor; the relationship between the average distance corresponding to each electricity consumption feature vector and the threshold is compared, and the number of normal samples with an average distance greater than the threshold is counted. The ratio of this number to the total number of normal samples is used as the false detection rate of the corresponding candidate scaling factor; after traversing all candidate scaling factors, multiple sets of false detection rate values corresponding to the candidate outlier distance threshold set are obtained.
[0063] As an example, in step S405, a mapping curve is constructed with the candidate scaling factor as the horizontal axis and the corresponding false detection rate as the vertical axis; the elbow point is identified by using the elbow rule to identify the turning point on the curve where the false detection rate decreases from steep to gentle, and the candidate scaling factor corresponding to the elbow point is determined as the final target scaling factor.
[0064] In one embodiment, as the value of the candidate scaling factor gradually increases, the outlier distance threshold increases accordingly, and the false detection rate shows a continuous downward trend. When the scaling factor reaches the elbow position, further increasing the factor can only slightly reduce the false detection rate, but will significantly increase the probability of missing the electricity theft behavior. The elbow point identified by the elbow rule is the balance point between detection sensitivity and false detection rate, and its corresponding scaling factor is the target scaling factor.
[0065] In some optional embodiments, the elbow rule can be implemented using various algorithms such as the maximum curvature method and the point-to-line distance method. When there are multiple suspected elbow points on the mapping curve, the appropriate elbow point can be selected by combining the historical electricity theft rate of the corresponding region to meet the electricity theft detection needs of different regions.
[0066] As an example, such as Figure 5 As shown, step S105, which involves identifying whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft based on multiple electricity consumption feature vectors and the target outlier distance threshold, and obtaining the electricity theft detection result, includes: S501, Perform feature extraction on the electricity consumption feature data to be analyzed to obtain multiple electricity consumption feature vectors to be analyzed; S502, calculate the distances between multiple electricity consumption feature vectors to be analyzed and the distances between multiple electricity consumption feature vectors respectively, and obtain multiple vector distances; S503, determine the number of distances greater than the target outlier distance threshold among multiple vector distances; S504 determines whether an electricity user is at risk of electricity theft based on the ratio between the number of distances and the total number of distances from multiple vectors, thus obtaining the electricity theft detection result.
[0067] As an example, in step S501, after obtaining the electricity consumption feature data to be analyzed, the same feature processing logic as the normal electricity consumption sample feature data (such as the processing process shown in step S101) is used to perform time-series segmentation, statistical calculation, feature splicing and dimensionality reduction processing, and extract multiple dimensions of the electricity consumption feature vector to be analyzed that are completely consistent with the electricity consumption feature vector.
[0068] In one embodiment, the electricity consumption feature data to be analyzed also carries a timestamp, and is segmented according to the same preset sliding window parameters as normal samples to obtain multiple groups of time series features to be analyzed; the corresponding statistical features are calculated for each group of time series features to be analyzed, and after feature concatenation, feature type weighting and principal component analysis dimensionality reduction, the corresponding electricity consumption feature vector to be analyzed is output to ensure that the feature vector to be analyzed and the electricity consumption feature vector are in the same feature space, thus ensuring the effectiveness of subsequent distance calculation.
[0069] In some optional embodiments, the electricity consumption feature data to be analyzed can be cleaned before feature extraction, including operations such as filling in missing values, removing outliers, and normalizing units, to filter out invalid data caused by interference from the acquisition link; for real-time online detection scenarios, features can be extracted segment by segment in a sliding window manner to achieve real-time electricity theft detection.
[0070] As an example, in step S502, each power consumption feature vector to be analyzed is paired with all power consumption feature vectors to calculate the distance between each pair of feature vectors, and the calculation results of all power consumption feature vectors to be analyzed together constitute multiple vector distances.
[0071] In one embodiment, Euclidean distance is used as the distance metric. For a single electricity consumption feature vector to be analyzed, the Euclidean distance between it and each other is calculated sequentially to obtain a set of distance results corresponding to the vector to be analyzed. After traversing all the electricity consumption feature vectors to be analyzed, a complete set of multiple vector distances is obtained.
[0072] As an example, in step S503, the value of each vector distance is compared with the target outlier distance threshold one by one, and the total number of distances with values greater than the target outlier distance threshold is counted to obtain the outlier distance count result.
[0073] In one embodiment, for a single electricity consumption feature vector to be analyzed, the number of distances exceeding the target outlier distance threshold among all corresponding vector distances is counted to obtain the number of outlier distances corresponding to the vector to be analyzed; for multiple electricity consumption feature vectors to be analyzed for the same user, the total number of outlier distances among all vector distances can be accumulated for subsequent risk ratio calculation.
[0074] In some optional embodiments, when counting outlier distances, extreme distance values with abnormally high values can be pre-removed to eliminate invalid outlier counts caused by sudden changes in a single data collection, thereby further reducing the probability of false detection.
[0075] As an example, in step S504, the ratio of the number of outlier distances to the total number of all vector distances is calculated, and this ratio is compared with a preset risk threshold. Based on the comparison result, it is determined whether there is a risk of electricity theft for the electricity user, and the final electricity theft detection result is output.
[0076] In one embodiment, when the ratio is greater than or equal to a preset risk threshold, it is determined that the degree to which the electricity user's electricity consumption behavior deviates from the normal electricity consumption distribution exceeds an acceptable range, and the detection result is determined that the electricity user has a risk of electricity theft; when the ratio is less than the preset risk threshold, it is determined that the electricity user's electricity consumption behavior conforms to the characteristics of normal electricity consumption distribution, and the detection result is determined that the electricity user does not have a risk of electricity theft.
[0077] In some optional embodiments, different levels of electricity theft risk can be divided according to the numerical range of the ratio, such as low risk, medium risk, and high risk, corresponding to different inspection priorities; or the results of multiple consecutive detection cycles for the same user can be combined for comprehensive judgment, and a high-risk alarm will only be output when electricity theft risk is determined to exist in multiple consecutive cycles, further improving the stability and reliability of the detection results.
[0078] As an example, such as Figure 6 As shown, in step S105, after obtaining the electricity theft detection result, the following is also included: S601, obtain the actual electricity consumption verification results of electricity users; S602, based on the actual electricity consumption verification results, determine the detection accuracy of electricity theft detection results; S603, when the detection accuracy is less than the preset accuracy threshold, adjust the target scaling factor.
[0079] As an example, in step S601, the actual electricity consumption conclusion of the user, which has been verified on-site, is obtained as the actual electricity consumption verification result. This is used to verify the accuracy of the electricity theft detection result and to provide a true labeling basis for the adaptive optimization of subsequent detection parameters.
[0080] In one embodiment, the actual electricity consumption verification results of all users who have completed the verification within the corresponding time period can be obtained in batches according to a preset statistical period, and matched and aligned with the electricity theft detection results of the same period one by one according to the user identifier.
[0081] As an example, in step S602, the electricity theft detection results within the same statistical period are compared with the actual electricity consumption verification results for each household. Based on the matching results, the percentage of samples that are correctly detected is statistically analyzed to obtain the detection accuracy rate of the electricity theft detection method within that period.
[0082] As an example, in step S603, the calculated detection accuracy is compared with the preset accuracy threshold. If the detection accuracy does not meet the preset business requirements, the target scaling factor is adaptively adjusted. The overall detection effect is optimized by correcting the outlier determination boundary, forming a closed loop of parameter iterative optimization.
[0083] In one embodiment, a preset accuracy threshold that meets business control requirements is pre-set. When the detection accuracy is less than the threshold, the target scaling factor is adjusted in combination with the distribution of false detection rate and false negative rate during the same period. If the false detection rate is too high, the target scaling factor is appropriately increased to raise the target outlier distance threshold and reduce misjudgments caused by normal power consumption fluctuations. If the false negative rate is too high, the target scaling factor is appropriately decreased to lower the target outlier distance threshold and improve the detection capability of concealed electricity theft.
[0084] In some optional embodiments, a step-by-step iterative adjustment strategy can be adopted, in which the target scaling factor is adjusted by a preset step size each time, and the detection accuracy is recalculated based on the verification sample set after adjustment until the accuracy reaches the preset accuracy threshold or the maximum number of adjustments is reached; in addition to the target scaling factor, other detection parameters such as the preset risk threshold and feature type weight can be adjusted in a coordinated manner to further improve the optimization effect.
[0085] In one embodiment, a power theft detection device is provided, which corresponds one-to-one with the power theft detection methods described in the above embodiments. For example... Figure 7 As shown, the electricity theft detection device includes a sample acquisition module 701, a distance determination module 702, a correction parameter determination module 703, a threshold determination module 704, and an electricity theft detection module 705. Detailed descriptions of each functional module are as follows: The sample acquisition module 701 is used to acquire normal electricity consumption sample feature data and perform statistical analysis on the normal electricity consumption sample feature data to obtain multiple electricity consumption feature vectors. The distance determination module 702 is used to calculate the distance to multiple electricity consumption feature vectors, obtain the average distance distribution, and perform curve fitting on the average distance distribution to obtain the historical distance distribution curve. The correction parameter determination module 703 is used to determine the target scaling factor based on the inflection point of the historical distance distribution curve, and to scale the standard deviation of the average distance distribution based on the target scaling factor to obtain the distance threshold correction parameter. The threshold determination module 704 is used to determine the target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; The electricity theft detection module 705 is used to acquire electricity consumption feature data to be analyzed, and based on multiple electricity consumption feature vectors and target outlier distance threshold, identify whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, and obtain the electricity theft detection result.
[0086] In one embodiment, the normal electricity consumption sample feature data includes a timestamp; the sample acquisition module 701 is further configured to, based on the timestamp, segment the normal electricity consumption sample feature data through a preset sliding window to obtain multiple sample time-series feature groups. Perform statistical calculations on multiple sample time series feature groups to obtain at least two of the mean, variance, skewness, and kurtosis of the multiple sample time series feature groups; At least two of the mean, variance, skewness and kurtosis are concatenated to obtain multiple multidimensional feature vectors corresponding to multiple sample time series feature groups respectively; Dimensionality reduction is performed on multiple multidimensional feature vectors to obtain multiple electricity consumption feature vectors.
[0087] In one embodiment, the sample acquisition module 701 is further configured to identify feature types contained in a plurality of multidimensional feature vectors, wherein the feature types include at least two of voltage feature types, current feature types, power feature types and time feature types; Based on the preset type weights corresponding to the feature types, multiple multidimensional feature vectors are weighted separately to obtain multiple feature weighted vectors; Principal component analysis was performed on multiple feature weighted vectors to reduce dimensionality, resulting in multiple electricity consumption feature vectors.
[0088] In one embodiment, the correction parameter determination module 703 is further configured to determine the average distance value corresponding to the inflection point as the candidate outlier distance threshold, and obtain the mean and standard deviation of the average distance distribution; Divide the difference between the candidate outlier distance threshold and the mean by the standard deviation to obtain the candidate scaling factor; Using the candidate scaling factor as the center and combining it with a preset value range, a set of candidate scaling factors is obtained; Based on the candidate scaling factor set, outlier detection is performed on the electricity consumption feature vector to obtain the outlier detection results. Based on the outlier detection results, the false detection rate corresponding to the candidate scaling factor set is determined. Generate a mapping curve between the candidate scaling factor set and the false detection rate. Use the elbow rule to determine the elbow point of the mapping curve and determine the candidate scaling factor corresponding to the elbow point as the target scaling factor.
[0089] In one embodiment, the electricity theft detection module 705 is further configured to extract features from the electricity consumption feature data to be analyzed, thereby obtaining multiple electricity consumption feature vectors to be analyzed. Calculate the distances between multiple electricity consumption feature vectors to be analyzed and the distances between these multiple electricity consumption feature vectors to obtain multiple vector distances; Determine the number of distances greater than the target outlier distance threshold among multiple vector distances; Based on the ratio between the number of distances and the total number of distances from multiple vectors, it is determined whether an electricity user is at risk of electricity theft, and the electricity theft detection result is obtained.
[0090] In one embodiment, the electricity theft detection module 705 is further configured to determine that the detection result indicates that the electricity user is at risk of electricity theft when the ratio is greater than or equal to a preset risk threshold. When the ratio is less than the preset risk threshold, the detection result is determined to be that there is no risk of electricity theft for the electricity user.
[0091] In one embodiment, the electricity theft detection module 705 is further configured to obtain the actual electricity consumption verification results of the electricity user; Based on the actual electricity consumption verification results, the detection accuracy of the electricity theft detection results is determined; When the detection accuracy is less than the preset accuracy threshold, adjust the target scaling factor.
[0092] This invention provides an electricity theft detection device, comprising: a sample acquisition module for acquiring normal electricity consumption sample feature data and performing statistical analysis on the normal electricity consumption sample feature data to obtain multiple electricity consumption feature vectors; a distance determination module for calculating the distance between the multiple electricity consumption feature vectors to obtain an average distance distribution and performing curve fitting on the average distance distribution to obtain a historical distance distribution curve; a correction parameter determination module for determining a target scaling factor based on the inflection point of the historical distance distribution curve and scaling the standard deviation of the average distance distribution based on the target scaling factor to obtain a distance threshold correction parameter; a threshold determination module for determining a target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; and an electricity theft detection module for acquiring electricity consumption feature data to be analyzed and, based on the multiple electricity consumption feature vectors and the target outlier distance threshold, identifying whether the electricity user corresponding to the electricity consumption feature data to be analyzed has a risk of electricity theft, and obtaining an electricity theft detection result. This device calculates the distance of electricity consumption feature vectors and fits them to obtain historical distance distribution curves, thereby determining the distance distribution pattern of normal electricity consumption behavior. It determines the target scaling factor by the inflection point of the historical distance distribution curve, and adaptively generates the target outlier distance threshold by combining the target scaling factor with the mean and standard deviation of the average distance distribution. This improves the adaptability of the target outlier distance threshold to different scenarios, thereby further improving the accuracy of electricity theft detection.
[0093] In one embodiment, a computer device is provided, which may be a server, and its internal structure diagram may be as follows: Figure 8 As shown, the computer device includes a processor, memory, network interface, and database connected via a system bus. The processor provides computing and control capabilities. The memory includes non-volatile storage media and internal memory. The non-volatile storage media stores the operating system, computer programs, and database. The internal memory provides an environment for the operation of the operating system and computer programs in the non-volatile storage media. The database stores data used in the electricity theft detection method. The network interface communicates with external terminals via a network connection. When the computer program is executed by the processor, it can implement an electricity theft detection method.
[0094] In one embodiment, a computer device is provided, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the computer program, it implements a method for detecting electricity theft.
[0095] In one embodiment, a computer-readable storage medium is provided, the computer-readable storage medium storing a computer program that, when executed by a processor, implements a method for detecting electricity theft.
[0096] Those skilled in the art will understand that all or part of the processes in the methods of the above embodiments can be implemented by a computer program instructing related hardware. The computer program can be stored in a non-volatile computer-readable storage medium, and when executed, it can include the processes of the embodiments of the methods described above. Any references to memory, storage, databases, or other media used in the embodiments provided in this application can include non-volatile and / or volatile memory. Non-volatile memory may include read-only memory (ROM), programmable ROM (PROM), electrically programmable ROM (EPROM), electrically erasable programmable ROM (EEPROM), or flash memory. Volatile memory may include random access memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in various forms, such as static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), dual data rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous link DRAM (SLDRAM), IAMbus direct RAM (RDRAM), direct memory bus dynamic RAM (DRDRAM), and memory bus dynamic RAM (RDRAM), etc.
[0097] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the above-described division of functional units and modules is used as an example. In practical applications, the above functions can be assigned to different functional units and modules as needed, that is, the internal structure of the device can be divided into different functional units or modules to complete all or part of the functions described above.
[0098] The above-described embodiments are only used to illustrate the technical solutions of the present invention, and are not intended to limit it. Although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features. Such modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention, and should all be included within the protection scope of the present invention.
Claims
1. A method for detecting electricity theft, characterized in that, include: Obtain characteristic data of normal electricity consumption samples, and perform statistical analysis on the characteristic data of normal electricity consumption samples to obtain multiple electricity consumption feature vectors; Distance calculations are performed on the multiple electricity consumption feature vectors to obtain the average distance distribution, and curve fitting is performed on the average distance distribution to obtain the historical distance distribution curve; The target scaling factor is determined based on the inflection point of the historical distance distribution curve, and the standard deviation of the average distance distribution is scaled based on the target scaling factor to obtain the distance threshold correction parameter. The target outlier distance threshold is determined based on the distance threshold correction parameter and the mean of the average distance distribution. The system acquires electricity consumption feature data to be analyzed, and based on the multiple electricity consumption feature vectors and the target outlier distance threshold, identifies whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, thus obtaining the electricity theft detection result.
2. The method according to claim 1, characterized in that, The normal electricity consumption sample feature data includes timestamps; The statistical analysis of the normal electricity consumption sample feature data yields multiple electricity consumption feature vectors, including: Based on the timestamp, the normal electricity consumption sample feature data is segmented by a preset sliding window to obtain multiple sample time series feature groups. Statistical calculations are performed on the multiple sample time series feature groups respectively to obtain at least two of the mean, variance, skewness and kurtosis of the multiple sample time series feature groups; At least two of the mean, variance, skewness and kurtosis are concatenated to obtain multiple multidimensional feature vectors corresponding to the multiple sample time-series feature groups respectively. The dimensionality reduction process is performed on the multiple multidimensional feature vectors to obtain the multiple electricity consumption feature vectors.
3. The method according to claim 2, characterized in that, The dimensionality reduction process performed on the plurality of multidimensional feature vectors to obtain the plurality of electricity consumption feature vectors includes: Identify the feature types contained in the plurality of multidimensional feature vectors, wherein the feature types include at least two of the following: voltage feature type, current feature type, power feature type, and time feature type; Based on the preset type weights corresponding to the feature types, the multiple multidimensional feature vectors are weighted respectively to obtain multiple feature weighted vectors; Principal component analysis is performed on the multiple feature weighted vectors to reduce their dimensionality, resulting in the multiple electricity consumption feature vectors.
4. The method according to claim 1, characterized in that, The determination of the target scaling factor based on the inflection point of the historical distance distribution curve includes: The average distance value corresponding to the inflection point is determined as the candidate outlier distance threshold, and the mean and standard deviation of the average distance distribution are obtained. The difference between the candidate outlier distance threshold and the mean is divided by the standard deviation to obtain the candidate scaling factor; Using the candidate scaling coefficients as the center, and combining them with a preset value range, a set of candidate scaling coefficients is obtained; Based on the candidate scaling factor set, outlier detection is performed on the electricity consumption feature vector to obtain outlier detection results, and based on the outlier detection results, the false detection rate corresponding to the candidate scaling factor set is determined. A mapping curve between the candidate scaling factor set and the false detection rate is generated. The elbow point of the mapping curve is determined by the elbow rule, and the candidate scaling factor corresponding to the elbow point is determined as the target scaling factor.
5. The method according to claim 1, characterized in that, The process of identifying whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, based on the multiple electricity consumption feature vectors and the target outlier distance threshold, and obtaining electricity theft detection results, includes: Feature extraction is performed on the electricity consumption feature data to be analyzed to obtain multiple electricity consumption feature vectors to be analyzed; Calculate the distances between the plurality of electricity consumption feature vectors to be analyzed and the plurality of electricity consumption feature vectors respectively to obtain multiple vector distances; Determine the number of distances among the plurality of vector distances that are greater than the target outlier distance threshold; Based on the ratio between the number of distances and the total number of the multiple vector distances, it is determined whether the electricity user is at risk of electricity theft, and the electricity theft detection result is obtained.
6. The method according to claim 5, characterized in that, The process of determining whether the electricity user is at risk of electricity theft based on the ratio, and obtaining the electricity theft detection result, includes: When the ratio is greater than or equal to a preset risk threshold, the detection result is determined to indicate that the electricity user is at risk of electricity theft. When the ratio is less than the preset risk threshold, the detection result is determined to indicate that the electricity user does not have a risk of electricity theft.
7. The method according to claim 1, characterized in that, After obtaining the electricity theft detection results, the following is also included: Obtain the actual electricity consumption verification results of the electricity users; Based on the actual electricity consumption verification results, the detection accuracy of the electricity theft detection results is determined; When the detection accuracy is less than a preset accuracy threshold, the target scaling factor is adjusted.
8. A device for detecting electricity theft, characterized in that, include: The sample acquisition module is used to acquire normal electricity consumption sample feature data and perform statistical analysis on the normal electricity consumption sample feature data to obtain multiple electricity consumption feature vectors. The distance determination module is used to calculate the distance to the multiple electricity consumption feature vectors, obtain the average distance distribution, and perform curve fitting on the average distance distribution to obtain the historical distance distribution curve. The correction parameter determination module is used to determine the target scaling factor based on the inflection point of the historical distance distribution curve, and to scale the standard deviation of the average distance distribution based on the target scaling factor to obtain the distance threshold correction parameter. The threshold determination module is used to determine the target outlier distance threshold based on the distance threshold correction parameter and the mean of the average distance distribution; The electricity theft detection module is used to acquire electricity consumption feature data to be analyzed, and based on the multiple electricity consumption feature vectors and the target outlier distance threshold, to identify whether the electricity users corresponding to the electricity consumption feature data to be analyzed are at risk of electricity theft, and to obtain the electricity theft detection result.
9. A computer device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the electricity theft detection method as described in any one of claims 1 to 7.
10. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by the processor, it implements the electricity theft detection method as described in any one of claims 1 to 7.