[go: up one dir, main page]

CN117851920B - Power Internet of things data anomaly detection method and system - Google Patents

Power Internet of things data anomaly detection method and system Download PDF

Info

Publication number
CN117851920B
CN117851920B CN202410256677.5A CN202410256677A CN117851920B CN 117851920 B CN117851920 B CN 117851920B CN 202410256677 A CN202410256677 A CN 202410256677A CN 117851920 B CN117851920 B CN 117851920B
Authority
CN
China
Prior art keywords
data
time
layer
anomaly
sequence
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202410256677.5A
Other languages
Chinese (zh)
Other versions
CN117851920A (en
Inventor
孙岗
赵鹏
严莉
曲延盛
常英贤
呼海林
王高洲
杨坤
牛德玲
邵志敏
樊静雨
胡恒瑞
管荑
梁天
王中龙
朱尤祥
肖沈阳
周洁
孟祥鹿
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Shandong Electric Power Co Ltd
Information and Telecommunication Branch of State Grid Shandong Electric Power Co Ltd
Original Assignee
State Grid Shandong Electric Power Co Ltd
Information and Telecommunication Branch of State Grid Shandong Electric Power Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by State Grid Shandong Electric Power Co Ltd, Information and Telecommunication Branch of State Grid Shandong Electric Power Co Ltd filed Critical State Grid Shandong Electric Power Co Ltd
Priority to CN202410256677.5A priority Critical patent/CN117851920B/en
Publication of CN117851920A publication Critical patent/CN117851920A/en
Application granted granted Critical
Publication of CN117851920B publication Critical patent/CN117851920B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/24Classification techniques
    • G06F18/241Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches
    • G06F18/2415Classification techniques relating to the classification model, e.g. parametric or non-parametric approaches based on parametric or probabilistic models, e.g. based on likelihood ratio or false acceptance rate versus a false rejection rate
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/21Design or setup of recognition systems or techniques; Extraction of features in feature space; Blind source separation
    • G06F18/214Generating training patterns; Bootstrap methods, e.g. bagging or boosting
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F18/00Pattern recognition
    • G06F18/20Analysing
    • G06F18/25Fusion techniques
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06NCOMPUTING ARRANGEMENTS BASED ON SPECIFIC COMPUTATIONAL MODELS
    • G06N3/00Computing arrangements based on biological models
    • G06N3/02Neural networks
    • G06N3/04Architecture, e.g. interconnection topology
    • G06N3/0464Convolutional networks [CNN, ConvNet]
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q50/00Information and communication technology [ICT] specially adapted for implementation of business processes of specific business sectors, e.g. utilities or tourism
    • G06Q50/06Energy or water supply

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Data Mining & Analysis (AREA)
  • General Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • Life Sciences & Earth Sciences (AREA)
  • Evolutionary Computation (AREA)
  • Artificial Intelligence (AREA)
  • Business, Economics & Management (AREA)
  • Evolutionary Biology (AREA)
  • Computer Vision & Pattern Recognition (AREA)
  • Bioinformatics & Computational Biology (AREA)
  • Bioinformatics & Cheminformatics (AREA)
  • Health & Medical Sciences (AREA)
  • General Health & Medical Sciences (AREA)
  • Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Biophysics (AREA)
  • Water Supply & Treatment (AREA)
  • Tourism & Hospitality (AREA)
  • Strategic Management (AREA)
  • Primary Health Care (AREA)
  • Marketing (AREA)
  • Human Resources & Organizations (AREA)
  • Biomedical Technology (AREA)
  • Public Health (AREA)
  • Computational Linguistics (AREA)
  • Molecular Biology (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Software Systems (AREA)
  • Probability & Statistics with Applications (AREA)
  • Management, Administration, Business Operations System, And Electronic Commerce (AREA)

Abstract

The invention relates to the technical field of power data anomaly detection, in particular to a power internet of things data anomaly detection method and a system, which utilize stacked discrete wavelet transformation to decompose original power data, and input the decomposed data into a space-time network model, so that complex correlations between time sequence characteristics and sequences can be simultaneously mined. In the training process, the data slice is used as an input training anomaly detection model, finally, the data to be detected is preprocessed and then is input into the anomaly detection model, anomaly scores are calculated with real data, whether the scores exceed a threshold value or not is judged, and the situation that the scores exceed the threshold value is abnormal is judged. By using discrete wavelet transformation, a space-time network and a variation self-coding method, time series data can be better represented, so that the accuracy of anomaly identification is improved.

Description

电力物联数据异常检测方法及系统Power Internet of Things data anomaly detection method and system

技术领域Technical Field

本发明涉及电力数据异常检测技术领域,具体为电力物联数据异常检测方法及系统。The present invention relates to the technical field of power data anomaly detection, and in particular to a power Internet of Things data anomaly detection method and system.

背景技术Background technique

本部分的陈述仅仅是提供了与本发明相关的背景技术信息,不必然构成在先技术。The statements in this section merely provide background information related to the present invention and do not necessarily constitute prior art.

电力系统中,跨域、跨系统的电力物联数据不断增多,这些多源数据具有高度时序性和复杂关联性,虽然能够为电力系统的运行和管理提供了重要信息,但需要对这部分进行异常检测才能确保整个电力物联系统运行稳定。根据标签的有无,时间序列异常检测方法可分为监督、半监督和无监督方法,其中监督方法的标签获取成本高昂,因此绝大多数检测集中在不使用标签的无监督方法。In the power system, cross-domain and cross-system power Internet of Things data is increasing. These multi-source data are highly time-series and complexly correlated. Although they can provide important information for the operation and management of the power system, anomaly detection is required to ensure the stable operation of the entire power Internet of Things system. According to the presence or absence of labels, time series anomaly detection methods can be divided into supervised, semi-supervised and unsupervised methods. Among them, the cost of obtaining labels for supervised methods is high, so most detections are concentrated on unsupervised methods that do not use labels.

从方法的角度来看,传统的异常检测方法往往难以应对这些跨域、跨系统的电力物联数据的特点。它们往往基于单一系统或特定领域的数据进行建模和分析,忽视了数据之间的关联性和时序特征,导致检测的结果不理想。From a methodological perspective, traditional anomaly detection methods often have difficulty coping with the characteristics of these cross-domain and cross-system power IoT data. They often model and analyze data based on a single system or a specific field, ignoring the correlation and time series characteristics between data, resulting in unsatisfactory detection results.

发明内容Summary of the invention

为了解决上述背景技术中存在的技术问题,本发明提供电力物联数据异常检测方法及系统,能更好地处理跨域、跨系统的数据,挖掘时序特征和复杂关联,实现高效识别和分析异常数据,保障电力系统的可靠性和稳定性。In order to solve the technical problems existing in the above-mentioned background technology, the present invention provides a method and system for detecting anomaly in power Internet of Things data, which can better process cross-domain and cross-system data, mine time series characteristics and complex associations, realize efficient identification and analysis of abnormal data, and ensure the reliability and stability of the power system.

为了实现上述目的,本发明采用如下技术方案:In order to achieve the above object, the present invention adopts the following technical solution:

本发明的第一个方面提供电力物联数据异常检测方法,包括:A first aspect of the present invention provides a method for detecting abnormality in power Internet of Things data, comprising:

获取电力时间序列数据并预处理,经分解得到频率分量和对应的通道数、序列数和预测时间窗口长度,形成数据集;Obtain and preprocess the power time series data, decompose it to obtain the frequency components and the corresponding number of channels, number of sequences and length of the prediction time window, and form a data set;

得到的数据集基于训练完毕的异常检测模型,分别捕获时间序列的长距离时间依赖性与多序列间的特征关系,并根据时间序列数据进行重构得到预测值;The obtained data set is based on the trained anomaly detection model, which captures the long-distance time dependency of time series and the characteristic relationship between multiple series, and reconstructs the predicted value based on the time series data;

得到的预测值利用多元高斯分布确定异常得分,以马氏距离作为异常得分的度量标准,当异常得分超过阈值则对应的数据点为异常。The obtained prediction value uses multivariate Gaussian distribution to determine the anomaly score, and the Mahalanobis distance is used as the metric for the anomaly score. When the anomaly score exceeds the threshold, the corresponding data point is anomaly.

进一步的,预处理包括,获取N个电力时间序列,清洗部分噪声数据作为训练的输入。Furthermore, the preprocessing includes obtaining N power time series and cleaning some noise data as input for training.

进一步的,通过堆叠离散小波变换方法获取频率分量,构建数据集(C,T,N),其中C为通道数对应离散小波分解后得到的序列数,T为预测时间窗口长度,N为多时间序列数目,如下式所示:Furthermore, the frequency components are obtained by stacking discrete wavelet transform method to construct a data set (C, T, N), where C is the number of channels corresponding to the number of sequences obtained after discrete wavelet decomposition, T is the length of the prediction time window, and N is the number of multiple time series, as shown in the following formula:

;

式中,x表示表示原始输入的多序列数据,w表示离散小波基函数,表示经由堆叠离散小波变换得到的系数,表示高通滤波器在时刻的取值。In the formula, x represents the original input multi-sequence data, w represents the discrete wavelet basis function, represents the coefficients obtained by stacking discrete wavelet transforms, Represents a high pass filter At the moment The value of .

进一步的,异常检测模型包括特征处理层,时空网络模块和预测层,特征处理层包括预处理层和卷积网络,时空网络模块具有多组,每一组时空网络模块为双层图卷积层与Transformer模型并联,并采用残差连接方式,预测层通过卷积层与变分自编码器进行重构,其中的卷积层与线性层分别对特征维度进行降维,变分自编码器对序列与时间维度进行重构,输出预测结果。Furthermore, the anomaly detection model includes a feature processing layer, a spatiotemporal network module and a prediction layer. The feature processing layer includes a preprocessing layer and a convolutional network. The spatiotemporal network module has multiple groups, each group of spatiotemporal network modules is a double-layer graph convolution layer connected in parallel with the Transformer model, and adopts a residual connection method. The prediction layer is reconstructed by a convolutional layer and a variational autoencoder, in which the convolutional layer and the linear layer respectively reduce the feature dimensions, and the variational autoencoder reconstructs the sequence and time dimensions and outputs the prediction results.

进一步的,时空网络模块包括时空位置嵌入层、图卷积层与Transformer,通过对每个时间序列中的时间依赖性,和不同时间序列对之间的相互关系进行编码,对时间序列数据进行重构。Furthermore, the spatiotemporal network module includes a spatiotemporal position embedding layer, a graph convolutional layer and a Transformer, which reconstructs the time series data by encoding the temporal dependencies in each time series and the relationships between different time series pairs.

进一步的,利用时空位置嵌入层将时间长度注入输入序列,并基于设定的函数构造位置向量。Furthermore, the spatiotemporal position embedding layer is used to inject the time length into the input sequence and construct the position vector based on the set function.

进一步的,图卷积层获取邻接矩阵和序列输入,并在傅里叶域中构造滤波器,滤波器通过其一阶邻域捕获节点之间的空间特征,通过叠加多个卷积层来构建图卷积模型。Furthermore, the graph convolution layer obtains the adjacency matrix and sequence input and constructs a filter in the Fourier domain. The filter captures the spatial features between nodes through its first-order neighborhood, and a graph convolution model is constructed by stacking multiple convolution layers.

进一步的,通过多头注意力分别检测时间维度和特征维度建模的多变量时序数据,获得时间隐藏信息之间的关系。Furthermore, multivariate time series data modeled in the time dimension and feature dimension are detected separately by multi-head attention to obtain the relationship between temporal hidden information.

进一步的,以马氏距离作为异常得分的度量标准,如下式所示:Furthermore, the Mahalanobis distance is used as the metric for the anomaly score, as shown in the following formula:

;

其中,表示数据点的特征向量,表示多节点的均值向量,表示节点向量的协方差矩阵,表示数据点到均值向量的马氏距离。in, The feature vector representing the data point, represents the mean vector of multiple nodes, represents the covariance matrix of the node vector, Represents the data point to the mean vector The Mahalanobis distance.

本发明的第二个方面提供电力物联数据异常检测系统,包括以下步骤:A second aspect of the present invention provides a power IoT data anomaly detection system, comprising the following steps:

数据采集模块,被配置为:获取电力时间序列数据并预处理,经分解得到频率分量和对应的通道数、序列数和预测时间窗口长度,形成数据集;The data acquisition module is configured to: acquire and pre-process the power time series data, decompose and obtain the frequency components and the corresponding number of channels, number of sequences and length of the prediction time window, and form a data set;

特征挖掘模块,被配置为:得到的数据集基于训练完毕的异常检测模型,分别捕获时间序列的长距离时间依赖性与多序列间的特征关系,并根据时间序列数据进行重构得到预测值;The feature mining module is configured to: based on the trained anomaly detection model, the obtained data set captures the long-distance time dependency of the time series and the characteristic relationship between multiple sequences, and reconstructs the time series data to obtain the predicted value;

异常检测模块,被配置为:得到的预测值利用多元高斯分布确定异常得分,以马氏距离作为异常得分的度量标准,当异常得分超过阈值则对应的数据点为异常。The anomaly detection module is configured as follows: the obtained prediction value uses multivariate Gaussian distribution to determine the anomaly score, and the Mahalanobis distance is used as the metric of the anomaly score. When the anomaly score exceeds a threshold, the corresponding data point is anomaly.

本发明的第三个方面提供一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现上述配电力物联数据异常检测方法中的步骤。A third aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps in the above-mentioned distribution power Internet of Things data anomaly detection method.

本发明的第四个方面提供一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,处理器执行程序时实现上述电力物联数据异常检测方法中的步骤。A fourth aspect of the present invention provides a computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the steps in the above-mentioned power Internet of Things data anomaly detection method when executing the program.

与现有技术相比,以上一个或多个技术方案存在以下有益效果:Compared with the prior art, one or more of the above technical solutions have the following beneficial effects:

分解原始数据得到频率分量和对应的通道数、序列数和预测时间窗口长度的过程形成堆叠离散小波变换的方法,通过该方法与时空图网络组成的异常检测模型相配合,捕捉多序列间相互的异常模式,将预测任务和重构任务融合在一起,以更好地表示时间序列数据,从而降低误报率,降低安全风险,能更好地处理跨域、跨系统的数据,通过挖掘时序特征和复杂关联,实现高效识别和分析异常数据,保障电力系统的可靠性和稳定性。The process of decomposing the original data to obtain frequency components and the corresponding number of channels, number of sequences and length of the prediction time window forms a stacked discrete wavelet transform method. This method is combined with the anomaly detection model composed of a space-time graph network to capture the mutual abnormal patterns between multiple sequences, and integrate the prediction task and the reconstruction task to better represent the time series data, thereby reducing the false alarm rate and safety risks. It can better handle cross-domain and cross-system data, and realize efficient identification and analysis of abnormal data by mining time series characteristics and complex associations, thereby ensuring the reliability and stability of the power system.

附图说明BRIEF DESCRIPTION OF THE DRAWINGS

构成本发明的一部分的说明书附图用来提供对本发明的进一步理解,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。The accompanying drawings in the specification, which constitute a part of the present invention, are used to provide a further understanding of the present invention. The exemplary embodiments of the present invention and their descriptions are used to explain the present invention and do not constitute improper limitations on the present invention.

图1是本发明一个或多个实施例提供的异常检测流程示意图;FIG1 is a schematic diagram of an anomaly detection process provided by one or more embodiments of the present invention;

图2是本发明一个或多个实施例提供的异常检测模型结构示意图;FIG2 is a schematic diagram of the structure of an anomaly detection model provided by one or more embodiments of the present invention;

图3是本发明一个或多个实施例提供的堆叠离散小波分解效果中原始子序列示意图;FIG3 is a schematic diagram of an original subsequence in a stacked discrete wavelet decomposition effect provided by one or more embodiments of the present invention;

图4是本发明一个或多个实施例提供的堆叠离散小波分解效果中Level1的小波子序列示意图;FIG4 is a schematic diagram of a wavelet subsequence of Level 1 in a stacked discrete wavelet decomposition effect provided by one or more embodiments of the present invention;

图5是本发明一个或多个实施例提供的堆叠离散小波分解效果中Level2的小波子序列示意图;5 is a schematic diagram of a Level 2 wavelet subsequence in a stacked discrete wavelet decomposition effect provided by one or more embodiments of the present invention;

图6是本发明一个或多个实施例提供的堆叠离散小波分解效果中Level3的小波子序列示意图;6 is a schematic diagram of a Level 3 wavelet subsequence in a stacked discrete wavelet decomposition effect provided by one or more embodiments of the present invention;

图7是本发明一个或多个实施例提供的堆叠离散小波分解效果中Level4的小波子序列示意图;7 is a schematic diagram of a Level 4 wavelet subsequence in a stacked discrete wavelet decomposition effect provided by one or more embodiments of the present invention;

图8是本发明一个或多个实施例提供的异常检测结果示意图。FIG. 8 is a schematic diagram of anomaly detection results provided by one or more embodiments of the present invention.

具体实施方式Detailed ways

下面结合附图与实施例对本发明作进一步说明。The present invention will be further described below in conjunction with the accompanying drawings and embodiments.

应该指出,以下详细说明都是示例性的,旨在对本发明提供进一步的说明。除非另有指明,本文使用的所有技术和科学术语具有与本发明所属技术领域的普通技术人员通常理解的相同含义。It should be noted that the following detailed descriptions are exemplary and are intended to provide further explanation of the present invention. Unless otherwise specified, all technical and scientific terms used herein have the same meanings as those commonly understood by those skilled in the art to which the present invention belongs.

正如背景技术中所介绍的的,传统的异常检测方法往往难以应对这些跨域、跨系统的电力物联数据的特点。它们往往基于单一系统或特定领域的数据进行建模和分析,忽视了数据之间的关联性和时序特征,使得检测结果不理想。As introduced in the background technology, traditional anomaly detection methods often have difficulty coping with the characteristics of these cross-domain and cross-system power IoT data. They often model and analyze data based on a single system or a specific field, ignoring the correlation and time series characteristics between data, resulting in unsatisfactory detection results.

因此,以下实施例给出电力物联数据异常检测方法及系统,利用堆叠离散小波变换对原始电力数据进行分解,并将分解后的数据输入到时空网络模型中。该时空网络模型由特征处理层、时空网络模块和预测层组成,其中特征处理层利用不同的卷积层来进一步提取局部和全局特征信息。时空网络模块结合了双层图卷积网络和Transformer模型,采用残差连接技术,能够同时挖掘时序特征和序列间的复杂关联。预测层实现了预测任务与重构任务的统一,通过卷积层降低特征维度,再通过变分自编码器对序列与时间维度进行重构。在训练过程中,将数据切片作为输入训练异常检测模型,最后在待检测的数据经过预处理后输入异常检测模型,并与真实数据计算异常评分,判断评分是否超过阈值,超过则为异常。通过运用离散小波变换、时空网络以及变分自编码方法,能够更好地表征时间序列数据,从而提高异常识别的准确性。Therefore, the following embodiment provides a method and system for detecting anomalies in power IoT data, using stacked discrete wavelet transform to decompose the original power data, and input the decomposed data into the spatiotemporal network model. The spatiotemporal network model consists of a feature processing layer, a spatiotemporal network module and a prediction layer, wherein the feature processing layer uses different convolutional layers to further extract local and global feature information. The spatiotemporal network module combines a double-layer graph convolutional network and a Transformer model, and adopts residual connection technology to simultaneously mine complex associations between time series features and sequences. The prediction layer realizes the unification of prediction tasks and reconstruction tasks, reduces the feature dimension through the convolutional layer, and then reconstructs the sequence and time dimension through the variational autoencoder. During the training process, the data slice is used as input to train the anomaly detection model, and finally the data to be detected is input into the anomaly detection model after preprocessing, and the anomaly score is calculated with the real data to determine whether the score exceeds the threshold, which is abnormal. By using discrete wavelet transform, spatiotemporal network and variational autoencoding methods, time series data can be better characterized, thereby improving the accuracy of anomaly recognition.

实施例一:Embodiment 1:

如图1-图8所示,电力物联数据异常检测方法,包括以下步骤:As shown in Figures 1 to 8, the power Internet of Things data anomaly detection method includes the following steps:

1)数据预处理:获取N个电力时间序列,并进行预处理操作;电力时序数据预处理,移除数据中不重要的特征,清洗部分噪声数据,数据预处理的结果作为下一步模型训练的输入;通过堆叠离散小波方法对原始序列进行分解,每个序列将生成C-1个详细系数(较高频率)和1个趋势序列,由此产生C×N维的数据集Xd1) Data preprocessing: Obtain N power time series and perform preprocessing operations; preprocess the power time series data to remove unimportant features in the data and clean some noise data. The results of data preprocessing are used as the input for the next step of model training; decompose the original sequence by stacking discrete wavelet method, and each sequence will generate C-1 detailed coefficients (higher frequency) and 1 trend sequence, thereby generating a C×N dimensional data set Xd .

本实施例中,电力时间序列为分布式光伏功率数据,属于电网中物联采集数据的一类,涵盖了N个光伏站点的功率信息。由于光伏数据的异常情况可能受到众多因素的影响,包括但不限于气候、设备状态等,因此本实施例选择了这个复杂而多样的数据源进行异常检测。方法上旨在通过应对光伏功率数据的多源复杂性场景的良好异常检测,来表明其适用于更广泛的电力物联检测场景。In this embodiment, the power time series is distributed photovoltaic power data, which belongs to a category of IoT data collection in the power grid, covering the power information of N photovoltaic sites. Since the abnormal situation of photovoltaic data may be affected by many factors, including but not limited to climate, equipment status, etc., this embodiment selects this complex and diverse data source for anomaly detection. The method aims to demonstrate its applicability to a wider range of power IoT detection scenarios by coping with good anomaly detection in multi-source complex scenarios of photovoltaic power data.

2)模型设计:根据相关性系数与先验经验构建邻接矩阵,设计基于变分自编码器与时空图网络模型的多时间序列的异常检测模型,模型包括特征处理层,时空网络模块和预测层,特征处理层包括预处理层和卷积网络,单个的时空网络模块为双层GCN网络与Transformer模型并联,并采用残差连接方式,预测层通过卷积层与变分自编码器(VAE)进行重构,其中的卷积层与线性层分别对特征维度进行降维,VAE对序列与时间维度进行重构,输出预测结果。2) Model design: According to the correlation coefficient and prior experience, an adjacency matrix is constructed, and a multi-time series anomaly detection model based on variational autoencoder and spatiotemporal graph network model is designed. The model includes feature processing layer, spatiotemporal network module and prediction layer. The feature processing layer includes preprocessing layer and convolutional network. The single spatiotemporal network module is a two-layer GCN network in parallel with Transformer model, and adopts residual connection. The prediction layer is reconstructed by convolutional layer and variational autoencoder (VAE). The convolutional layer and linear layer reduce the feature dimension respectively, and VAE reconstructs the sequence and time dimensions to output the prediction result.

