CoLA
CoLA copied to clipboard
Construction of positive and negative instance pairs.
After carefully reviewing the code, I understand that the subgraphs produced by the random walk with restart algorithm during the training phase can be referred to as positive pairs, with the target node serving as the node for which the given subgraph or trace was produced. However, I'm not sure how exactly we're creating negative pairs.
Negative instance pairs are created in the discriminator during this code segment, which performs an edge cutting operation. After obtaining the negative instance pairs, the model calculates scores through its computation. for _ in range(self.negsamp_round): c_mi = torch.cat((c_mi[-2:-1,:], c_mi[:-1,:]),0) scs.append(self.f_k(h_pl, c_mi))
The code generating negative pairs isc_mi = torch.cat((c_mi[-2:-1,:], c_mi[:-1,:]),0)
. It seems that the approach is to generate negative samples by circularly shifting the global feature. But I wonder why the choice is c_mi[-2:-1,:]
to shift the second-to-last row rather than the last row? The newly generated c_mi
will have two identical rows.