Abnormal subsequence detection method and device for enterprise electrical load data

CN118780939APending Publication Date: 2024-10-15STATE GRID JIANGSU ELECTRIC POWER CO LTD SUZHOU BRANCH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410716686.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-06-04
Publication Date
2024-10-15

AI Technical Summary

Technical Problem

Existing time series abnormal pattern recognition algorithms ignore the problem of category distinction when detecting abnormal subsequences of enterprise electricity load data. The parameter settings are complicated and the time complexity is high. It is difficult to apply to large-scale data processing and cannot detect dynamics in time. Unusual subsequences in data streams.

Method used

The minimum bounding rectangle is combined with binary representation to represent the enterprise's electricity load time series data, calculate the similarity, build an abnormal subsequence detection algorithm based on the K-Modes algorithm, build an online detection framework, and use Apache Pulsar to achieve real-time detection.

Benefits of technology

It effectively improves the efficiency of monitoring the power consumption of enterprises, can detect and judge abnormal sub-sequences in a timely manner, and improves the ability to process dynamic data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118780939A_ABST
    Figure CN118780939A_ABST
Patent Text Reader

Abstract

The invention discloses an abnormal subsequence detection method and device for enterprise electrical load data, and the method specifically comprises five tasks which are executed in sequence: (1) employing the combination of a minimum boundary rectangle and binary representation, and representing the time sequence data of the enterprise electrical load; (2) calculating the similarity between the expressed sequences; (3) constructing an abnormal subsequence detection algorithm based on K-Modes; (4) constructing an online detection framework of the abnormal subsequences; and (5) implementation of an abnormal subsequence detection method based on Apache Pulsar. On the basis of actual enterprise power utilization load data, the provided AbnormalsubseqDesection Method is verified, the abnormal subsequences in the data can be effectively detected, and the supervision efficiency of the enterprise power utilization condition is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of abnormal subsequence detection of power load data, and also belongs to the technical field of data mining and power big data processing, and specifically relates to an abnormal subsequence detection method and device for enterprise power load data. Background Art

[0002] As a typical representative of data, time series is widely used in many research fields. Abnormal patterns in time series represent the emergence of special situations and are of great significance in many fields. In the field of power big data, in order to quickly, accurately and efficiently detect anomalies in enterprise power load data, as pointed out in the prior art solution with patent application number "CN202010439761.2" and patent name "A method and system for joint prediction of net load of distribution network", relevant researchers have proposed a series of models and methods.

[0003] However, most of the existing time series anomaly pattern recognition algorithms simply detect abnormal subsequences, ignoring the problem of classifying abnormal subsequences, and many parameters need to be set manually, which has high time complexity and cannot be directly applied to processing large-scale enterprise power load time series data. In addition, enterprise power load time series data is continuously generated over time, so it is also very important to timely discover abnormal subsequences from the dynamic enterprise power load time series data stream. It is necessary to find the most abnormal subsequence in the current queue in time, and determine whether the most abnormal subsequence in the current queue is a real anomaly. When an anomaly occurs, an alarm or other processing is performed in time. Summary of the invention

[0004] In order to solve the defects existing in the prior art, the present invention proposes an abnormal subsequence detection method (Abnormal_Subseq_Detection_Method) and a device for enterprise power load data, which use a minimum bounding rectangle combined with a binary representation to represent the enterprise power load time series data; calculate the similarity between the represented enterprise power load time series data; construct an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the represented enterprise power load time series data; construct an online detection framework for abnormal subsequences; implement the online detection framework for abnormal subsequences based on the function of Apache Pulsar, and verify the proposed abnormal subsequence detection method for enterprise power load data based on actual enterprise power load data. The method can effectively improve the efficiency of supervision of enterprise power consumption.

[0005] The present invention utilizes the following technical solutions.

[0006] A method for detecting abnormal subsequences of enterprise power load data, comprising:

[0007] Step 1: Use the minimum bounding rectangle combined with binary representation to represent the enterprise power load time series data;

[0008] Step 2: Calculate the similarity between the enterprise power load time series data represented;

[0009] Step 3: Construct an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented;

[0010] Step 4: Construct an online detection framework for abnormal subsequences;

[0011] Step 5: Implement an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.

[0012] Preferably, in step 1, the minimum bounding rectangle refers to a method in geometry of using a minimum bounding rectangle to include a set of high-dimensional space points.

[0013] Preferably, in step 1, the minimum bounding rectangle is used to represent the enterprise power load time series data, including the following steps:

