liveBook · Manning

Class imbalance

As explained in Graph Algorithms for Data Science

Class imbalance is a condition in which classes in a classification dataset occur with substantially unequal frequencies.

Class imbalance occurs when classification classes appear with substantially unequal frequencies. In link prediction, sparse graphs produce many more negative examples—node pairs without relationships—than positive examples. section 10.2.3 section 10.2

Class imbalance creates practical modeling problems:

  • Negative examples can scale quadratically with the number of nodes, while positive relationships scale linearly. section 10.2.3
  • A model can achieve high accuracy by always predicting the majority class, while misclassifying most minority-class examples. section 10.2.3
  • Link-prediction workflows commonly subsample negative examples until their count is approximately comparable to the positive examples. section 10.2 section 10.6

Sparse social-network relationships

A social platform may contain billions of possible user pairs but only a small number of existing relationships for each user. Predicting that no link exists for every pair could produce around 99% accuracy while failing to identify new relationships. A practical exercise constructs roughly 13,082 negative examples—or the number of positive examples produced—while ensuring the selected pairs have no relationship in the feature, training, or test sets. section 10.2.3

How Graph Algorithms for Data Science covers it

How deep it goes
Explains scaling, majority-class accuracy, minority-class errors, and negative-example subsampling, but does not develop broader imbalance methods.
Examples
Uses sparse social-network pairs, approximately 99% majority-class accuracy, and an exercise targeting 13,082 negative samples.
What it assumes
Assumes positive and negative link examples and teaches why their frequencies diverge in sparse graphs.
What you can do after
Apply negative-example subsampling to create approximately balanced link-prediction classification samples.
How it connects
Connects class imbalance with link prediction, negative examples, dataset splitting, and data leakage.

Also explained in

Compare how 11 books explain class imbalance →

Related concepts

This explainer was generated by Manning's knowledge graph from the text of Graph Algorithms for Data Science. The section links point to the parts of the book it draws on.