## 3 Methods
### Overview
In contrast, STformer's multi-head self-attention mechanism captures both long-term and short-term dependencies in time-series data more efficiently, with accuracy and Recall approximately 10% higher than those of Deep-SVDD, especially excelling in complex distributed PV systems. VAR (Vector Autoregression), a traditional time-series forecasting model, is widely used for modeling linear dependency data. However, due to the highly nonlinear and dynamic characteristics of data in distributed PV systems, VAR's performance in these contexts is limited. Experimental results indicate that VAR achieved only 84.52% accuracy and 82.88% Recall in Case 1, with a similar performance in Case 2. STformer, leveraging its multi-head self-attention mechanism, effectively responds to the nonlinear dynamic changes in multivariate time-series data, achieving accuracy and Recall approximately 15% higher than those of VAR, demonstrating STformer's significant advantages in handling nonlinear data. Traditional anomaly detection methods, such as OC-SVM and SVDD, mainly rely on local data features and distance metrics. These methods perform well on low-dimensional data and small datasets but often struggle with high-dimensional, complex time-series data. This is because traditional methods find it challenging to capture the dynamic changes and complex dependencies among multivariate data in time series. In contrast, STformer introduces a self-attention mechanism that can simultaneously handle the complex relationships between time dimensions and variable dimensions, significantly enhancing detection capabilities on large-scale, high-dimensional data. LSTM (Long Short-Term Memory) and its variant LSTM-VAE (LSTM with Variational Autoencoder) are classical models for handling sequence data, capable of capturing long- and short-term dependencies through memory units. However, LSTM and its variants often face issues of high complexity and a large number of parameters, making them prone to overfitting, particularly when data are limited. Experiments show that LSTM-VAEachieved 92.83% accuracy and 91.15% Recall in Case 1, and, although it performed well with time-series data, it still fell short of STformer. STformer not only captures temporal dependencies but also effectively models interactions between multiple variables through its variable block, enhancing anomaly detection performance. The F1-score improved by approximately 5% to 7% compared to LSTM-VAE in both cases. Additionally, BeatGAN, a GAN-based model for anomaly detection, generates synthetic data for detection purposes. While it performs well in specific scenarios, the GAN training process can be unstable, often leading to mode collapse or gradient vanishing issues. In our experiments, BeatGAN achieved an F1-score of 92.32%, whereas STformer's F1-score reached 97.47%, exceeding BeatGAN by 5%. Furthermore, BeatGAN struggles to generate precise synthetic data for long time series, while STformer models both temporal dependencies and multivariate interactions more effectively through its self-attention mechanism, ensuring accuracy and stability in detection results. Deep learning methods have made significant progress in anomaly detection, particularly with models like LSTM, LSTM-VAE, and GAN, which perform well with time-series data. These models effectively identify anomalous behaviors by learning dependencies within time series. However, their shortcomings lie in neglecting the interrelations between variables. STformer addresses this issue by incorporating a variable attention mechanism into its architecture, allowing it to model both temporal dependencies and variable interactions simultaneously, thereby outperforming traditional models in multivariate anomaly detection tasks. OmniAnomaly and InterFusion are recent deep learning-based anomaly detection models that combine autoencoders and graph convolutional networks (GCNs) to enhance detection capabilities.