WebKB
¶
WebKB(
name: WEBKB_NAMES,
base_dir: Optional[str] = None,
pre_transform: Optional[Callable] = None,
transform: Optional[Callable] = None,
)
Bases: _GeomGCNDataset
The WebKB datasets used in the "Geom-GCN: Geometric Graph Convolutional Networks" paper.
Nodes represent web pages and edges represent hyperlinks between them. Node features are the bag-of-words representation of web pages. The task is to classify the nodes into one of the five categories: student, project, course, staff, and faculty. The graphs are directed and strongly heterophilous.
The 10 fixed train/validation/test splits (60%/20%/20%) of the Geom-GCN
paper are stored as masks of shape [num_nodes, 10] in the
train_mask, val_mask and test_mask attributes.
This dataset follows the implementation of PyG.
| Name | #nodes | #edges | #features | #classes |
|---|---|---|---|---|
| cornell | 183 | 298 | 1,703 | 5 |
| texas | 183 | 325 | 1,703 | 5 |
| wisconsin | 251 | 515 | 1,703 | 5 |
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
WEBKB_NAMES
|
The name of the dataset ( |
required |
base_dir
|
Optional[str]
|
Directory where to store dataset files. Default is
in the local directory |
None
|
pre_transform
|
Optional[Callable]
|
A function/transform applied to the graph once, before it is saved. |
None
|
transform
|
Optional[Callable]
|
A function/transform applied to the graph at every access. |
None
|
Example:
from mlx_graphs.datasets import WebKB
dataset = WebKB("cornell")
>>> cornell(num_graphs=1)
dataset[0]
>>> GraphData(
edge_index(shape=(2, 298), int32)
node_features(shape=(183, 1703), float32)
node_labels(shape=(183,), int32)
train_mask(shape=(183, 10), bool)
val_mask(shape=(183, 10), bool)
test_mask(shape=(183, 10), bool))
Source code in mlx_graphs/datasets/geom_gcn.py
from mlx_graphs.datasets import WebKB · mlx_graphs/datasets/geom_gcn.py