Visualizing Classification Structure of Large-Scale Classifiers

Bilal Alsallakh, Zhixin Yan, Shabnam Ghaffarzadegan, Zeng Dai, Liu RenarXiv 2020

Introduction

Traditional evaluation of multi-class classifiers relies heavily on the confusion matrix. While effective for small-scale problems, confusion matrices face significant limitations as the number of classes grows into the thousands. Specifically, they suffer from extreme sparsity, as most class pairs are never confused. Furthermore, they operate on "top-1" predictions, discarding the rich information contained in the model's full output distribution. This "top-1 trap" obscures subtle similarities between classes that a model might perceive even when it correctly identifies the ground truth. Finally, confusion matrices are ill-suited for multi-label datasets where errors are not simple pairwise substitutions.

To address these challenges, researchers have proposed a method to visualize the internal structure of large-scale classifiers by analyzing the correlation of prediction scores across a dataset. This approach reveals hierarchical relationships and data quality issues that remain hidden in standard performance metrics.

Methodology

The core of the approach is to treat the prediction scores for each class as a random variable across a set of samples. By calculating the correlation between these variables, we can derive a dense similarity matrix representing the model's internal taxonomy.

Logits and Ranks over Probabilities

Raw probabilities (post-softmax) are often unsuitable for correlation analysis because they are highly skewed toward zero or one. Instead, using raw logits or Spearman’s rank provides a more balanced distribution that captures fine-grained relationships between classes.

Comparison of score, logit, and rank distributions and their resulting correlation matrices.

As shown in the figure above, the logit and rank distributions (b and c) provide a much richer signal for correlation compared to the sparse score distribution (a).

Matrix Seriation

To interpret the resulting $N \times N$ similarity matrix, hierarchical clustering (hclust) is applied to reorder rows and columns. This process, known as matrix seriation, groups similar classes together, revealing block-diagonal structures that correspond to high-level semantic concepts.

Experimental Results

The visualization technique was evaluated across several benchmarks, including Places365, AudioSet, and VGGFace.

Recovering Emergent Taxonomies

In the Places365 dataset, which contains 365 scene categories, the method successfully reconstructed the human-designed hierarchy of "Indoor" vs. "Outdoor" scenes without any prior knowledge of the taxonomy.

Similarity matrix of Places365 classes reordered via hierarchical clustering, revealing an emergent taxonomy.

The visualization clearly shows distinct blocks for indoor, man-made outdoor, and natural outdoor environments. Within these blocks, finer sub-structures emerge, such as groupings for "shopping & dining" or "water, ice, snow."

Debugging Model Behavior and Data Quality

The similarity matrices also serve as a diagnostic tool. In the VGGFace dataset, high correlations were observed between distinct celebrity identities. Investigation revealed that these individuals were often spouses or co-stars who frequently appeared together in training images, leading to "data leakage" where the model associated their features. Additionally, the model grouped monochrome photos together regardless of the subject's identity, suggesting an over-reliance on low-level texture features.

In multi-label audio classification (AudioSet), the matrices exhibited "flame patterns"—linear streaks extending from the diagonal. These patterns identify broad categories (e.g., "Music") that encompass a wide variety of specific sub-classes (e.g., "Guitar," "Piano"), effectively mapping the multi-label dependencies.

Conclusion

By moving beyond the binary "right/wrong" counts of confusion matrices to a continuous measure of class similarity, this method provides a more nuanced view of a classifier's internal logic. The approach is robust to class imbalance, solves the sparsity problem, and works across diverse modalities. Future work will focus on optimizing the computational efficiency of matrix seriation for even larger class sets and developing interactive tools for real-time model debugging.

Summary updated

BibTeX
@misc{alsallakh2020visualizing,
  author = {Bilal Alsallakh and Zhixin Yan and Shabnam Ghaffarzadegan and Zeng Dai and Liu Ren},
  title = {{Visualizing Classification Structure of Large-Scale Classifiers}},
  year = {2020},
  eprint = {2007.06068},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2007.06068},
}
Figure