[0014] Step 1-1: Cut the subsequences of the enterprise power load time series data into equal lengths, that is, divide the subsequences of the extracted time series data into several segments of equal lengths, and use a minimum bounding rectangle to enclose the time series data in each segment to form a minimum bounding rectangle representation;

[0015] Step 1-2: Combine the minimum bounding rectangle representation with the binary representation to represent the enterprise power load time series data.

[0016] Preferably, in step 1-1 and step 1-2, the minimum bounding rectangle representation and the binary representation are combined to represent the enterprise power load time series data, and the specific process is as follows:

[0017] Step 1-2-1: For the given enterprise power load time series data T, slide one data point at a time from the beginning to the end through a given fixed-size sliding window to extract all subsequences T sub ={T1, T2, T3, ..., T n}, where T i represents the i-th subsequence, where i is an integer from 1 to n;

[0018] Step 1-2-2: For each subsequence T i Divide into j segments of equal length and calculate T of each segment of the subsequence ikThe minimum value low_value and the maximum value high_value of ik (low_value,high_value),T ik represents the kth segment of the i-th subsequence, thereby forming a minimum bounding rectangle representation;

[0019] Step 1-2-3: Divide the variation range of the enterprise power load time series data into n equally divided regions, and calculate the maximum and minimum value tuples T of each segment of each subsequence obtained in step 1-2-2. ik (low_value, high_value) is compared with the divided area range to obtain the coverage area of ​​each subsequence and each segment. The covered area is marked as "1" and the uncovered area is marked as "0". The binary representation is obtained based on this, thereby realizing the combination of the minimum bounding rectangle representation and the binary representation to represent the enterprise power load time series data.

[0020] Preferably, in step 2, the similarity between the enterprise power load time series data represented is calculated, which includes the following steps:

[0021] Define the distance formula of the subsequence after the representation, that is, use formula (1) to calculate the distance between subsequence 1 and subsequence 2:

[0022]

[0023] Among them, S1 and S2 are the forms of subsequence 1 represented by steps 1-2 {a1, a2, ... a N} and subsequence 2 of the form {b1,b2,…b N}, aj is the jth element in the binary representation of subsequence 1, b j is the jth element in the binary representation of subsequence one, j is an integer from 1 to N, N is a natural number, and the distance between subsequence one and subsequence two is the similarity between subsequence one and subsequence two.

[0024] Preferably, in step 3, an abnormal subsequence detection algorithm based on K-Modes is constructed according to the similarity between the enterprise power load time series data represented, comprising the following steps:

[0025] Step 3-1: Define the degree of abnormality. The degree of abnormality is for the enterprise power load time series data T. M is a subsequence in T. The distance between M and its nearest non-self-matching subsequence is the degree of abnormality of M.

[0026] Step 3-2: Set an abnormal subsequence detection algorithm for power load data based on K-Modes according to the defined abnormality degree.

[0027] Preferably, in step 3-2, the algorithm description of the abnormal subsequence detection algorithm of the power load data based on K-Modes is as follows:

[0028] Step 3-2-1: Initialize the abnormal subsequence position and abnormality degree;

[0029] Step 3-2-2: Extract all subsequences and convert them into their minimum bounding rectangle representations, then cluster the minimum bounding rectangle representations converted from all subsequences based on the K-Modes algorithm to obtain the corresponding clustering results as candidate subsequences;

[0030] Step 3-2-3: Generate an outer loop based on the clustering results, and nest the inner loop execution;

[0031] Preferably, in step 3-2-3, an outer loop is generated according to the clustering result and the inner loop is nested for execution, including the following steps:

[0032] Step 3-2-3-1: The outer loop traverses the candidate subsequences, detects all candidate subsequences one by one as the current candidate subsequences and initializes the nearest neighbor distance of the current candidate subsequence p;

[0033] Step 3-2-3-2: Execute the inner loop to find the subsequence q with the nearest non-self-matching distance of the current candidate subsequence;

[0034] Step 3-2-3-3: If the distance between candidate subsequence p and candidate subsequence q is less than the abnormality of the currently initialized abnormal subsequence, exit the inner loop;

[0035] Step 3-2-3-4: If the distance between candidate subsequence p and candidate subsequence q is less than the nearest neighbor distance of the current candidate subsequence p, update the nearest neighbor distance of the current candidate subsequence p to the distance between candidate subsequence p and candidate subsequence q;

