# MVCG-SPS: A Multi-View Contrastive Graph Neural Network for Smart Ponzi Scheme Detection
## 4 MVCG-SPS Method
### Multi-Scale Contrastive Learning  
The core objective of contrastive learning is to minimize the embedding distance between positive sample pairs, while maximizing the embedding distance between negative sample pairs. The Multi-Scale Contrastive Learning (MSCL) module within the MVCG-SPS framework aims to enhance the model's anomaly detection capabilities by integrating complementary information from different scales of graph representation. The core hypothesis is that the fusion of features at different granularities can provide a more comprehensive perspective on the network structure, which is critical for identifying anomalous behaviors that may not be evident when relying solely on local or global information. This module effectively captures the complex interaction patterns in multi-view heterogeneous graphs by designing contrastive learning loss functions for both within-view and cross-view learning. 1. Formulation of Multi-Scale Contrastive Learning  
Let \(G=(V,E,X)\) denote an attributed graph, where \(V\) is the set of nodes, \(E\) is the set of edges, and \(X\) is the attribute matrix. Through \(K\) layers of Graph Convolutional Networks (GCNs), we obtain \(K\) different scales of graph representations, denoted as \(\left\{G^{(k)}\right\}_{k=1}^{K}\), where \(G^{(1)}\) represents the most local information, and \(G^{(K)}\) represents the most global information. The goal of the MSCL module is to learn a representation \(H\) that minimizes the contrastive loss function \(L_{\text{contrastive}}\). The contrastive loss is defined as follows:\[L_{\text{contrastive}}=-\frac{1}{N}\sum_{i=1}^{N}\left[\log\frac{\exp(\text{ sim}(\mathbf{z}_{i},\mathbf{z}_{i}^{+}))}{\exp(\text{sim}(\mathbf{z}_{i},\mathbf{z}_{i}^{+}))+ \sum_{j\
eq i}\exp(\text{sim}(\mathbf{z}_{i},\mathbf{z}_{j}^{-}))}\right], \tag{8}\]  
where \(\mathbf{z}_{i}\) and \(\mathbf{z}_{i}^{+}\) represent the embeddings of positive sample pairs, \(\mathbf{z}_{j}^{-}\) represents the embedding of negative samples, and \(\text{sim}(\cdot\cdot)\) is the similarity function (e.g., cosine similarity). 2. Intra-View Contrastive Learning  
In intra-view learning, the node embeddings and their corresponding subgraph embeddings need to be aligned. Given the node embedding \(\mathbf{h}_{i}\) and its corresponding subgraph embedding \(\mathbf{g}_{i}\), the intra-view contrastive learning loss is defined as follows:  
\[L_{\text{intra}}=\frac{1}{N}\sum_{i=1}^{N}\left[-\log\sigma(\mathbf{h}_{i}^{ \top}\mathbf{g}_{i})-\sum_{j\
eq i}\log\sigma(-\mathbf{h}_{i}^{\top}\mathbf{ g}_{j})\right], \tag{9}\]  
where \(\sigma(x)\) is the Sigmoid function used to ensure consistency within the view. 3. Cross-View Subgraph Alignment  
Cross-view contrastive learning aims to align non-aligned subgraph pairs generated by different views. Earth Mover's Distance (EMD) is used to measure the transportation cost between subgraph distributions:  
\[\text{EMD}(P,Q)=\inf_{\gamma\in\Gamma(P,Q)}\sum_{(p,q)\in P\times Q}\gamma(p, q)\|p-q\|, \tag{10}\]  
where \(\Gamma(P,Q)\) represents all possible transportation plans between distributions \(P\) and \(Q\). The cross-view contrastive loss is defined as follows:  
\[L_{\text{inter}}=\frac{1}{M}\sum_{i=1}^{M}\text{EMD}(\mathbf{S}_{i}^{(1)}, \mathbf{S}_{i}^{(2)}), \tag{11}\]  
where \(\mathbf{S}_{i}^{(1)}\) and \(\mathbf{S}_{i}^{(2)}\) are the subgraph embeddings from two different views. 4. Multi-Scale Loss Integration  
Multi-scale contrastive learning integrates local and global information, and the final loss function is  
\[L_{\text{total}}=\lambda_{\text{intra}}L_{\text{intra}}+\lambda_{\text{inter}} L_{\text{inter}}, \tag{12}\]  
where \(\lambda_{\text{intra}}\) and \(\lambda_{\text{inter}}\) are the weight factors for intra-view and cross-view losses, used to balance their importance. Subgraph embeddings are generated using a graph convolution encoder. Data augmentation techniques include edge random dropping and feature masking, to enhance the effectiveness of contrastive learning.