dig.auggraph.dataset

Dataset interfaces under dig.auggraph.dataset.

class AUG_trans(augmenter, device, pre_trans=None, post_trans=None)[source]

This class generates an augmentation from a given sample.

Parameters
  • augmenter (function) – This method generates an augmentation from the given sample.

  • device (str) – The device on which the data will be processed.

  • pre_trans (function, optional) – This transformation is applied on the original sample before an augmentation is generated. Default is None.

  • post_trans (function, optional) – This transformation is applied on the generated augmented sample. Default is None.

__call__(data)[source]

This is the main function that generates an augmentation from a given sample.

Parameters

data – The given data sample.

Returns

A transformed graph.

class DegreeTrans(dataset, in_degree=False)[source]

This class is used to add vertex degree based node features to graphs. This is usually used to preprocess the graph datasets that do not have node features.

__call__(data)[source]

This is the main function that adds vertex degree based node features to the given graph.

Parameters
class Subset(subset, transform=None)[source]

This class is used to create of a subset of a dataset.

Parameters
  • subset (torch.utils.data.Dataset) – The given dataset subset.

  • transform (function, optional) – A transformation applied on each sample of the dataset before it will be used. Default is None.

__getitem__(index)[source]

This method returns the sample at the given index in the subset.

Parameters

index (int) – The index in the subset of the required sample.

__len__()[source]

Returns the number of samples in the subset.

class TripleSet(dataset, transform=None)[source]

This class inherits from the torch.utils.data.Dataset class and in addition to each anchor sample, it returns a random positive and negative sample from the dataset. A positive sample has the same label as the anchor sample and a negative sample has a different label than the anchor sample.

Parameters
  • dataset (torch.utils.data.Dataset) – The dataset for which the triple set will be created.

  • transform (function, optional) – A transformation that is applied on all original samples. In other words, this transformation is applied to the anchor, positive, and negative sample. Default is None.

__getitem__(index)[source]

For a given index, this sample returns the original/anchor sample from the dataset at that index and a corresponding positive, and negative sample.

Parameters

index (int) – The index of the anchor sample in the dataset.

Returns

A tuple consisting of the anchor sample, a positive sample, and a negative sample respectively.

__len__()[source]
Returns

The number of samples in the original dataset.