3)模型训练:数据预处理后,对N个传感器的时间序列数据,设置预测时间窗长度T1,输出时间维度为T2,由此切分成小样本,设置单次训练样本数为B,构建单次输入维度为(B,C,T1,N),作为输入样本训练异常检测模型,而将原始序列标准化后的样本作为输出,类似的,构建标准化输出维度(B,T2,N)。3) Model training: After data preprocessing, for the time series data of N sensors, set the prediction time window length T1 and the output time dimension T2, and divide them into small samples. Set the number of single training samples to B, and construct a single input dimension of (B, C, T1, N). Use them as input samples to train the anomaly detection model, and use the standardized samples of the original sequence as output. Similarly, construct a standardized output dimension (B, T2, N).

4)异常评分:模型训练好后,将待检测的数据进行预处理并输入异常检测模型,并输出样本预测任务输出,将输出数据与真实数据二者输入异常评分模型得出异常评分;基于训练集模型评估方法,设置异常检测阈值,判断异常评分是否超过阈值,若超过,则判断为异常,否则视为正常。4) Anomaly scoring: After the model is trained, the data to be detected is preprocessed and input into the anomaly detection model, and the sample prediction task output is output. The output data and the real data are input into the anomaly scoring model to obtain the anomaly score. Based on the training set model evaluation method, the anomaly detection threshold is set to determine whether the anomaly score exceeds the threshold. If so, it is judged as an anomaly, otherwise it is considered normal.