[0036] Step 3-2-3-5: If the nearest neighbor distance of the current candidate subsequence p is greater than the abnormality of the current initial abnormal subsequence;

[0037] Step 3-2-3-6: Update the initialized abnormal subsequence position and abnormality to the current candidate subsequence p position and the nearest neighbor distance of the current candidate subsequence p;

[0038] Step 3-2-3-7: Return the updated initialization abnormal subsequence position and abnormality degree. The subsequence corresponding to the updated initialization abnormal subsequence position is the abnormal subsequence.

[0039] Preferably, in step 4, an online detection framework for abnormal subsequences is constructed, and its implementation algorithm is described as follows:

[0040] Step 4-1: Read data from the data stream of the enterprise power load time series until the queue with a set length of m is full;

[0041] Step 4-2: Get the abnormal subsequence detection algorithm for the queue and return the position and degree of abnormal subsequence with the highest abnormality;

[0042] Step 4-2: Store the returned abnormality into the abnormality history data;

[0043] Step 4-3: Continue to read the subsequent enterprise power load time series data stream into the queue and perform the following process:

[0044] Read a new data from the data stream into the queue and delete the first data from the queue; call the abnormal subsequence detection algorithm on the queue and return the subsequence position with the highest abnormality and its abnormality; if the abnormal subsequence position is different from the abnormal subsequence position at the previous moment, it is a real abnormality and an alarm is issued; update the abnormal position at the previous moment to the current abnormal subsequence position; store the abnormality degree of the current abnormal subsequence.

[0045] Preferably, in step 5, an online detection framework for abnormal subsequences is implemented based on the function of Apache Pulsar, comprising the following steps:

[0046] Step 5-1: Build a server cluster. The computer hardware configuration standard in the cluster must not be lower than the configuration requirements of Apache Pulsar;

[0047] Step 5-2: Deploy Apache Pulsar on the server cluster;

[0048] Step 5-3: Based on Apache Pulsar, set its topics and partitions. First, determine whether the number of Kafka topics is empty; if it is not empty, determine the number of partitions in the topic; if the number of partitions is not empty and the required number of partitions does not exceed the default number of partitions in Kafka, the electricity consumption time series data of different enterprises to be tested will be distributed to different partitions according to key value calculation, and then output in the form of data stream;

[0049] Step 5-4: Implement the abnormal subsequence detection algorithm based on the Java program.

[0050] An abnormal subsequence detection device for enterprise power load data, comprising:

[0051] A representation module, which is used to represent the enterprise power load time series data by combining the minimum bounding rectangle with the binary representation;

[0052] A detection module, which is used to calculate the similarity between the time series data of the enterprise power load represented;

[0053] A construction module for constructing an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented;

[0054] A framework module, which is used to build an online detection framework for abnormal subsequences;

[0055] Implements a module for implementing an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.

[0056] The beneficial effects of the present invention are that, compared with the prior art, the technical effects of the present invention include:

[0057] The enterprise power load time series data is represented by combining the minimum bounding rectangle with the binary representation; the similarity between the represented enterprise power load time series data is calculated; an abnormal subsequence detection algorithm based on K-Modes is constructed according to the similarity between the represented enterprise power load time series data; an online detection framework for abnormal subsequences is constructed; the online detection framework for abnormal subsequences is implemented based on the function of Apache Pulsar, and the proposed abnormal subsequence detection method for enterprise power load data is verified based on the actual enterprise power load data. This method can effectively improve the efficiency of supervision of enterprise power consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0058] Figure 1 is a flow chart of the abnormal subsequence detection method for enterprise power load data described in the present invention;

[0059] Figure 2 It is a schematic diagram of the architecture of the abnormal subsequence detection device for enterprise power load data described in the present invention. DETAILED DESCRIPTION

[0060] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely expressed in combination with the drawings in the embodiments of the present invention. The embodiments expressed in this application are only part of the embodiments of the present invention, not all of them. According to the spirit of the present invention, other embodiments obtained by ordinary technicians in this field without creative work are all within the protection scope of the present invention.

[0061] like Figure 1 As shown, the abnormal subsequence detection method for enterprise power load data according to the present invention includes:

[0062] Based on the design idea of ​​comparison, the clustering results of the bit representation of the minimum bounding rectangle of the subsequence are used to inspire the search order of the abnormal subsequence, which is a feasible method to improve the efficiency of abnormal subsequence detection. Among them, the K-Modes clustering method is used in a targeted manner, which is suitable for the clustering of discrete attributes. On this basis, considering the characteristics of the stream data of the time series, the online detection of abnormal subsequences of the enterprise power load data is proposed and implemented.

