Unverified Commit 7d87dcec authored by Rhett Ying's avatar Rhett Ying Committed by GitHub
Browse files

[GraphBolt][Doc] update impl (#6418)

parent c1d117a6
......@@ -56,8 +56,6 @@ Standard Implementations
OnDiskDataset
BuiltinDataset
OnDiskTask
OnDiskMetaData
CSCSamplingGraph
UniformNegativeSampler
NeighborSampler
......
......@@ -10,7 +10,7 @@ __all__ = ["BasicFeatureStore"]
class BasicFeatureStore(FeatureStore):
r"""Basic feature store."""
r"""A basic feature store to manage multiple features for access."""
def __init__(self, features: Dict[Tuple[str, str, str], Feature]):
r"""Initiate a basic feature store.
......
......@@ -16,6 +16,17 @@ from ..sampling_graph import SamplingGraph
from .sampled_subgraph_impl import SampledSubgraphImpl
__all__ = [
"GraphMetadata",
"CSCSamplingGraph",
"from_csc",
"load_from_shared_memory",
"load_csc_sampling_graph",
"save_csc_sampling_graph",
"from_dglgraph",
]
class GraphMetadata:
r"""Class for metadata of csc sampling graph."""
......@@ -76,7 +87,7 @@ class GraphMetadata:
class CSCSamplingGraph(SamplingGraph):
r"""Class for CSC sampling graph."""
r"""A sampling graph in CSC format."""
def __repr__(self):
return _csc_sampling_graph_str(self)
......
......@@ -8,9 +8,13 @@ from ..utils import unique_and_compact_node_pairs
from .sampled_subgraph_impl import SampledSubgraphImpl
__all__ = ["NeighborSampler", "LayerNeighborSampler"]
@functional_datapipe("sample_neighbor")
class NeighborSampler(SubgraphSampler):
"""
"""Sample neighbor edges from a graph and return a subgraph.
Neighbor sampler is responsible for sampling a subgraph from given data. It
returns an induced subgraph along with compacted information. In the
context of a node classification task, the neighbor sampler directly
......@@ -121,7 +125,8 @@ class NeighborSampler(SubgraphSampler):
@functional_datapipe("sample_layer_neighbor")
class LayerNeighborSampler(NeighborSampler):
"""
"""Sample layer neighbor edges from a graph and return a subgraph.
Sampler that builds computational dependency of node representations via
labor sampling for multilayer GNN from the NeurIPS 2023 paper
`Layer-Neighbor Sampling -- Defusing Neighborhood Explosion in GNNs
......
......@@ -279,13 +279,13 @@ class OnDiskTask:
class OnDiskDataset(Dataset):
"""An on-disk dataset.
"""An on-disk dataset which reads graph topology, feature data and
Train/Validation/Test set from disk.
An on-disk dataset is a dataset which reads graph topology, feature data
and TVT set from disk. Due to limited resources, the data which are too
large to fit into RAM will remain on disk while others reside in RAM once
``OnDiskDataset`` is initialized. This behavior could be controled by user
via ``in_memory`` field in YAML file.
Due to limited resources, the data which are too large to fit into RAM will
remain on disk while others reside in RAM once ``OnDiskDataset`` is
initialized. This behavior could be controled by user via ``in_memory``
field in YAML file.
A full example of YAML file is as follows:
......@@ -477,12 +477,10 @@ class OnDiskDataset(Dataset):
class BuiltinDataset(OnDiskDataset):
"""GraphBolt builtin on-disk dataset.
"""A utility class to download built-in dataset from AWS S3 and load it as
``OnDiskDataset``.
This class is used to help download datasets from DGL S3 storage and load
them as ``OnDiskDataset``.
Available builtin datasets include:
Available built-in datasets include:
**ogbn-mag**
The ogbn-mag dataset is a heterogeneous network composed of a subset of
......
......@@ -8,10 +8,12 @@ import torch
from ..base import etype_str_to_tuple
from ..sampled_subgraph import SampledSubgraph
__all__ = ["SampledSubgraphImpl"]
@dataclass
class SampledSubgraphImpl(SampledSubgraph):
r"""Class for sampled subgraph specific for CSCSamplingGraph.
r"""Sampled subgraph of CSCSamplingGraph.
Examples
--------
......
......@@ -12,7 +12,7 @@ __all__ = ["TorchBasedFeature", "TorchBasedFeatureStore"]
class TorchBasedFeature(Feature):
r"""Torch based feature."""
r"""A wrapper of pytorch based feature."""
def __init__(self, torch_feature: torch.Tensor):
"""Initialize a torch based feature store by a torch feature.
......@@ -130,7 +130,7 @@ class TorchBasedFeature(Feature):
class TorchBasedFeatureStore(BasicFeatureStore):
r"""Torch based feature store."""
r"""A store to manage multiple pytorch based feature for access."""
def __init__(self, feat_data: List[OnDiskFeatureData]):
r"""Load feature stores from disk.
......
......@@ -4,14 +4,16 @@ from torch.utils.data import functional_datapipe
from ..negative_sampler import NegativeSampler
__all__ = ["UniformNegativeSampler"]
@functional_datapipe("sample_uniform_negative")
class UniformNegativeSampler(NegativeSampler):
"""
Negative samplers randomly select negative destination nodes for each
source node based on a uniform distribution. It's important to note that
the term 'negative' refers to false negatives, indicating that the sampled
pairs are not ensured to be absent in the graph.
"""Sample negative destination nodes for each source node based on a uniform
distribution.
It's important to note that the term 'negative' refers to false negatives,
indicating that the sampled pairs are not ensured to be absent in the graph.
For each edge ``(u, v)``, it is supposed to generate `negative_ratio` pairs
of negative edges ``(u, v')``, where ``v'`` is chosen uniformly from all
the nodes in the graph.
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment