SVM electric power stealing detection method and system based on self-attention mechanism
By combining self-attention mechanism and SVM model, electricity consumption data and alarm information are analyzed to automatically identify suspected electricity theft users, solving the problems of high false alarm rate and strong subjectivity in traditional electricity theft detection, and achieving efficient and accurate location of electricity theft users.
Patent Information
- Application Number
- CN202410816352.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-24
- Publication Date
- 2024-11-12
AI Technical Summary
Traditional methods for detecting electricity theft rely on manual inspections and model-based formulas, which result in high false alarm rates, high false negative rates, and strong subjectivity, making it impossible to quickly and accurately locate electricity theft users.
A support vector machine (SVM) model based on self-attention mechanism is adopted. By collecting electricity load and terminal alarm data, the slope of electricity consumption decline, the rate of line loss growth and the number of alarms are analyzed. The feature data is preprocessed using self-attention mechanism, and an electricity theft detection model is constructed for classification and identification.
It has achieved automated and objective detection of electricity theft, reduced the false positive rate, improved the accuracy and efficiency of detection, and helped inspectors quickly locate electricity theft users.
Smart Images

Figure CN118937762A_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of smart electric meters, and in particular to a SVM electric power theft detection method and system based on a self-attention mechanism. Background Art
[0002] Traditional methods of preventing electricity theft and leakage mainly involve regular inspections, regular meter calibration, and user reports of electricity theft to detect electricity theft or metering device failures. These methods are too dependent on people, and the goal of catching leaks is unclear. At present, the power supply bureau uses marketing auditors, electricity inspection personnel, and metering staff to conduct online user monitoring using the metering abnormality alarm function and electricity data query function. By collecting electricity data, terminal alarms, master station alarms and other data to establish data analysis models, it monitors electricity theft and leakage users in real time and detects metering device failures. According to the current, voltage, load data and other conditions related to the customer's metering point before and after the alarm event, an abnormal electricity consumption analysis model based on indicator weighting is constructed to check whether the customer has electricity theft, illegal electricity use, and metering device failures.
[0003] Although the above-mentioned anti-theft and leakage diagnosis method can obtain certain data of user abnormalities, it is unable to quickly locate the leakage user due to too many false alarms or missed alarms on the terminal, which often leaves auditors at a loss. Moreover, when using this method to build a model, the model sets formulas and judgment conditions, and the weights of the model input indicators require the knowledge and experience of experts to determine, which is very subjective and has obvious defects. Summary of the invention
[0004] In order to improve the deficiencies in the prior art, a SVM power theft detection method and system based on self-attention mechanism is provided, which can automatically detect user meters suspected of power theft, report the recent power consumption information of the suspected users, and help auditors narrow the scope and diagnosis of power theft users. It is more objective and accurate, and reduces the misjudgment rate.
[0005] To achieve the above purpose, the technical solution adopted by the present invention is as follows:
[0006] In a first aspect, the present invention provides a SVM power theft detection method based on a self-attention mechanism, comprising the following steps:
[0007] S1, collecting power load data and terminal alarm data, and analyzing the collected data to obtain characteristic data of the measured object, wherein the characteristic data includes the power consumption decline slope, line loss growth rate, and alarm number within a set time period;
[0008] S2, preprocessing the feature data based on a self-attention mechanism, and inputting the preprocessed feature data into a pre-trained electricity theft detection model, and outputting a classification result of whether there is suspicion of electricity theft;
[0009] S3: If the classification result is suspected of electricity theft, the identification number of the metering terminal, the electricity consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period are reported to the edge terminal.
[0010] In the above scheme, the electricity theft detection model is trained using machine learning methods, and then the electricity theft detection model is used to classify and predict the feature data. The entire detection process is completely executed by computer, avoiding the influence of human subjective factors. Therefore, the detection accuracy and reliability are higher, and automatic detection can be achieved to improve detection efficiency.
[0011] In a further optimized solution, in S1, the processing of obtaining the decreasing slope of the power consumption of the measured object according to the collected data analysis includes:
[0012] Set N days before and after the statistical day as the statistical window period, calculate the daily power consumption trend in these 2N+1 days, and the power consumption trend on the i-th day is in k i is the electricity consumption trend on the i-th day, f l is the electricity consumption on day l, l is the number of days, f i is the electricity consumption on the i-th day, l i is the i-th day in the statistical window period, and N is an integer greater than 1;
[0013] Calculate the number of days within N days when the power consumption trend on the current day is decreasing compared to the power consumption trend on the previous day, as the power consumption decline slope indicator,
[0014] In the above scheme, the sudden change of electricity consumption data is not simply used as an indicator, but a continuous analysis of abnormal electricity consumption data is carried out over a certain period of time, and the number of days in which the electricity consumption trend of the day is decreasing compared with the electricity consumption trend of the previous day within a period of time is used as the electricity consumption decline slope indicator, so that the indicator reflects the suspicion of electricity theft more accurately, thereby improving the accuracy of the final detection result.
[0015] In a further optimized solution, in S1, the processing of the line loss growth rate of the measured object obtained by analyzing the collected data includes:
[0016] Set the N days before and after the statistical day as the statistical window period, and calculate the average line loss rate V between the current day and the previous N days i 1 and the average line loss V between the current day and the next N days i 2 , the line loss growth rate index is: The line loss rate is: sl represents the line power supply on day l, ∑ m f l (m) represents the total power consumption of each user on the line, m represents the number of users on the same line, and k is the set threshold.
[0017] It is inevitable that there will be loss of electricity during the transmission process, but line loss is often ignored. In the above scheme, line loss is taken into account at the same time, and the average line loss rate of the previous N days is used to determine whether its growth rate is greater than the set threshold as the line loss growth rate indicator, so as to avoid line loss interfering with electricity theft detection and causing inaccurate detection.
[0018] In the further optimized solution, in S2, the training process of the electricity theft detection model includes:
[0019] Constructing a training sample including the feature data, and preprocessing the training sample based on an autonomous mechanism;
[0020] Select the penalty parameter C>0, construct and solve the convex quadratic programming problem based on the training samples obtained after preprocessing:
[0021]
[0022] Get the optimal solution where λ i , j is the Lagrange multiplier, and λ i ≥0,λ j ≥0;y i ,y j are x in samples i and j respectively. i 、x j The corresponding output, N is the number of training samples, is the preprocessed feature data in sample i, is the preprocessed feature data in sample j;
[0023] Then calculate And select λ * A component of Satisfy the conditions calculate
[0024] Finally, find the separating hyperplane ω * ·x+b * =0, the classification decision function is: f(x)=sign(w * ·x+b * ),ω * Is Composition parameter matrix, b* Is Form the bias matrix.
[0025] In the above scheme, the self-attention mechanism is combined with the support vector machine. The self-attention mechanism is used to explore the relationship between feature data, and then SVM is used to classify the data after the relationship is mined, and then electricity theft identification is realized. By fully mining the relationship between feature data, electricity theft identification can be performed more accurately, and the accuracy of the detection results can be improved.
[0026] In a second aspect, the present invention provides a SVM power theft detection system based on a self-attention mechanism, comprising:
[0027] The characteristic data analysis module is used to analyze the characteristic data of the measured object according to the collected power load data and terminal alarm data, and the characteristic data includes the power consumption decline slope, line loss growth rate and alarm number within a set time period;
[0028] The electricity theft detection module is used to pre-process the feature data based on the self-attention mechanism, input the pre-processed feature data into a pre-trained electricity theft detection model, and output a classification result of whether there is suspicion of electricity theft;
[0029] The data reporting module is used to report the identification number of the metering terminal, the power consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period to the edge terminal when the classification result is suspected of power theft.
[0030] In a third aspect, the present invention provides a computer program product, comprising computer-readable instructions, which, when executed by a processor, implement the steps of the SVM power theft detection method based on the self-attention mechanism of the present invention.
[0031] In a fourth aspect, the present invention provides a computer-readable storage medium comprising computer-readable instructions, which, when executed by a processor, implement the steps of the SVM power theft detection method based on the self-attention mechanism of the present invention.
[0032] In a fifth aspect, the present invention provides an electronic device, comprising: a memory storing program instructions; a processor connected to the memory, executing the program instructions in the memory, and implementing the steps in the SVM power theft detection method based on the self-attention mechanism of the present invention.
[0033] Compared with the prior art, the present invention has the following advantages: the characteristic data is obtained by analyzing the actual data, and the characteristic data is classified and identified by using the machine learning model, which can automatically detect the user meters suspected of electricity theft, and is more objective and accurate, reducing the misjudgment rate. By reporting the recent electricity usage information of the suspected user, it can help the auditors narrow the scope of locating the electricity theft user and make a diagnosis, so as to achieve accurate positioning.
[0034] Other advantages of the present invention will be analyzed in more detail in subsequent embodiments. BRIEF DESCRIPTION OF THE DRAWINGS
[0035] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.
[0036] Figure 1 This is a chart analyzing the decreasing trend of electricity consumption.
[0037] Figure 2 Schematic diagram of the embedding operation in the self-attention mechanism.
[0038] Figure 3 Schematic diagram of the first q,k operation in the self-attention mechanism.
[0039] Figure 4 Schematic diagram of the second q, k operation in the self-attention mechanism.
[0040] Figure 5 Schematic diagram of the third q, k operation in the self-attention mechanism.
[0041] Figure 6 It is a schematic diagram of the station area topology of the present invention.
[0042] Figure 7 This is a flow chart of electricity theft detection according to the present invention. DETAILED DESCRIPTION
[0043] The technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are only a part of the embodiments of the present invention, rather than all the embodiments. The components of the embodiments of the present invention generally described and shown in the drawings here can be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of the present invention provided in the drawings is not intended to limit the scope of the claimed invention, but merely represents the selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative work belong to the scope of protection of the present invention.
[0044] The method of the present invention is applied to an intelligent measuring switch and is implemented with the help of the intelligent measuring switch as a carrier. The intelligent measuring switch includes a measuring module, an HPLC communication module, a 485 communication module, a Bluetooth module, a topology identification module, and an ARM chip. The measuring module is responsible for sampling the current and voltage passing through the intelligent measuring switch, and is used to calculate relevant parameters such as current, voltage, active power, reactive power, apparent power, leakage current, etc. in the line, as a prerequisite module for triggering various protection functions. The HPLC communication module, the 485 communication module, and the Bluetooth module serve as communication modules of the intelligent measuring switch, and report various parameters and events of the intelligent measuring switch. At the same time, they support these three types of communications to actively read the relevant parameters of the intelligent measuring switch, as well as to perform remote parameter settings, remote power-off, and other operations. The topology identification module is responsible for topological identification of the intelligent devices in the substation where the measuring switch is located. The topological structure can be found in Figure 6 As an example, the ARM chip is used as the core of the intelligent measurement switch to execute the program compiled based on the SVM power theft detection method based on the self-attention mechanism of the present invention to control the function operation of each module.
[0045] See also Figure 7 In this embodiment, a method for detecting power theft using a SVM based on a self-attention mechanism is provided, comprising the following steps:
[0046] S1, collect power load data and terminal alarm data, and analyze the collected data to obtain characteristic data of the measured object, wherein the characteristic data includes the power consumption decline slope, line loss growth rate, and alarm number within a set time period (e.g., ten days).
[0047] The object being measured can be understood as the meter user, but more accurately it is the meter terminal corresponding to the meter user, because these data are all generated based on the meter terminal.
[0048] The edge terminal of the low-voltage substation where the intelligent measuring switch is located reads the meter for the power consumption and alarm information of the equipment under its own substation, and analyzes the power consumption decline slope, line loss growth rate and number of alarms within the set time period.
[0049] S2, preprocessing the feature data based on a self-attention mechanism, and inputting the preprocessed feature data into a pre-trained electricity theft detection model, and outputting a classification result of whether there is suspicion of electricity theft.
[0050] S3: If the classification result is suspected of electricity theft, the identification number of the metering terminal, the electricity consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period are reported to the edge terminal.
[0051] The metering terminal is a device that can measure electricity, such as an electric meter, a circuit breaker, a measuring switch, etc. The identification number can be a communication address, a meter number, an asset management code, etc., which is used to distinguish the device.
[0052] See also Figure 7 The electricity theft detection model in step S2 is obtained based on the self-attention mechanism and SVM training. Specifically, the training process of the electricity theft detection model is as follows:
[0053] S2-1, data collection and compilation.
[0054] Collect data related to electricity theft, including electricity load data, terminal alarm data, penalty information for electricity theft due to breach of contract, and user profiles. Set users who are unlikely to steal electricity (such as government agencies) as whitelist users and remove them from the electricity theft data set. The electricity consumption on holidays is lower than that on weekdays, so holiday data can be filtered. If there are missing data features, interpolation can be used to fill in the missing data when the number of missing data is small.
[0055] Through analysis, it is found that the power consumption of normal users is relatively stable, while the power consumption of power thieves shows a downward trend after the power theft occurs, and then tends to be flat. Therefore, the days before and after can be used as the statistical window period, and the downward trend during the period can be considered. The slope obtained by linear fitting of electric energy can be used as the measurement standard. If the slope continues to decrease over time, then the possibility of the user stealing electricity is relatively high, such as Figure 1 Therefore, using the power consumption decline slope as an evaluation indicator has a good indicative effect.
[0056] For the collection of the power consumption decline slope data, set the N days before and after the statistical day as the statistical window period, and calculate the power consumption decline within the 2N+1 days. First, calculate the power consumption trend of each day in the 2N+1 days, where the power consumption trend of the i-th day is the power consumption slope of the N days before and after, that is:
[0057]
[0058] in: k i is the electricity consumption trend on the i-th day, fl is the electricity consumption on day l, l is the number of days, f i is the electricity consumption on the i-th day, l i is the i-th day in the statistical window period, and N is an integer greater than 1.
[0059] If the electricity consumption trend is continuously decreasing, there is a certain suspicion of electricity theft. Therefore, calculate the number of days in which the electricity consumption trend of the current day is decreasing compared with the electricity consumption trend of the previous day within these N days, that is:
[0060] Then the electricity consumption decline slope index within N days is:
[0061] The line loss rate is a measure of the ratio of circuit loss. At the same time, the line loss rate of the line to which the user belongs is calculated based on the topological relationship of the line user. A line supplies power to multiple users at the same time. If the line power supply on the lth day is s l , then the total power consumption of each user on the line is: m represents the number of users on the same line. Then the line loss rate is:
[0062] The line loss rate of the line can be used as a reference value for the user's line loss rate. If the user steals electricity, the line loss rate of the day will increase. However, due to the fluctuation of the user's daily electricity consumption, simply using the increase in the line loss rate of the day as a feature of electricity theft will have a large error. Therefore, the average line loss rate of the previous N days is used to determine whether its growth rate is greater than a set threshold (for example, 1%). If the line loss rate growth rate is greater than the set threshold, it is considered that the user may steal electricity.
[0063] Set a statistical window period of N days before and after the statistical day (the same as N for calculating the power consumption decline trend above). First, calculate the average line loss rate V between the current day and the previous N days. i 1 and the average line loss V between the current day and the next N days i 2 , if V i 1 V i 2 If the growth rate is greater than 1%, it is considered to be suspected of electricity theft. The line loss growth rate indicator is defined as:
[0064] Terminal alarms related to electricity theft mainly include voltage phase loss, current reverse polarity, etc. The total number of terminal alarms related to electricity theft is calculated as the alarm indicator. The length of the alarm count is the window period of 2N+1 days. In other words, the alarm count indicator is defined as: the total number of terminal alarms within the statistical window period of N days before and after the statistical day (the same as the N days for calculating the power decline trend above) within these 2N+1 days.
[0065] S2-2, construct a sample set for electricity theft detection.
[0066] Based on the characteristics of the power consumption decline slope, line loss growth rate, and alarm times, samples are constructed in combination with the label of whether the power is stolen or leaked, and all samples form a sample set. An example of the form of a sample data is shown in Table 1:
[0067] Table 1: Sample examples
[0068] user Power consumption decline slope Line loss growth rate Number of alarms Is it stealing electricity? 1 5 1 3 yes
[0069] S2-3, build and train a power theft detection model.
[0070] The sample set is divided into test samples and training samples, for example, 20% are randomly selected as test samples and the remaining samples are used as training samples. The present invention uses a support vector machine to construct an electricity theft detection model, but pre-processes the input data of the model based on a self-attention mechanism in advance, and uses the self-attention mechanism to fully explore the relationship between feature data, thereby improving the accuracy of the detection results.
[0071] For the training samples, the preprocessing based on the self-attention mechanism performs the following operations (1)-(3) in sequence.
[0072] (1) Embedding operation
[0073] For the training samples, the embedding operation is performed. Here, the Word2Vec method is used, and the calculation formula is a i =Wx i , get the new vector a 1 ,a 2 ,a 3 ,...,a n , i = 1, 2, 3, ..., n, n is the number of training samples, such as Figure 2 shown.
[0074] Where W represents the embedded parameter matrix, a is the input vector after the embedding operation, x is the feature data in the sample, and x i Represents the feature data in sample i.
[0075] (2)q,k operation
[0076] First, after the embedding operation, each a 1 ,a 2 ,a 3 ,a 4 (This is for the sake of abbreviated, only 4 are used as an example, in fact there are n, that is, a 1 ,a 2 ,a 3,...,a n ) are multiplied by three matrices, namely matrix q, matrix k, and matrix v; matrices q, k, and v are shared throughout the process, such as Figure 3 As shown, the formula is as follows:
[0077] q i =W q a i ;
[0078] k i =W k a i ;
[0079] v i =W v a i ;
[0080] Where i = 1, 2, 3, ..., n, q (Query) is used to match with other data elements, or more precisely, to calculate the association or relationship between the current element and other elements; k (Key) is used to match with q, and can also be understood as the key information of the element. q , W k , W v are weight vectors.
[0081] Then, if Figure 4 As shown, calculate a 1 and a 2 ,a 3 ,a 4 The relationship or association between them is calculated as follows:
[0082] Here i = 2, 3, 4;
[0083] Where: d represents the matrix dimensions of q and k. In the self-attention mechanism, the dimensions of q and k are the same. Follow the same process and calculate a at the same time 2 、a 3 、a 4 The relationship or association with other elements can be expressed as
[0084] Finally, for α 1,i Perform softmax operation and get like Figure 5 The formula is as follows:
[0085]
[0086] Following the same process, 1,i , α 2,i , α 3,i, α 4,i Performing softmax operation can be expressed as
[0087] (3) v operation
[0088] Specifically, for each element in the sequence, the self-attention mechanism calculates the similarity between it and other elements and normalizes these similarities into attention weights. Then, the output of the self-attention mechanism can be obtained by weighted summing each element with the corresponding attention weight. The calculation formula is as follows:
[0089] Support Vector Machine (SVM) is a supervised learning method that is widely used in statistical classification and regression analysis. Support Vector Machine (SVM) is a very common classifier. The core idea is to separate data by constructing a segmentation surface.
[0090] (4) Support Vector Machine (SVM) Classification Prediction
[0091] First, select the penalty parameter C>0, and construct and solve the convex quadratic programming problem based on the training samples obtained after preprocessing:
[0092]
[0093] Get the optimal solution where λ i , j is the Lagrange multiplier, and λ i ≥0,λ j ≥0;y i ,y j are x in samples i and j respectively. i 、x j The corresponding output, N is the number of training samples, is the preprocessed feature data in sample i, is the preprocessed feature data in sample j.
[0094] Then calculate And select λ * A component of Satisfy the conditions calculate
[0095] Finally, find the separating hyperplane ω * ·x+b * =0, the classification decision function is: f(x)=sign(w * ·x+b * ).* Is Composition parameter matrix, b * Is Form the bias matrix.
[0096] Through logistic regression model training, the electricity theft detection model is obtained after convergence. When the output result of f(x) is 1, it is judged that there is a suspicion of electricity theft. When the output result of f(x) is 0, it is considered that there is no suspicion of electricity theft.
[0097] Based on the same inventive concept, this embodiment also provides an SVM power theft detection system based on a self-attention mechanism, including:
[0098] The characteristic data analysis module is used to analyze the characteristic data of the measured object according to the collected power load data and terminal alarm data, and the characteristic data includes the power consumption decline slope, line loss growth rate and alarm number within a set time period;
[0099] The electricity theft detection module is used to pre-process the feature data based on the self-attention mechanism, input the pre-processed feature data into a pre-trained electricity theft detection model, and output a classification result of whether there is suspicion of electricity theft;
[0100] The data reporting module is used to report the identification number of the metering terminal, the power consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period to the edge terminal when the classification result is suspected of power theft.
[0101] For the specific processing of each module, please refer to the relevant description in the aforementioned method steps, which will not be repeated here.
[0102] This embodiment also provides an electronic device, which may include a processor and a memory, wherein the memory is coupled to the processor. The electronic device may also include an input unit, a display unit, and a power supply. The processor is sometimes also called a controller or an operation control, and may include a microprocessor or other processor device and / or a logic device, which receives input and controls the operation of various components of the electronic device.
[0103] The memory may be, for example, one or more of a cache, a flash memory, a hard drive, a removable medium, a volatile memory, a non-volatile memory or other suitable devices, and may store information such as configuration information of the processor 41, instructions executed by the processor, etc. The processor may execute the program stored in the memory to implement information storage or processing, etc. In one embodiment, the memory also includes a buffer memory, i.e., a buffer, to store intermediate information.
[0104] An embodiment of the present invention further provides a computer program product, including computer-readable instructions. When the computer-readable instructions are executed in an electronic device, the program product enables the electronic device to execute the operation steps included in the method of the present invention.
[0105] An embodiment of the present invention further provides a storage medium storing computer-readable instructions, wherein the computer-readable instructions enable an electronic device to execute the operation steps included in the method of the present invention.
[0106] If the integrated unit is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention is essentially or the part that contributes to the prior art, or all or part of the technical solution can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk and other media that can store program codes.
[0107] Those of ordinary skill in the art will appreciate that the modules of each example described in conjunction with the embodiments disclosed herein can be implemented with electronic hardware, computer software, or a combination of the two. In order to clearly illustrate the interchangeability of hardware and software, the constituent modules and steps of each example have been generally described in terms of function in the above description. Whether these functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professional and technical personnel can use different methods to implement the described functions for each specific application, but such implementation should not be considered to be beyond the scope of the present invention.
[0108] The above description is only a specific implementation mode of the present invention, but the protection scope of the present invention is not limited thereto. Any technician familiar with the technical field can easily think of changes or substitutions within the technical scope disclosed by the present invention, which should be covered by the protection scope of the present invention.
Claims
1. A SVM power theft detection method based on self-attention mechanism, characterized in that: The following steps are involved: S1, collecting power load data and terminal alarm data, and analyzing the collected data to obtain characteristic data of the measured object, wherein the characteristic data includes the power consumption decline slope, line loss growth rate, and alarm number within a set time period; S2, preprocessing the feature data based on a self-attention mechanism, and inputting the preprocessed feature data into a pre-trained electricity theft detection model, and outputting a classification result of whether there is suspicion of electricity theft; S3: If the classification result is suspected of electricity theft, the identification number of the metering terminal, the electricity consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period are reported to the edge terminal.
2. The SVM power theft detection method based on self-attention mechanism according to claim 1 is characterized in that: In S1, the process of obtaining the decreasing slope of the power consumption of the measured object according to the collected data analysis includes: Set N days before and after the statistical day as the statistical window period, calculate the daily power consumption trend in these 2N+1 days, and the power consumption trend on the i-th day is in k i is the electricity consumption trend on the i-th day, f l is the electricity consumption on day l, l is the number of days, f i is the electricity consumption on the i-th day, l i is the i-th day in the statistical window period, and N is an integer greater than 1; Calculate the number of days within N days when the power consumption trend on the current day is decreasing compared to the power consumption trend on the previous day, as the power consumption decline slope indicator, 3. The SVM power theft detection method based on self-attention mechanism according to claim 2 is characterized in that: In S1, the processing of obtaining the line loss growth rate of the measured object according to the analysis of the collected data includes: Set the N days before and after the statistical day as the statistical window period, and calculate the average line loss rate V between the current day and the previous N days i 1 and the average line loss V between today and the next N days i 2 , the line loss growth rate index is: The line loss rate is: s l represents the line power supply on day l, ∑ m f l (m) represents the total power consumption of each user on the line, m represents the number of users on the same line, and k is the set threshold.
4. The SVM power theft detection method based on self-attention mechanism according to claim 3 is characterized in that: In S1, the processing of obtaining the alarm number of the measured object according to the analysis of the collected data includes: counting the sum of the alarm number within the statistical window period as the alarm number indicator.
5. The SVM power theft detection method based on self-attention mechanism according to claim 1 is characterized in that: In S2, the step of preprocessing the feature data based on the self-attention mechanism includes: The characteristic data is firstly passed through formula a i =Wx i Perform embedding operation; W represents the embedded parameter matrix, a i represents the input vector of sample i after the embedding operation, x i represents the feature data in sample i; Then perform q, k operations three times in sequence according to the formula: q i =W q a i , k i =W k a i , v i =W v a i ; W q , W k , W v are all weight vectors, d represents the matrix dimension of q and k; Then by the formula Execute the v operation to obtain the preprocessed feature data.
6. The SVM power theft detection method based on self-attention mechanism according to claim 5 is characterized in that: In S2, the training process of the electricity theft detection model includes: Constructing a training sample including the feature data, and preprocessing the training sample based on an autonomous mechanism; Select the penalty parameter C>0, construct and solve the convex quadratic programming problem based on the training samples obtained after preprocessing: Get the optimal solution where λ i , j is a Lagrange multiplier, and λ i ≥0,λ j ≥0;y i ,y j are x in samples i and j respectively. i 、x j The corresponding output, N is the number of training samples, is the preprocessed feature data in sample i, is the preprocessed feature data in sample j; Then calculate And select λ * A component of Satisfy the conditions calculate Finally, find the separating hyperplane ω * ·x+b * =0, the classification decision function is: f(x)=sign(w * ·x+b * ),ω * Is Composition parameter matrix, b * Is Form the bias matrix.
7. A SVM power theft detection system based on self-attention mechanism, characterized in that: include: The characteristic data analysis module is used to analyze the characteristic data of the measured object according to the collected power load data and terminal alarm data, and the characteristic data includes the power consumption decline slope, line loss growth rate and alarm number within a set time period; The electricity theft detection module is used to pre-process the feature data based on the self-attention mechanism, input the pre-processed feature data into a pre-trained electricity theft detection model, and output a classification result of whether there is suspicion of electricity theft; The data reporting module is used to report the identification number of the metering terminal, the power consumption within the set time period, the alarm information within the set time period, and the summary data of the line loss within the set time period to the edge terminal when the classification result is suspected of power theft.
8. A computer program product comprising computer readable instructions, characterized in that: The computer-readable instructions, when executed by a processor, implement the steps in the SVM power theft detection method based on the self-attention mechanism as described in any one of claims 1 to 6.
9. A computer-readable storage medium comprising computer-readable instructions, characterized in that: The computer-readable instructions, when executed by a processor, implement the steps in the SVM power theft detection method based on the self-attention mechanism as described in any one of claims 1 to 6.
10. An electronic device, characterized in that: include: Memory, which stores program instructions; A processor is connected to the memory, executes program instructions in the memory, and implements the steps in the SVM power theft detection method based on the self-attention mechanism according to any one of claims 1 to 6.
