NegativeSamplerΒΆ

class dgl.graphbolt.NegativeSampler(datapipe, negative_ratio)[source]ΒΆ

Bases: torch.utils.data.datapipes.datapipe.IterDataPipe[torch.utils.data.datapipes.iter.callable.T_co]

A negative sampler used to generate negative samples and return a mix of positive and negative samples.

Functional name: sample_negative.

Parameters
  • datapipe (DataPipe) – The datapipe.

  • negative_ratio (int) – The proportion of negative samples to positive samples.