[0063] Based on the above ideas, an abnormal subsequence detection method Abnormal_Subseq_Detection_Method for enterprise power load data is proposed. The method specifically includes five tasks that are executed in sequence, namely:

[0064] Step 1: Use the minimum bounding rectangle combined with binary representation to represent the enterprise power load time series data;

[0065] Step 2: Calculate the similarity between the enterprise power load time series data represented;

[0066] Step 3: Construct an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented;

[0067] Step 4: Construct an online detection framework for abnormal subsequences;

[0068] Step 5: Implement an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.

[0069] In a preferred but non-limiting embodiment of the present invention, in step 1, the minimum bounding rectangle refers to a method in geometry to include a set of high-dimensional space points using a minimum bounding rectangle. The purpose of representing the enterprise-oriented power load data is to improve the efficiency of abnormal subsequence detection. All subsequences will be extracted, and similar subsequences will be mapped to similar minimum bounding rectangles, and the method of segmenting the time series subsequences has no effect.

[0070] In a preferred but non-limiting embodiment of the present invention, in step 1, the enterprise power load time series data is represented using a minimum bounding rectangle, including the following steps:

[0071] Step 1-1: Cut the subsequences of the enterprise power load time series data into equal lengths, that is, divide the subsequences of the extracted time series data into several segments of equal lengths, and use a minimum bounding rectangle to enclose the time series data in each segment to form a minimum bounding rectangle representation;

[0072] Step 1-1 is to cut the subsequences of the enterprise power load time series data into equal lengths, that is, to divide the extracted subsequence data of the time series into several segments of equal lengths, and to use a minimum boundary rectangle to surround the time series data in each segment.

[0073] Step 1-2: Combine the minimum bounding rectangle representation with the binary representation to represent the enterprise power load time series data.

[0074] In a preferred but non-limiting embodiment of the present invention, in step 1-1 and step 1-2, the minimum bounding rectangle representation and the binary representation are combined to represent the enterprise power load time series data, and the specific process is as follows:

[0075] Step 1-2-1: For the given enterprise power load time series data T, slide one data point at a time from the beginning to the end through a given fixed-size sliding window to extract all subsequences T sub ={T1, T2, T3, ..., T n}, where T i represents the i-th subsequence, where i is an integer from 1 to n;

[0076] Step 1-2-1 is to extract all subsequences T from a given enterprise power load time series T through a sliding window of a given fixed length and a sliding step of 1. sub ={T1, T2, T3, ..., T n}.

[0077] Step 1-2-2: For each subsequence T i Divide into j segments of equal length and calculate T of each segment of the subsequence ik The minimum value low_value and the maximum value high_value of ik (low_value,high_value),T ik represents the kth segment of the i-th subsequence, thereby forming a minimum bounding rectangle representation;

[0078] Step 1-2-3: Divide the variation range of the enterprise power load time series data into n equally divided regions, and calculate the maximum and minimum value tuples T of each segment of each subsequence obtained in step 1-2-2. ik (low_value, high_value) is compared with the divided area range to obtain the coverage area of ​​each subsequence and each segment. The covered area is marked as "1" and the uncovered area is marked as "0". The binary representation is obtained based on this, thereby realizing the combination of the minimum bounding rectangle representation and the binary representation to represent the enterprise power load time series data.

[0079] In a preferred but non-limiting embodiment of the present invention, in step 2, the similarity between the enterprise power load time series data represented is calculated, which includes the following steps:

[0080] Define the distance formula of the subsequence after the representation, that is, use formula (1) to calculate the distance between subsequence 1 and subsequence 2:

[0081]

[0082] Among them, S1 and S2 are the forms of subsequence 1 represented by steps 1-2 {a1, a2, ... a N} and subsequence 2 of the form {b1,b2,…b N}, aj is the jth element in the binary representation of subsequence 1, b j is the jth element in the binary representation of subsequence 1, j is an integer from 1 to N, N is a natural number, and the distance between subsequence 1 and subsequence 2 is the similarity between subsequence 1 and subsequence 2. Obviously, formula (1) shows that the distance between two subsequences represented by the minimum bounding rectangle is 1 minus the number of areas they occupy together divided by the total number of areas they occupy.

[0083] K-Modes is a modified version of the traditional clustering algorithm K-Means. It solves the shortcoming that the K-Means method cannot be used for nominal attributes. It uses the cluster mode instead of the cluster mean to represent the center of the cluster.