如图1所示,异常检测任务的整体流程图,预处理阶段使用了离散小波基函数w,由高通滤波器和低通滤波器组成,通过堆叠离散小波变换MODWT获取频率分量,构建(C,T,N)三维数据,C为通道数对应离散小波分解后得到的序列数,T为预测时间窗口长度,N为多时间序列数目。公式可表达为:As shown in Figure 1, the overall flow chart of the anomaly detection task, the discrete wavelet basis function w is used in the preprocessing stage, and the high-pass filter and low pass filter By stacking discrete wavelet transform MODWT to obtain frequency components, (C, T, N) three-dimensional data is constructed, where C is the number of channels corresponding to the number of sequences obtained after discrete wavelet decomposition, T is the length of the prediction time window, and N is the number of multiple time series. The formula can be expressed as: ;

其中,x表示表示原始输入的多序列数据,w表示离散小波基函数,表示经由堆叠离散小波变换得到的系数,表示高通滤波器在时刻的取值。Among them, x represents the original input multi-sequence data, w represents the discrete wavelet basis function, represents the coefficients obtained by stacking discrete wavelet transforms, Represents a high pass filter At the moment The value of .

模型设计中,构建图结构数据为有向图G,以每个时序数据作为图的节点,首先根据该先验信息可以灵活地表示为每个传感器i的一组候选关系C i,即它可以依赖的传感器:In the model design, the graph structure data is constructed as a directed graph G , with each time series data as a node of the graph. First, based on the prior information, it can be flexibly represented as a set of candidate relationships C i for each sensor i , that is, the sensors it can depend on: .

如果在没有先验信息的情况下,传感器i的候选关系就是除了它自己之外的所有传感器。为了在这些候选节点中选择传感器i的依赖关系,计算节点i的嵌入向量与其候选节点jC i的嵌入之间的相似度:If there is no prior information, the candidate relationships of sensor i are all sensors except itself. In order to select the dependency relationship of sensor i among these candidate nodes, the similarity between the embedding vector of node i and the embedding of its candidate node jC i is calculated: , .

计算传感器i的嵌入向量与候选关系j∈C i之间的归一化点积,选择最上面的k个这样的归一化点积:这里TopK表示它的输入(即归一化点积)中最上面k个值的索引。Compute the normalized dot product between the embedding vector of sensor i and the candidate relation j∈C i , select the top k such normalized dot products: Here TopK represents the indices of the top k values in its input (i.e., normalized dot products).

异常检测模型如图2所示,网络由特征提取层,时空网络,以及预测层组成。首先,使用卷积层CNN承接训练数据实现特征维度的挖掘。然后,通过基于图卷积层GCN与Transformer模型组合实现的时空网络模块ST-block,不仅对每个时间序列中的时间依赖性,同时对不同时间序列对之间的相互关系进行编码,最后,连接卷积层与VAE作为预测层来实现基于预测的异常检测模型。The anomaly detection model is shown in Figure 2. The network consists of a feature extraction layer, a spatiotemporal network, and a prediction layer. First, the convolutional layer CNN is used to accept training data to mine feature dimensions. Then, the spatiotemporal network module ST-block, which is implemented based on the combination of the graph convolutional layer GCN and the Transformer model, encodes not only the temporal dependency in each time series, but also the mutual relationship between different time series pairs. Finally, the convolutional layer is connected to the VAE as a prediction layer to implement a prediction-based anomaly detection model.

整体预测任务可以表述为:;其中,G为生成的图结构,F为异常检测模型,T为时间窗维度,S为预测输出维度。The overall prediction task can be expressed as: ; Where G is the generated graph structure, F is the anomaly detection model, T is the time window dimension, and S is the prediction output dimension.

考虑预测效果与VAE重构后的效果,模型训练函数形式如下:;其中,是输出值与实际值的平方误差,表示用于衡量学习到的潜在变量分布与标准正态分布之间的差异,表示用于平衡MSE损失和KL散度损失的权重。Considering the prediction effect and the effect after VAE reconstruction, the model training function is as follows: ;in, is the square error between the output value and the actual value, It is used to measure the difference between the learned latent variable distribution and the standard normal distribution. Represents the weight used to balance the MSE loss and the KL divergence loss.

在异常评分阶段,对于N维T长的传感器运行状态序列,输入异常检测模型得到预测结果,与测试集数据对比计算,评分计算如下:;其中,是预测值与实际值的平方误差。在计算出误差之后,计算出误差之后,需要对当前点是否是异常进行判定。采用95%置信水平作为阈值,基于训练集的重构误差均值的分位数来进行异常检测,确保高准确性和可靠性。In the anomaly scoring stage, for the N-dimensional T-length sensor operating state sequence, the prediction result is input into the anomaly detection model and compared with the test set data. The score is calculated as follows: ;in, It is the square error between the predicted value and the actual value. After calculating the error, it is necessary to determine whether the current point is an anomaly. The 95% confidence level is used as the threshold, and the quantile of the reconstruction error mean of the training set is used for anomaly detection to ensure high accuracy and reliability.

具体的:specific:

步骤1:获取原始数据并进行预处理:在此步骤中,为了避免模型受到数据极值的影响,增强模型训练的稳定性,提高模型学习的速度,每列表示一个序列时,可表示为X= {x 1 ,x 2 ,...,x n },将通过以下方式对每个序列数据进行规范化,所有数据都分类到[0,1]之间:;其中,表示时间序列经过标准化后的结果,表示第个时间序列,表示时间序列的均值,表示时间序列的标准差。Step 1: Get the original data and preprocess it: In this step, in order to prevent the model from being affected by extreme values of the data, enhance the stability of model training, and improve the speed of model learning, each column represents a sequence, which can be expressed as X = {x1 , x2 , ..., xn }. Each sequence data will be normalized in the following way, and all data will be classified between [0, 1]: ;in, Representing time series After standardization, the results Indicates time series, Representing time series The mean of Representing time series The standard deviation of .

通过堆叠离散小波变换(MODWT)获取频率分量,构建(C,T,N)三维数据,C为通道数对应离散小波分解后得到的序列数,T为预测时间窗口长度,N为多时间序列数目。Will The frequency components are obtained by stacking discrete wavelet transform (MODWT) to construct (C, T, N) three-dimensional data, where C is the number of channels corresponding to the number of sequences obtained after discrete wavelet decomposition, T is the length of the prediction time window, and N is the number of multiple time series.

公式可表达为:;其中,x表示表示原始输入的多序列数据,w表示离散小波基函数,表示经由堆叠离散小波变换得到的系数,表示高通滤波器在时刻的取值。分解效果如图3-图7所示,图中的横坐标为时间(秒,s),纵坐标为幅值。The formula can be expressed as: ; where x represents the original input multi-series data, w represents the discrete wavelet basis function, represents the coefficient obtained by stacking discrete wavelet transform, and represents the value of the high-pass filter at time. The decomposition effect is shown in Figures 3 to 7, where the horizontal axis is time (seconds, s) and the vertical axis is amplitude.

步骤2:异常检测模型如图2所示,图网络模型首先采用两层卷积CNN层进行处理。第一层使用较小的卷积核(k1×k1)提取局部特征信息并扩增通道数,第二层使用更大(k2×k2)的卷积核捕获更全局的特征信息并增强通道数,实现对输入数据的多层特征维度挖掘,形式表述为:Step 2: Anomaly detection model As shown in Figure 2, the graph network model first uses two layers of convolutional CNN layers for processing. The first layer uses a smaller convolution kernel (k1×k1) to extract local feature information and expand the number of channels, and the second layer uses a larger convolution kernel (k2×k2) to capture more global feature information and enhance the number of channels, realizing multi-layer feature dimension mining of the input data, which can be expressed as: .

时空网络模块的ST-block的模型结构图2所示。经过特征处理层之后,进入到时空网络模块。本实施例中,网络模块由时空位置嵌入层(PositionalEmbeddingLayer),图卷积层(GraphConvolutionalNetwork,GCN)与Transformer组成,两层GCN网络与Transformer模型并联,分别捕获时间序列的长距离时间依赖性与多序列间的特征关系,依此对时间序列数据进行重新建模。The model structure of the ST-block of the spatiotemporal network module is shown in Figure 2. After the feature processing layer, it enters the spatiotemporal network module. In this embodiment, the network module consists of a spatiotemporal position embedding layer (Positional Embedding Layer), a graph convolutional network (GCN) and a Transformer. The two-layer GCN network is connected in parallel with the Transformer model to capture the long-distance temporal dependency of the time series and the characteristic relationship between multiple sequences, respectively, and remodel the time series data accordingly.

时空位置嵌入层(PositionalEmbeddingLayer):由于Transformer无法利用完全连接的前馈结构捕获观测的空间和时间信息。因此,需要先进行位置嵌入,将时间长度注入输入序列,t通过三角函数来构造位置向量p,其中位置t对应的位置向量p的构造方式,将位置向量p与输入序列相加获得带位置信息的输入序列如下:Spatiotemporal Position Embedding Layer: Since Transformer cannot use a fully connected feedforward structure to capture the observed spatial and temporal information, it is necessary to first embed the position and inject the time length into the input sequence. The position vector p is constructed by trigonometric functions. The position vector p corresponding to the position t is constructed by adding the position vector p to the input sequence to obtain the input sequence with position information as follows: ; .

图卷积层(GCNLayer)获取邻接矩阵A和序列输入X,GCN模型在傅里叶域中构造一个滤波器。滤波器作用于图的节点,通过其一阶邻域捕获节点之间的空间特征,然后通过叠加多个卷积层来构建GCN模型,其表示为:;其中,为添加自连接的矩阵,I为单位矩阵,为度矩阵,为第层的输出,表示层所包含的参数,表示非线性模型的sigmoid激活函数。通常情况下,单层图卷积网络难以充分捕捉特征之间的依赖关系。The graph convolution layer (GCNLayer) obtains the adjacency matrix A and the sequence input X , and the GCN model constructs a filter in the Fourier domain. The filter acts on the nodes of the graph, captures the spatial features between the nodes through its first-order neighborhood, and then constructs the GCN model by stacking multiple convolutional layers, which is expressed as: ;in, is the matrix for adding self-connection, I is the identity matrix, is the degree matrix, , For the The output of the layer, express The parameters contained in the layer, The sigmoid activation function represents a nonlinear model. Usually, a single-layer graph convolutional network cannot fully capture the dependencies between features.

因此模型设置双层GCN网络进行深度挖掘,可以表达为:;其中,第一层选择激活函数为ReLU函数,对输入信息进行筛选,W 0W 1分别为层级之间的权重矩阵。Therefore, the model sets a double-layer GCN network for deep mining, which can be expressed as: ; Among them, the first layer selects the ReLU function as the activation function to filter the input information, and W 0 and W 1 are the weight matrices between the layers respectively.

GCN处理时序问题,通过图卷积操作来挖掘空间上的关系,仅对平稳的空间依赖性进行挖掘。而Transformer模型则以时间为主要切面,用于处理多变量时序数据的时间依赖性,模型设计由多头注意力机制与前馈网络组成,通过多头注意力分别检测时间维度和特征维度建模的多变量时序数据,获得时间隐藏信息之间的关系;三个矩阵MQ、MK、MV分别表示为查询矩阵Q、键矩阵K和值矩阵V;自注意力的计算公式为:;式中:表示Softmax函数,将获得的权重映射到[0,1]之间,用于归一化空间相关性,用于缩放权重避免Softmax函数的过饱和。最后,基于残差连接设计,经过双层前馈网络获取模块输出O,采用ReLU函数作为激活函数,形式如下:GCN handles time series problems, mines spatial relationships through graph convolution operations, and only mines stable spatial dependencies. The Transformer model takes time as the main aspect and is used to process the time dependencies of multivariate time series data. The model design consists of a multi-head attention mechanism and a feedforward network. The multi-head attention is used to detect multivariate time series data modeled in the time dimension and feature dimension respectively, and obtain the relationship between time hidden information; the three matrices MQ, MK, and MV are respectively represented as the query matrix Q , the key matrix K , and the value matrix V ; the calculation formula for self-attention is: ; Where: Represents the Softmax function, which maps the obtained weights to [0, 1] to normalize spatial correlation. Used to scale weights to avoid oversaturation of the Softmax function. Finally, based on the residual connection design, The module output O is obtained through a double-layer feedforward network, and the ReLU function is used as the activation function, which is as follows: .

通过引入门机制实现并行网络数据的融合,输出值为:;其中,均为单层线性网络实现一维向量的映射,为时空模块ST-block的输出值。By introducing the gate mechanism, the fusion of parallel network data is realized, and the output value is: ; ;in, They are all single-layer linear networks that realize the mapping of one-dimensional vectors. It is the output value of the spatiotemporal module ST-block.

最后,将输入预测层进行降维与重构,输出实验结果,预测层为卷积层与VAE模型组成,卷积层实现通道数的降维到单通道,VAE对时间维度进行重构,构造输出的数据形式(B,N,T2)。Finally, The input prediction layer is used for dimensionality reduction and reconstruction, and the experimental results are output. The prediction layer consists of a convolutional layer and a VAE model. The convolutional layer reduces the number of channels to a single channel, and VAE reconstructs the time dimension to construct the output data format (B, N, T2).

