Class imbalance occurs when some classification labels have many more examples than others. In a graph, count the nodes assigned to each class before trusting an overall performance score: a model can appear strong while doing poorly on a rare class that matters. section 3.5 section 4.4.2
Spot it in node labels
The Amazon Products graph has 47 target categories. Books has 668,950 nodes, while Digital Music has six and one unknown category has just one. The mean is 52,107 nodes per category, but the median is 3,653. A class-count plot—or the class-count sidebar of a confusion matrix—makes this disparity visible. section 3.5 section 3.3.3
Imbalance becomes especially consequential when the minority class is the point of the task. In a fraud-detection graph, only 14.5% of nodes are labeled fraudulent. AUC alone can mask weak minority-class results, so inspect precision, recall, and F1 together. In one comparison, GATv2 reached recall of 1 but precision of 0.145 and F1 of 0.254; XGBoost reached precision of 0.855 and F1 of 0.734. section 4.4.2
Practical responses include:
- Reshuffle training batches to include equal portions of majority- and minority-class nodes. A BalancedNodeSampler example samples majority indices randomly and minority indices with replacement. section 4.4.2
- Consider over-sampling, under-sampling, or cost-sensitive learning. GraphSMOTE extends synthetic minority over-sampling by generating nodes and edges. section 4.4.2
- Check the graph-specific costs: a change in samples must account for topology, node dependencies, and scalability. Also inspect how any selected subgraph represents the available classes. section 4.4.2 section 3.3.3
Table 4.10 Comparing F1, precision, recall, and AUC of the GATv2 model trained with a class reshuffling method
|
Metric
|
Value
|
|---|---|
|
Mean validation F1 score
|
0.809
|
|
Mean validation precision
|
0.878
|
|
Mean validation recall
|
0.781
|
|
Mean validation AUC
|
0.914
|
The reported validation precision, recall, F1, and AUC show what to inspect after class reshuffling, rather than relying on one score. section 4.4.2