[0084] In a preferred but non-limiting embodiment of the present invention, in step 3, an abnormal subsequence detection algorithm based on K-Modes is constructed according to the similarity between the enterprise power load time series data represented, comprising the following steps:

[0085] Step 3-1: Define the degree of abnormality. The degree of abnormality is for the enterprise power load time series data T. M is a subsequence in T. The distance between M and its nearest non-self-matching subsequence is the degree of abnormality of M. The distance between the nearest non-self-matching subsequence is the distance between the subsequence with the smallest distance to it except M itself. The subsequence with the smallest distance to it is the non-self-matching subsequence.

[0086] Step 3-2: Set an abnormal subsequence detection algorithm for power load data based on K-Modes according to the defined abnormality degree.

[0087] In a preferred but non-limiting embodiment of the present invention, in step 3-2, the algorithm description of the abnormal subsequence detection algorithm of the power load data based on K-Modes is as follows:

[0088] Input: time series T, subsequence length n

[0089] Output: abnormal subsequence position anomaly_loc and abnormal degree anomaly_dist.

[0090] Step 3-2-1: Initialize the abnormal subsequence position and abnormality degree; the initialization can be set randomly.

[0091] Step 3-2-2: Extract all subsequences and convert them into their minimum bounding rectangle representations, then cluster the minimum bounding rectangle representations converted from all subsequences based on the K-Modes algorithm to obtain the corresponding clustering results as candidate subsequences;

[0092] Step 3-2-3: Generate an outer loop based on the clustering results, and nest the inner loop execution;

[0093] In a preferred but non-limiting embodiment of the present invention, in step 3-2-3, the execution of the outer loop nested within the inner loop is generated according to the clustering result, including the following steps:

[0094] Step 3-2-3-1: for eachp in Torderedby external_order

[0095] / / The outer loop traverses the candidate subsequences, detects all candidate subsequences one by one as the current candidate subsequences and initializes the nearest neighbor distance of the current candidate subsequence p; this initialization can be set randomly.

[0096] Step 3-2-3-2: for each q in Torderedby internal_order

[0097] / / Execute the inner loop to find the subsequence q with the nearest non-self-matching distance of the current candidate subsequence; the distance of the nearest non-self-matching subsequence is the distance between the subsequences with the smallest distance to it except M itself. The subsequence with the smallest distance to it is the non-self-matching subsequence.

[0098] Step 3-2-3-3: If the distance between candidate subsequence p and candidate subsequence q is less than the abnormality of the currently initialized abnormal subsequence, exit the inner loop;

[0099] Step 3-2-3-4: If the distance between candidate subsequence p and candidate subsequence q is less than the nearest neighbor distance of the current candidate subsequence p, update the nearest neighbor distance of the current candidate subsequence p to the distance between candidate subsequence p and candidate subsequence q;

[0100] Step 3-2-3-5: If the nearest neighbor distance of the current candidate subsequence p is greater than the abnormality of the current initial abnormal subsequence;

[0101] Step 3-2-3-6: Update the initialized abnormal subsequence position and abnormality to the current candidate subsequence p position and the nearest neighbor distance of the current candidate subsequence p;

[0102] Step 3-2-3-7: Return the updated initialization abnormal subsequence position and abnormality degree. The subsequence corresponding to the updated initialization abnormal subsequence position is the abnormal subsequence.

[0103] The general framework of detecting abnormal subsequences in a time series is to first extract all subsequences of the time series through a sliding window, and then compare all subsequences with each other to find the subsequence that is least similar to the rest. The key to the algorithm is how to reduce the number of comparisons between subsequences.

[0104] Therefore, in a preferred but non-limiting embodiment of the present invention, in step 4, an online detection framework for abnormal subsequences is constructed, and its implementation algorithm is described as follows:

[0105] Input: time series data stream, subsequence length n, queue length m

[0106] Output: timely alarm when abnormality occurs

[0107] Step 4-1: Read data from the data stream of the enterprise power load time series until the queue with a set length of m is full;

[0108] Step 4-2: Get the abnormal subsequence detection algorithm for the queue and return the position and degree of abnormal subsequence with the highest abnormality;

[0109] Step 4-2: Store the returned abnormality into the abnormality history data;

[0110] Step 4-3: Continue to read the subsequent enterprise power load time series data stream into the queue and perform the following process:

[0111] Read a new data from the data stream into the queue and delete the first data from the queue; call the abnormal subsequence detection algorithm on the queue and return the subsequence position with the highest abnormality and its abnormality; if the abnormal subsequence position is different from the abnormal subsequence position at the previous moment, it is a real abnormality and an alarm is issued; update the abnormal position at the previous moment to the current abnormal subsequence position; store the abnormality degree of the current abnormal subsequence.

[0112] In a preferred but non-limiting embodiment of the present invention, in step 5, an online detection framework for abnormal subsequences is implemented based on the function of Apache Pulsar, including the following steps:

[0113] Step 5-1: Build a server cluster. The computer hardware configuration standard in the cluster must not be lower than the configuration requirements of Apache Pulsar;

[0114] Step 5-2: Deploy Apache Pulsar on the server cluster;

[0115] Step 5-3: Based on Apache Pulsar, set its topics and partitions. First, determine whether the number of Kafka topics is empty; if it is not empty, determine the number of partitions in the topic; if the number of partitions is not empty and the required number of partitions does not exceed the default number of partitions in Kafka, the electricity consumption time series data of different enterprises to be tested will be calculated and distributed to different partitions according to the key value (the key value can be customized), and then output in the form of data stream;

[0116] Step 5-4: Implement the abnormal subsequence detection algorithm and online detection framework based on Java program.

[0117] like Figure 2 As shown, the abnormal subsequence detection device for enterprise power load data according to the present invention comprises:

[0118] A representation module, which is used to represent the enterprise power load time series data by combining the minimum bounding rectangle with the binary representation;

[0119] A detection module, which is used to calculate the similarity between the time series data of the enterprise power load represented;

[0120] A construction module for constructing an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented;

[0121] A framework module, which is used to build an online detection framework for abnormal subsequences;

[0122] Implements a module for implementing an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.

[0123] The beneficial effects of the present invention are that, compared with the prior art, the technical effects of the present invention include:

[0124] The enterprise power load time series data is represented by combining the minimum bounding rectangle with the binary representation; the similarity between the represented enterprise power load time series data is calculated; an abnormal subsequence detection algorithm based on K-Modes is constructed according to the similarity between the represented enterprise power load time series data; an online detection framework for abnormal subsequences is constructed; the online detection framework for abnormal subsequences is implemented based on the function of Apache Pulsar, and the proposed abnormal subsequence detection method for enterprise power load data is verified based on the actual enterprise power load data. This method can effectively improve the efficiency of supervision of enterprise power consumption.

[0125] The present disclosure can be a system, method and / or computer program product. The computer program product can include a computer-readable storage medium carrying computer-readable program instructions for causing a processor to implement various aspects of the present disclosure.

[0126] A computer-readable storage medium can be a tangible device that can hold and store instructions used by an instruction execution device. A computer-readable storage medium can be, but is not limited to, an electrical storage device, a magnetic storage device, an optical storage device, an electromagnetic storage device, a semiconductor storage device, or any suitable combination of the above. More specific examples of computer-readable storage media (a non-exhaustive list) include: a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a static random access memory (SRAM), a portable compact disk read-only memory (CD-ROM), a digital versatile disk (DVD), a memory stick, a floppy disk, a mechanical encoding device, such as a punch card or a raised structure in a groove on which instructions are stored, and any suitable combination of the above. As used herein, a computer-readable storage medium is not to be interpreted as a transient signal per se, such as a radio wave or other freely propagating electromagnetic wave, an electromagnetic wave propagating through a waveguide or other transmission medium (such as, a light pulse through a fiber optic cable), or an electrical signal transmitted through a wire.

[0127] The computer-readable program instructions described herein can be downloaded from a computer-readable storage medium to each computing / processing device, or downloaded to an external computer or external storage device via a network, such as the Internet, a local area network, a wide area network, and / or a wireless network. The network can include copper transmission cables, optical fiber transmission, wireless transmission, routers, firewalls, switches, gateway computers, and / or edge servers. The network adapter card or network interface in each computing / processing device receives the computer-readable program instructions from the network and forwards the computer-readable program instructions for storage in a computer-readable storage medium in each computing / processing device.

[0128] The computer program instructions for performing the operations of the present disclosure can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, state setting data, or source code or object code written in any combination of one or more programming languages, including object-oriented programming languages ​​such as Smalltalk, C++, etc., and conventional procedural programming languages ​​such as "C" language or similar programming languages. Computer-readable program instructions can be executed entirely on the controller computer, partially on the controller computer, as a separate software package, partially on the controller computer and partially on a remote computer, or completely on a remote computer or server. In the case of a remote computer, the remote computer can be connected to the controller computer through any type of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computer (just as using an Internet service provider to connect through the Internet). In some embodiments, various aspects of the present disclosure are implemented by utilizing state information of computer-readable program instructions to personalize an electronic circuit, such as a programmable logic circuit, a field programmable gate array (FPGA), or a programmable logic array (PLA), which can execute computer-readable program instructions.

[0129] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the above embodiments, ordinary technicians in the relevant field should understand that the specific implementation methods of the present invention can still be modified or replaced by equivalents, and any modifications or equivalent replacements that do not depart from the spirit and scope of the present invention should be covered within the scope of protection of the claims of the present invention.

Claims

1. A method for detecting abnormal subsequences of enterprise power load data, characterized in that: include: Step 1: Use the minimum bounding rectangle combined with binary representation to represent the enterprise power load time series data; Step 2: Calculate the similarity between the enterprise power load time series data represented; Step 3: Construct an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented; Step 4: Construct an online detection framework for abnormal subsequences; Step 5: Implement an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.

2. The abnormal subsequence detection method for enterprise power load data according to claim 1 is characterized in that: In step 1, the minimum bounding rectangle refers to a method in geometry of using a minimum bounding rectangle to include a set of high-dimensional space points.

3. The abnormal subsequence detection method for enterprise power load data according to claim 1 is characterized in that: In step 1, the minimum bounding rectangle is used to represent the enterprise power load time series data, including the following steps: Step 1-1: Cut the subsequences of the enterprise power load time series data into equal lengths, that is, divide the subsequences of the extracted time series data into several segments of equal lengths, and use a minimum bounding rectangle to enclose the time series data in each segment to form a minimum bounding rectangle representation; Step 1-2: Combine the minimum bounding rectangle representation with the binary representation to represent the enterprise power load time series data.

4. The abnormal subsequence detection method for enterprise power load data according to claim 3 is characterized in that: In step 1-1 and step 1-2, the minimum bounding rectangle representation and the binary representation are combined to represent the enterprise power load time series data. The specific process is as follows: Step 1-2-1: For the given enterprise power load time series data T, slide one data point at a time from the beginning to the end through a given fixed-size sliding window to extract all subsequences T sub ={T1, T2, T3, ..., T n }, where T i represents the i-th subsequence, where i is an integer from 1 to n; Step 1-2-2: For each subsequence T i Divide into j segments of equal length and calculate T of each segment of the subsequence ik The minimum value low_value and the maximum value high_value of ik (low_value,high_value),T ik represents the kth segment of the i-th subsequence, thereby forming a minimum bounding rectangle representation; Step 1-2-3: Divide the variation range of the enterprise power load time series data into n equally divided regions, and calculate the maximum and minimum value tuples T of each segment of each subsequence obtained in step 1-2-2. ik (low_value, high_value) is compared with the divided area range to obtain the coverage area of ​​each subsequence and each segment. The covered area is marked as "1" and the uncovered area is marked as "0". The binary representation is obtained based on this, thereby realizing the combination of the minimum bounding rectangle representation and the binary representation to represent the enterprise power load time series data.

5. The abnormal subsequence detection method for enterprise power load data according to claim 3 is characterized in that: In step 2, the similarity between the enterprise power load time series data represented is calculated, which includes the following steps: Define the distance formula of the subsequence after the representation, that is, use formula (1) to calculate the distance between subsequence 1 and subsequence 2: Among them, S1 and S2 are the forms of subsequence 1 represented by steps 1-2 {a1, a2, ... a N } and subsequence 2 of the form {b1,b2,…b N }, aj is the jth element in the binary representation of subsequence 1, b j is the jth element in the binary representation of subsequence one, j is an integer from 1 to N, N is a natural number, and the distance between subsequence one and subsequence two is the similarity between subsequence one and subsequence two.