步骤3:数据采集:数据集是包含19个电场的分布传感器功率数据合成的时间序列。以30分钟为一个采样点,形成多时间序列有9125个时间步长,序列中包含预先设定的5个异常区间,异常时间长度设置为30,60或90个时间步长。Step 3: Data collection: The data set is a time series of power data from 19 distributed sensors of the electric field. With 30 minutes as a sampling point, the multi-time series has 9125 time steps. The sequence contains 5 pre-set abnormal intervals, and the abnormal time length is set to 30, 60 or 90 time steps.

步骤4:模型训练:预处理后的训练数据根据预测输入时间维度T1,与输出时间维度T2对数据集进行划分,构建训练数据,采用大小为T1,步幅为1的滑动窗口进行切分;每个分段可表示为,所有分段的集合表示为,其中,T1默认设置为6,T2默认设置为1。为了考虑神经网络训练的批处理,将单次训练数据构建为标准输入,其维度为(B,C,T1,N),其中B为单次训练的批量数,C对应基于小波分解的近似序列的数目J,T1为输入时间维度,N为多序列的数目。类似地,从标准化原始序列构造输出为(B,T2,N),单次epoch的训练次数为,其中L为样本序列的长度。最后将构建好的样本序列送入模型中,进行网络参数训练。模型训练使用均方根误差MSE作为损失函数,形式如下:;其中,为预测值,为样本真实值,表示从潜在向量中采样得到的均值与方差。Step 4: Model training: The preprocessed training data is divided according to the prediction input time dimension T1 and the output time dimension T2 to construct the training data. The sliding window with a size of T1 and a stride of 1 is used for segmentation. Each segment can be expressed as , the set of all segments is represented as , where T1 is set to 6 by default and T2 is set to 1 by default. In order to consider the batch processing of neural network training, the single training data is constructed as a standard input with dimensions (B, C, T1, N), where B is the batch number of a single training, C corresponds to the number of approximate sequences based on wavelet decomposition J, T1 is the input time dimension, and N is the number of multiple sequences. Similarly, the output constructed from the standardized original sequence is (B, T2, N), and the number of training times for a single epoch is , where L is the length of the sample sequence. Finally, the constructed sample sequence is sent to the model for network parameter training. The model training uses the root mean square error MSE as the loss function, which is as follows: ;in, is the predicted value, is the true value of the sample, represents the mean and variance sampled from the latent vector.

步骤5:异常检测:模型训练完成,将测试集数据输入到异常检测模型中,以获得模型的预测值。基于多元高斯分布来计算异常得分,并将马氏距离函数作为异常得分的度量标准,综合考虑了各个特征之间的协方差以及数据点到特征均值的距离。;其中,表示数据点的特征向量,表示多节点的均值向量,表示节点向量的协方差矩阵,表示数据点到均值向量的马氏距离。Step 5: Anomaly detection: After model training is completed, the test set data is input into the anomaly detection model to obtain the model's prediction value. The anomaly score is calculated based on the multivariate Gaussian distribution, and the Mahalanobis distance function is used as the metric for the anomaly score, which comprehensively considers the covariance between each feature and the distance from the data point to the feature mean. ;in, The feature vector representing the data point, represents the mean vector of multiple nodes, represents the covariance matrix of the node vector, Represents the data point to the mean vector The Mahalanobis distance.

为了确定异常得分的阈值,本实施例依赖于训练数据的异常得分,基于卡方分布理论,设置在95%置信水平下与特征数量相关联的,用于判定异常得分高低的关键值。该阈值代表了在给定的置信水平下,异常得分需要超过的数值,本实施例将检测哪些数据点的异常得分是否高于所设定的阈值,以此确定它们是否为异常数据点,如图8所示。In order to determine the threshold of the anomaly score, this embodiment relies on the anomaly score of the training data, and based on the chi-square distribution theory, sets a key value associated with the number of features at a 95% confidence level for determining the high or low anomaly score. The threshold represents the value that the anomaly score needs to exceed at a given confidence level. This embodiment will detect which data points have anomaly scores higher than the set threshold to determine whether they are abnormal data points, as shown in Figure 8.

表1展示了本实施例与其他三种方法在相同多时间序列数据集上的性能比较结果,使用三个指标,即Precision、Recall和F1Score,来评估每种方法的异常检测性能。设定相同阈值(Threshold)为27.2036,epoch设置为20代,在同一数据集上的实验重复10次,并输出平均结果进行比较。Table 1 shows the performance comparison results of this embodiment and the other three methods on the same multi-time series dataset, using three indicators, namely Precision, Recall and F1Score, to evaluate the anomaly detection performance of each method. The same threshold (Threshold) is set to 27.2036, the epoch is set to 20 generations, the experiment on the same dataset is repeated 10 times, and the average results are output for comparison.

表1:本模型与其他基准模型的对比结果Table 1: Comparison results between this model and other benchmark models

可以看到,相比于其他三种方法,MSE的指标说明本实施例的模型明显具有更好的预测性能,综合F1得分说明本实施例在正确识别异常方面更具有竞争力。It can be seen that compared with the other three methods, the MSE index shows that the model of this embodiment has obviously better prediction performance, and the comprehensive F1 score shows that this embodiment is more competitive in correctly identifying anomalies.

上述过程基于离散小波分解和图卷积神经网络的多元时序电力物联数据异常检测方法,并结合多元高斯分布进行异常检测。离散小波分解有助于挖掘原始序列的不同频率的信息,从而把握全局趋势与局部细节。这一步骤通过对序列的多尺度分解,能够更全面地理解了数据的时频特征,为后续的网络输入提供了更为丰富的数据信息基础。The above process is based on the multivariate time-series power IoT data anomaly detection method of discrete wavelet decomposition and graph convolutional neural network, and combines multivariate Gaussian distribution for anomaly detection. Discrete wavelet decomposition helps to mine the information of different frequencies of the original sequence, so as to grasp the global trend and local details. This step can more comprehensively understand the time-frequency characteristics of the data through the multi-scale decomposition of the sequence, providing a richer data information basis for subsequent network input.

异常识别部分基于多元高斯分布来计算异常得分能够全面地刻画多变量数据的联合概率分布,并通过置信水平的设定确定异常得分的阈值。相较于传统的阈值设置方法,这种方式更为客观,具有更强的解释性,为异常检测提供了更加可靠的依据。The anomaly identification part calculates the anomaly score based on the multivariate Gaussian distribution, which can comprehensively characterize the joint probability distribution of multivariate data and determine the threshold of the anomaly score by setting the confidence level. Compared with the traditional threshold setting method, this method is more objective and has stronger interpretability, providing a more reliable basis for anomaly detection.

通过提出基于图卷积与Transformer的时空网络模型,能够自适应地挖掘特征间的依赖关系以及时序测量数据自身的演化规律,实现准确的多元时序电力物联数据异常检测。模型设计发挥了图卷积神经网络(GCN)和Transformer模型的特点。GCN作为空间网络主要负责挖掘空间特征,而Transformer则通过注意力机制专注于时间趋势的挖掘,然后通过门控机制输出自适应权重从而融合在一起,形成了一个强大的编码器。进一步引入了变分自编码器(VAE)模型,其自适应地学习序列数据的分布,相比于前馈网络更有助于更准确地识别异常点。VAE作为解码器,为异常检测提供了更有力的支持。By proposing a spatiotemporal network model based on graph convolution and Transformer, it is possible to adaptively mine the dependencies between features and the evolution laws of the time series measurement data itself, and realize accurate anomaly detection of multivariate time series power IoT data. The model design takes advantage of the characteristics of the graph convolutional neural network (GCN) and the Transformer model. As a spatial network, GCN is mainly responsible for mining spatial features, while the Transformer focuses on mining time trends through the attention mechanism, and then outputs adaptive weights through the gating mechanism to fuse together to form a powerful encoder. The variational autoencoder (VAE) model is further introduced, which adaptively learns the distribution of sequence data and helps to more accurately identify anomalies compared to the feedforward network. As a decoder, VAE provides stronger support for anomaly detection.

