ClusterLoader
¶
ClusterLoader(
cluster_data: ClusterData, batch_size: int = 1, shuffle: bool = False
)
Merges batch_size clusters of a ClusterData per mini-batch
and yields the subgraph they induce, including the edges between the
merged clusters (Cluster-GCN's stochastic multiple partitions), following
PyG's ClusterLoader.
Each batch is a GraphData with node- and edge-level attributes
sliced to the subgraph, plus n_id and e_id.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
cluster_data
|
ClusterData
|
The partitioned graph. |
required |
batch_size
|
int
|
Number of clusters per mini-batch. Defaults to 1 |
1
|
shuffle
|
bool
|
Whether to shuffle the clusters at each epoch. Defaults to False |
False
|
Example:
cluster_data = ClusterData(data, num_parts=1500)
loader = ClusterLoader(cluster_data, batch_size=20, shuffle=True)
Source code in mlx_graphs/loaders/cluster.py
from mlx_graphs.loaders import ClusterLoader · mlx_graphs/loaders/cluster.py