class CustomNegativeSampler:
def __init__(self, k=1):
self.k = k
neg_g, _ = dgl.load_graphs(neg_graph.dgl')
self.neg_g = neg_g[0]
def __call__(self, g, eids, exclude_eids=None):
src, dst = self.neg_g.edges()
num_samples = len(eids) * self.k
random_indices = torch.randint(0, len(src), (num_samples,))
neg_src = src[random_indices]
neg_dst = dst[random_indices]
this is my custom negative sampler im trying to use and i get this error:
TypeError: This sampler does not support edge or link prediction; please add anoptional third argument for edge IDs to exclude in its sample() method.
can anyone explain what i must modify in my code ?