实施例二:Embodiment 2:

电力物联数据异常检测系统,包括:The power IoT data anomaly detection system includes:

数据采集模块,被配置为:获取电力时间序列数据并预处理,经分解得到频率分量和对应的通道数、序列数和预测时间窗口长度,形成数据集;The data acquisition module is configured to: acquire and pre-process the power time series data, decompose and obtain the frequency components and the corresponding number of channels, number of sequences and length of the prediction time window, and form a data set;

特征挖掘模块,被配置为:得到的数据集基于训练完毕的异常检测模型,分别捕获时间序列的长距离时间依赖性与多序列间的特征关系,并根据时间序列数据进行重构得到预测值;The feature mining module is configured to: based on the trained anomaly detection model, the obtained data set captures the long-distance time dependency of the time series and the characteristic relationship between multiple sequences, and reconstructs the time series data to obtain the predicted value;

异常检测模块,被配置为:得到的预测值利用多元高斯分布确定异常得分,以马氏距离作为异常得分的度量标准,当异常得分超过阈值则对应的数据点为异常。The anomaly detection module is configured as follows: the obtained prediction value uses multivariate Gaussian distribution to determine the anomaly score, and the Mahalanobis distance is used as the metric of the anomaly score. When the anomaly score exceeds a threshold, the corresponding data point is anomaly.

系统结合多元高斯分布进行异常检测,能够自适应的挖掘特征间的依赖关系以及时序测量数据自身的演化规律,实现准确的多元时序电力物联数据异常检测,通过引入分解技术,实现对电力数据的多尺度时频特征提取,从而有效捕获数据的局部细节和全局趋势,提供更丰富的多变量时序信息。The system combines multivariate Gaussian distribution for anomaly detection, and can adaptively mine the dependencies between features and the evolution laws of time series measurement data itself, to achieve accurate multivariate time series power IoT data anomaly detection. By introducing decomposition technology, multi-scale time-frequency feature extraction of power data is achieved, thereby effectively capturing local details and global trends of the data, and providing richer multivariate time series information.

实施例三:Embodiment three:

本实施例提供了一种计算机可读存储介质,其上存储有计算机程序,该程序被处理器执行时实现如上述实施例一所述的电力物联数据异常检测方法中的步骤。This embodiment provides a computer-readable storage medium on which a computer program is stored. When the program is executed by a processor, the steps in the power Internet of Things data anomaly detection method as described in the above-mentioned embodiment 1 are implemented.

实施例四:Embodiment 4:

本实施例提供了一种计算机设备,包括存储器、处理器及存储在存储器上并可在处理器上运行的计算机程序,所述处理器执行所述程序时实现如上述实施例一所述的电力物联数据异常检测方法中的步骤。This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, the steps in the power Internet of Things data anomaly detection method as described in the first embodiment above are implemented.

以上实施例二至四中涉及的各步骤与实施例一相对应,具体实施方式可参见实施例一的相关说明部分。术语“计算机可读存储介质”应该理解为包括一个或多个指令集的单个介质或多个介质;还应当被理解为包括任何介质,所述任何介质能够存储、编码或承载用于由处理器执行的指令集并使处理器执行本发明中的任一方法。The steps involved in the above embodiments 2 to 4 correspond to those in embodiment 1. For the specific implementation, please refer to the relevant description of embodiment 1. The term "computer-readable storage medium" should be understood as a single medium or multiple media including one or more instruction sets; it should also be understood to include any medium that can store, encode or carry an instruction set for execution by a processor and enable the processor to execute any method in the present invention.

以上仅为本发明的优选实施例而已,并不用于限制本发明,对于本领域的技术人员来说,本发明可以有各种更改和变化。凡在本发明的精神和原则之内,所作的任何修改、等同替换、改进等,均应包含在本发明的保护范围之内。The above are only preferred embodiments of the present invention and are not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.

Claims (8)

1. The method for detecting the abnormality of the electric power internet of things data is characterized by comprising the following steps of:
acquiring and preprocessing power time sequence data, decomposing to obtain frequency components, corresponding channel numbers, sequence numbers and predicted time window lengths, and forming a data set;
The obtained data set is based on the trained abnormality detection model, the characteristic relation between the long-distance time dependence of the time sequence and the multiple sequences is respectively captured, and the predicted value is obtained by reconstruction according to the time sequence data;
Determining an anomaly score by using the obtained predicted value through multi-element Gaussian distribution, taking the mahalanobis distance as a measurement standard of the anomaly score, and taking the corresponding data point as the anomaly when the anomaly score exceeds a threshold value;
the anomaly detection model comprises a feature processing layer, a space-time network module and a prediction layer, wherein the feature processing layer comprises a preprocessing layer and a convolution network, the space-time network module is provided with a plurality of groups, each group of space-time network module is provided with a double-layer graph convolution layer and a transform model which are connected in parallel, the prediction layer is reconstructed through the convolution layer and a variation self-encoder, the convolution layer and the linear layer respectively reduce the feature dimension, the variation self-encoder reconstruct the sequence and the time dimension, and a prediction result is output;
The spatio-temporal network module includes a spatio-temporal position embedding layer, a picture volume stacking layer, and a transform, and reconstructs time-series data by encoding a time dependency in each time series and correlations between different time series pairs.
2. The method for detecting anomalies in electrical data on an internet of things of claim 1, wherein the preprocessing includes acquiring N electrical time series, and cleaning noise data as input to training.
3. The method for detecting the anomaly of the electric power internet of things data according to claim 1, wherein a frequency component is obtained by stacking discrete wavelet transform methods, and a data set (C, T, N) is constructed, wherein C is the number of sequences obtained after the discrete wavelet decomposition corresponding to the number of channels, T is the length of a predicted time window, and N is the number of multiple time sequences, as shown in the following formula:
where x represents the multi-sequence data representing the original input, w represents the discrete wavelet basis function, Representing coefficients obtained via stacked discrete wavelet transforms,Representing a high pass filterAt the moment of timeIs a value of (a).
4. The method of claim 1, wherein the time length is injected into the input sequence by using a space-time position embedding layer, and the position vector is constructed based on a set function.
5. The method for detecting anomalies in electrical data over internet of things of claim 1, wherein the graph convolution layer obtains an adjacency matrix and a sequence input, and constructs a filter in a fourier domain, the filter constructs a graph convolution model by stacking multiple convolution layers through spatial features between its first-order neighborhood capture nodes.
6. The method for detecting anomalies in electrical data of an internet of things according to claim 1, wherein the relationship between the time hidden information is obtained by detecting multivariate time series data modeled by a time dimension and a feature dimension, respectively, with multiple attentions.
7. The method for detecting anomaly of electric power internet of things data according to claim 1, wherein a mahalanobis distance is used as a measure of anomaly score, as shown in the following formula:
Wherein, A feature vector representing a data point,A mean vector representing a plurality of nodes,Representing the covariance matrix of the node vector,Representing data point to mean vectorIs a mahalanobis distance.
8. Electric power thing allies oneself with data anomaly detection system, its characterized in that includes:
a data acquisition module configured to: acquiring and preprocessing power time sequence data, decomposing to obtain frequency components, corresponding channel numbers, sequence numbers and predicted time window lengths, and forming a data set;
A feature mining module configured to: the obtained data set is based on the trained abnormality detection model, the characteristic relation between the long-distance time dependence of the time sequence and the multiple sequences is respectively captured, and the predicted value is obtained by reconstruction according to the time sequence data;
An anomaly detection module configured to: determining an anomaly score by using the obtained predicted value through multi-element Gaussian distribution, taking the mahalanobis distance as a measurement standard of the anomaly score, and taking the corresponding data point as the anomaly when the anomaly score exceeds a threshold value; the anomaly detection model comprises a feature processing layer, a space-time network module and a prediction layer, wherein the feature processing layer comprises a preprocessing layer and a convolution network, the space-time network module is provided with a plurality of groups, each group of space-time network module is provided with a double-layer graph convolution layer and a transform model which are connected in parallel, the prediction layer is reconstructed through the convolution layer and a variation self-encoder, the convolution layer and the linear layer respectively reduce the dimension of the feature dimension, the variation self-encoder is used for reconstructing the sequence and the time dimension, and a prediction result is output;
The spatio-temporal network module includes a spatio-temporal position embedding layer, a picture volume stacking layer, and a transform, and reconstructs time-series data by encoding a time dependency in each time series and correlations between different time series pairs.
CN202410256677.5A 2024-03-07 2024-03-07 Power Internet of things data anomaly detection method and system Active CN117851920B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202410256677.5A CN117851920B (en) 2024-03-07 2024-03-07 Power Internet of things data anomaly detection method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202410256677.5A CN117851920B (en) 2024-03-07 2024-03-07 Power Internet of things data anomaly detection method and system