6. The abnormal subsequence detection method for enterprise power load data according to claim 5 is characterized in that: In step 3, an abnormal subsequence detection algorithm based on K-Modes is constructed according to the similarity between the enterprise power load time series data represented, including the following steps: Step 3-1: Define the degree of abnormality. The degree of abnormality is for the enterprise power load time series data T. M is a subsequence in T. The distance between M and its nearest non-self-matching subsequence is the degree of abnormality of M. Step 3-2: Setting an abnormal subsequence detection algorithm for power load data based on K-Modes according to the defined abnormality degree; In step 3-2, the algorithm description of the abnormal subsequence detection algorithm of power load data based on K-Modes is as follows: Step 3-2-1: Initialize the abnormal subsequence position and abnormality degree; Step 3-2-2: Extract all subsequences and convert them into their minimum bounding rectangle representations, then cluster the minimum bounding rectangle representations converted from all subsequences based on the K-Modes algorithm to obtain the corresponding clustering results as candidate subsequences; Step 3-2-3: Generate an outer loop based on the clustering results, and nest the inner loop execution.

7. The abnormal subsequence detection method for enterprise power load data according to claim 6 is characterized in that: In step 3-2-3, an outer loop is generated based on the clustering results, and the inner loop is nested for execution, including the following steps: Step 3-2-3-1: The outer loop traverses the candidate subsequences, detects all candidate subsequences one by one as the current candidate subsequences and initializes the nearest neighbor distance of the current candidate subsequence p; Step 3-2-3-2: Execute the inner loop to find the subsequence q with the nearest non-self-matching distance of the current candidate subsequence; Step 3-2-3-3: If the distance between candidate subsequence p and candidate subsequence q is less than the abnormality of the currently initialized abnormal subsequence, exit the inner loop; Step 3-2-3-4: If the distance between candidate subsequence p and candidate subsequence q is less than the nearest neighbor distance of the current candidate subsequence p, update the nearest neighbor distance of the current candidate subsequence p to the distance between candidate subsequence p and candidate subsequence q; Step 3-2-3-5: If the nearest neighbor distance of the current candidate subsequence p is greater than the abnormality of the current initial abnormal subsequence; Step 3-2-3-6: Update the initialized abnormal subsequence position and abnormality to the current candidate subsequence p position and the nearest neighbor distance of the current candidate subsequence p; Step 3-2-3-7: Return the updated initialization abnormal subsequence position and abnormality degree. The subsequence corresponding to the updated initialization abnormal subsequence position is the abnormal subsequence.

8. The abnormal subsequence detection method for enterprise power load data according to claim 7 is characterized in that: In step 4, an online detection framework for abnormal subsequences is constructed, and its implementation algorithm is described as follows: Step 4-1: Read data from the data stream of the enterprise power load time series until the queue with a set length of m is full; Step 4-2: Get the abnormal subsequence detection algorithm for the queue and return the position and degree of abnormal subsequence with the highest abnormality; Step 4-2: Store the returned abnormality into the abnormality history data; Step 4-3: Continue to read the subsequent enterprise power load time series data stream into the queue and perform the following process: Read a new data from the data stream into the queue and delete the first data from the queue; call the abnormal subsequence detection algorithm on the queue and return the subsequence position with the highest abnormality and its abnormality; if the abnormal subsequence position is different from the abnormal subsequence position at the previous moment, it is a real abnormality and an alarm is issued; update the abnormal position at the previous moment to the current abnormal subsequence position; store the abnormality degree of the current abnormal subsequence.

9. The abnormal subsequence detection method for enterprise power load data according to claim 8 is characterized in that: In step 5, an online detection framework for abnormal subsequences is implemented based on the function of Apache Pulsar, including the following steps: Step 5-1: Build a server cluster. The computer hardware configuration standard in the cluster must not be lower than the configuration requirements of Apache Pulsar; Step 5-2: Deploy Apache Pulsar on the server cluster; Step 5-3: Based on Apache Pulsar, set its topics and partitions. First, determine whether the number of Kafka topics is empty; if it is not empty, determine the number of partitions in the topic; if the number of partitions is not empty and the required number of partitions does not exceed the default number of partitions in Kafka, the electricity consumption time series data of different enterprises to be tested will be distributed to different partitions according to key value calculation, and then output in the form of data stream; Step 5-4: Implement the abnormal subsequence detection algorithm based on the Java program.

10. An abnormal subsequence detection device for enterprise power load data, characterized in that: include: A representation module, which is used to represent the enterprise power load time series data by combining the minimum bounding rectangle with the binary representation; A detection module, which is used to calculate the similarity between the time series data of the enterprise power load represented; A construction module for constructing an abnormal subsequence detection algorithm based on K-Modes according to the similarity between the enterprise power load time series data represented; A framework module, which is used to build an online detection framework for abnormal subsequences; Implements a module for implementing an online detection framework for abnormal subsequences based on the functionality of Apache Pulsar.