## 2 Network Attacks in Distributed Photovoltaic Microgrids
### UMAP Theory  
To enhance the model's effectiveness in anomaly detection tasks and focus on the most relevant features, we adopted the advanced dimensionality reduction technique, Uniform Manifold Approximation and Projection (UMAP) [27]. UMAP is particularly suitable for handling high-dimensional data because it effectively reduces the dimensionality while preserving both local and global structures of the data, thus providing concise and information-rich input features for subsequent anomaly detection. The theoretical foundation of UMAP stems from manifold learning, aiming to preserve the neighborhood relationships in high-dimensional data so that data points with similar characteristics remain adjacent in the low-dimensional space. Compared to traditional dimensionality reduction methods such as Principal Component Analysis (PCA), UMAP is better suited for dealing with non-linear data structures. It not only retains local neighborhood relationships but also maintains a global topological structure, making it particularly effective for visualization and feature extraction from high-dimensional data, especially for capturing key patterns in complex time series. The UMAP process can be divided into two main steps: first, learning the manifold structure of the data in the high-dimensional space, and second, projecting this manifold into a low-dimensional space. This entire process is based on a series of mathematical operations and is finalized through optimization techniques to achieve the low-dimensional representation of the data. During the manifold structure learning phase in the high-dimensional space, UMAP employs the Nearest-Neighbor Descent algorithm [28] to identify each data point's nearest neighbors. After identifying these neighbors, UMAP constructs a neighborhood graph to further capture the manifold structure of the data. To better reflect the local characteristics of the data, UMAP assumes that data points are uniformly distributed on the manifold and adjusts the distance metric between different regions adaptively. This means that the distances between data points dynamically change based on the density of the regions they reside in, allowing the algorithm to adapt to both sparse and dense areas, and ensuring compatibility with both local and global patterns. Moreover, to prevent disconnected points in the learned manifold structure, UMAP introduces a mechanism to ensure that all points maintain meaningful connections. For this purpose, UMAP assigns weights to the edges of the graph, with the weights reflecting the similarity between data points, and further optimizes these connections through a probabilistic framework. Since UMAP employs adaptive distance metrics, the edge weights between different pairs of points may be asymmetric. UMAP symmetrizes these edge weights to ensure the symmetry of the neighborhood graph, thereby more accurately representing the relationships between data points. Once the manifold structure in the high-dimensional space is learned, UMAP proceeds to the second step, which is to find a low-dimensional representation of the data. In this process, UMAP aims to preserve the manifold structure of the high-dimensional data as much as possible while minimizing the changes in distances between data points. UMAP optimizes the low-dimensional embedding by minimizing a cross-entropy objective function to find the optimal weights for the edges in the low-dimensional space.