scglue.models.data.GraphDataset

class scglue.models.data.GraphDataset(graph, vertices, edge_weight, edge_sign, neg_samples=1, weighted_sampling=True, deemphasize_loops=True, getitem_size=1)[source]

Bases: Generic[torch.utils.data.dataset.T_co]

Dataset for graphs with support for negative sampling

Parameters
  • graph (Graph) – Graph object

  • vertices (Index) – Indexer of graph vertices

  • edge_weight (str) – Key of edge attribute for edge weight

  • edge_sign (str) – Key of edge attribute for edge sign

  • neg_samples (int) – Number of negative samples per edge

  • weighted_sampling (bool) – Whether to do negative sampling based on vertex importance

  • deemphasize_loops (bool) – Whether to deemphasize self-loops when computing vertex importance

  • getitem_size (int) – Unitary fetch size for each __getitem__ call

Note

Custom shuffling performs negative sampling.

Methods

accept_shuffle

Accept shuffling result

graph2triplet

Convert graph object to graph triplet

propose_shuffle

Propose shuffling using a given random seed

Attributes

logger