- class NegativeSampler(data: Graph, device: torch.device, loss_info: Dict)
Bases:
BaseSamplerWithNegative
Sampler for positive and negative edges using random walk based methods
- Parameters:
data – (Graph): Input dataset
device – (device): Either ‘cuda’ or ‘cpu’
loss_info – (dict): Dict of parameters of unsupervised loss function
- negative_sample(batch: torch_geometric.data.Batch) Tuple[torch_geometric.typing.Tensor, torch_geometric.typing.Tensor]
Sample positive and negative edges for batch nodes
- Parameters:
batch – (Batch): Nodes for positive and negative sampling from them
- Returns:
(Tensor, Tensor): positive and negative samples
- class SamplerAPP(data: Graph, device: torch.device, loss_info: Dict)
Bases:
BaseSamplerWithNegative
Sample positive and negative edges for APP unsupervised loss function
- Parameters:
data – (Graph): Input dataset
device – (device): Either ‘cuda’ or ‘cpu’
loss_info – (dict): Dict of parameters of unsupervised loss function
- sample(batch: torch_geometric.data.Batch) Tuple[torch_geometric.typing.Tensor, torch_geometric.typing.Tensor]
Sample positive and negative edges for batch of nodes
- Parameters:
batch – (Batch): Batch for which sampling should be conducted
- Returns:
(Tensor,Tensor): positive and negative edges
- class SamplerContextMatrix(data: Graph, device: torch.device, loss_info: Dict)
Bases:
BaseSamplerWithNegative
Sample positive and negative edges for context matrix based unsupervised loss function
- Parameters:
data – (Graph): Input dataset
device – (device): Either ‘cuda’ or ‘cpu’
loss_info – (dict): Dict of parameters of unsupervised loss function
- class SamplerFactorization(data: Graph, device: torch.device, loss_info: Dict)
Bases:
BaseSampler
Sample positive and negative edges for context matrix based unsupervised loss function
- Parameters:
data – (Graph): Input dataset
device – (device): Either ‘cuda’ or ‘cpu’
loss_info – (dict): Dict of parameters of unsupervised loss function
- sample(batch: torch_geometric.typing.Tensor) torch_geometric.typing.Tensor
Sample of positive and negative edges for Graph Factorization-based unsupervosed loss functions
- Parameters:
batch – (Batch): Nodes for which sampling should be conducted
- Returns:
(Tensor): Positive and negative edges
- class SamplerRandomWalk(data: Graph, device: torch.device, loss_info: Dict)
Bases:
BaseSamplerWithNegative
Sampler for positive and negative edges using random walk based methods
- Parameters:
data – (Graph): Input dataset
device – (device): Either ‘cuda’ or ‘cpu’
loss_info – (dict): Dict of parameters of unsupervised loss function