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.
- 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
data (
torch_geometric.data.data.Data
) – The graphfeatures. (with vertex degrees as node) –
- 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.
- 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.