Anomaly detection is a very popular research topic in the field of data analysis,with significant research implications and wide application prospects in intelligent transportation,healthcare,energy management,and automated industry.As a crucial part of energy management,the study of building energy consumption anomaly detection is essential for improving energy efficiency and electrical safety.Currently,many methods have been developed to detect anomalies by introducing time series networks to extract contextual information,designing dynamic thresholds to improve anomaly detection accuracy,and combining association rules for data mining,all of which have achieved satisfactory results.However,these methods still face key issues such as dependency on labeled data,unreasonable anomaly determination,and insufficient energy consumption data representation.In response to these problems,this paper focuses on pseudo-label unsupervised anomaly detection and electricity theft detection tasks based on the combination of contrastive learning and clustering,and builds an anomaly detection model application management platform.The specific research results are as follows:(1)A pseudo-label-based anomaly detection framework(PLAD)is proposed.This framework consists of a pseudo-label extraction module(PLE)and a reconstruction error-based anomaly detection module(READ).Considering the difficulty of parameter selection in different scenarios,an adaptive pseudo-label extraction algorithm based on density clustering is proposed in PLE to extract pseudo-labels.The READ module first uses a dual LSTM(Long Short-Term Memory)autoencoder to extract multi-level temporal features and obtain fused reconstruction errors,then uses a logistic regression classifier to perform anomaly detection,thus avoiding the problem of false or missed detections caused by manually selecting thresholds for anomaly detection.Experimental results on multiple datasets show that this framework has high anomaly detection accuracy and is a practical method for energy consumption data anomaly detection.The effectiveness of the PLE module and dual LSTM autoencoder is further validated through ablation experiments.(2)A contrastive learning and clustering-based unsupervised electricity theft detection algorithm is proposed to address the dependence on labeled data and low accuracy of existing theft detection methods and is suitable for unlabeled power consumption data obtained in real-world scenarios.First,bidirectional Gated Recurrent Unit(GRU)is used to extract the contextual information of energy consumption data,and the representation of power consumption sequences is obtained based on dilated convolutional networks.Then,the model’s learning effect is enhanced by using a hierarchical contrastive learning method.Next,the K-means and adaptive DBSCAN(Density-Based Spatial Clustering of Applications with Noise)algorithms are used to cluster the power consumption sequence representations.Finally,a combined discrimination mechanism is employed based on the clustering results to distinguish between normal and theft users,achieving electricity theft detection.The effectiveness of the proposed method is validated on the SGCC dataset,and the ablation experiment confirms the effectiveness of the proposed clustering combined discrimination mechanism.(3)Based on the aforementioned theoretical research,a web-based anomaly detection application management platform is built using the SpringBoot framework.The platform mainly implements the management of anomaly detection task datasets,data visualization,model management,as well as the implementation,result display,and alarm of anomaly detection tasks.The platform realizes the coordination and cooperation between the algorithm model and the platform system by encapsulating the anomaly detection algorithm as a microservice for the Java backend program to call.Finally,comprehensive functionality and performance tests are conducted on the application platform,verifying that the platform designed and implemented in this paper is suitable for actual anomaly detection tasks. |