Publications (2)

Publication Number Publication Date
CN117851920A CN117851920A (en) 2024-04-09
CN117851920B true CN117851920B (en) 2024-07-05

Family

ID=90529424

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202410256677.5A Active CN117851920B (en) 2024-03-07 2024-03-07 Power Internet of things data anomaly detection method and system

Country Status (1)

Country Link
CN (1) CN117851920B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN118378092B (en) * 2024-06-20 2024-10-25 阿里云飞天(杭州)云计算技术有限公司 Model training method, abnormality detection system, electronic device, and storage medium
CN118396382B (en) * 2024-06-21 2024-12-13 南京邮电大学 Modeling method and system for power data external service danger
CN118468192B (en) * 2024-07-10 2024-10-11 山东大学 Abnormal data detection method and system for distribution network based on lightweight neural network
CN119226983B (en) * 2024-11-29 2025-02-21 国网上海市电力公司 Power time sequence data anomaly detection method, equipment and medium based on large model

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113222145A (en) * 2021-06-04 2021-08-06 西安邮电大学 MODWT-EMD-based time sequence hybrid prediction method
CN115018021A (en) * 2022-08-08 2022-09-06 广东电网有限责任公司肇庆供电局 Machine room abnormity detection method and device based on graph structure and abnormity attention mechanism

Family Cites Families (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113393025A (en) * 2021-06-07 2021-09-14 浙江大学 Non-invasive load decomposition method based on Informer model coding structure
CN114708665A (en) * 2022-05-10 2022-07-05 西安交通大学 Skeleton map human behavior identification method and system based on multi-stream fusion
CN115293205A (en) * 2022-08-08 2022-11-04 杭州海康威视数字技术股份有限公司 Anomaly detection method, self-encoder model training method and electronic equipment
CN115510975A (en) * 2022-09-28 2022-12-23 山东省计算中心(国家超级计算济南中心) Multivariate Time Series Anomaly Detection Method and System Based on Parallel Transofmer-GRU
CN115618196A (en) * 2022-10-18 2023-01-17 湖北工业大学 Transformer anomaly detection method based on spatio-temporal features
CN115688035A (en) * 2022-10-19 2023-02-03 江苏电力信息技术有限公司 Time sequence power data anomaly detection method based on self-supervision learning
CN115809747B (en) * 2023-02-06 2023-05-09 东南大学 Pyramid causal network-based coupling information flow long-term prediction method
CN116186633A (en) * 2023-03-06 2023-05-30 国网江苏省电力有限公司营销服务中心 Power consumption abnormality diagnosis method and system based on small sample learning
CN116663613A (en) * 2023-04-03 2023-08-29 山东大学 A Multivariate Timing Anomaly Detection Method for Intelligent IoT Systems
CN116680105A (en) * 2023-05-31 2023-09-01 南京大学 Time sequence abnormality detection method based on neighborhood information fusion attention mechanism
CN117131452A (en) * 2023-08-29 2023-11-28 国网山东省电力公司信息通信公司 Anomaly detection method and system based on normalized flow and Bayesian network
CN117290800B (en) * 2023-11-24 2024-01-26 华东交通大学 Timing sequence anomaly detection method and system based on hypergraph attention network
CN117313015A (en) * 2023-11-28 2023-12-29 哈尔滨工业大学(深圳)(哈尔滨工业大学深圳科技创新研究院) Time sequence abnormality detection method and system based on time sequence and multiple variables
CN117574275A (en) * 2023-11-28 2024-02-20 国网山东省电力公司电力科学研究院 A power system anomaly detection and classification method
CN117596191A (en) * 2023-12-05 2024-02-23 广东电网有限责任公司 Power Internet of things abnormality detection method, device and storage medium

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113222145A (en) * 2021-06-04 2021-08-06 西安邮电大学 MODWT-EMD-based time sequence hybrid prediction method
CN115018021A (en) * 2022-08-08 2022-09-06 广东电网有限责任公司肇庆供电局 Machine room abnormity detection method and device based on graph structure and abnormity attention mechanism

Also Published As

Publication number Publication date
CN117851920A (en) 2024-04-09

Similar Documents

Publication Publication Date Title
CN117851920B (en) Power Internet of things data anomaly detection method and system
Yang et al. Voice2series: Reprogramming acoustic models for time series classification
CN105095918B (en) A kind of multi-robot system method for diagnosing faults
Wang et al. Research on Healthy Anomaly Detection Model Based on Deep Learning from Multiple Time‐Series Physiological Signals
CN113705396B (en) Motor fault diagnosis method, system and equipment
Nejad et al. A new enhanced learning approach to automatic image classification based on Salp Swarm Algorithm
Azzalini et al. A minimally supervised approach based on variational autoencoders for anomaly detection in autonomous robots
CN114297036A (en) Data processing method and device, electronic equipment and readable storage medium
CN116522265A (en) Industrial Internet time sequence data anomaly detection method and device
Patri et al. Extracting discriminative shapelets from heterogeneous sensor data
CN117540333A (en) Multi-sensor data anomaly detection method and device based on space-time information fusion
Wen et al. Causal-tgan: Modeling tabular data using causally-aware gan
Zhou et al. A feature extraction method for multivariate time series classification using temporal patterns
CN116796275A (en) Multi-mode time sequence anomaly detection method for industrial equipment
Gao et al. A novel fault detection model based on vector quantization sparse autoencoder for nonlinear complex systems
CN111125186A (en) A data processing method and system based on a questionnaire
JP2019105871A (en) Abnormality candidate extraction program, abnormality candidate extraction method and abnormality candidate extraction apparatus
CN115471771A (en) Video time sequence action positioning method based on semantic level time sequence correlation modeling
CN117454266A (en) A multivariate time series anomaly detection model
CN117874673A (en) Abnormal data detection and interpretation method
CN113421546A (en) Cross-tested multi-mode based speech synthesis method and related equipment
CN115310499B (en) Industrial equipment fault diagnosis system and method based on data fusion
Yokkampon et al. Anomaly detection using variational autoencoder with spectrum analysis for time series data
Oyedotun et al. A closer look at autoencoders for unsupervised anomaly detection
Elhalwagy et al. Hybridization of Capsule and LSTM Networks for unsupervised anomaly detection on multivariate data

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant