NegativeSampler

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

Bases: MiniBatchTransformer

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.