Consistent Hierarchical Classification with A Generalized Metric

Yuzhou Cao, Lei Feng, Bo AnAISTATS 2024

Abstract

In multi-class hierarchical classification, a natural evaluation metric is the tree distance loss that takes the value of two labels’ distance on the pre-defined tree hierarchy. This metric is motivated by that its Bayes optimal solution is the deepest label on the tree whose induced superclass (subtree rooted at it) includes the true label with probability at least $\frac{1}{2}$. However, it can hardly handle the risk sensitivity of different tasks since its accuracy requirement for induced superclasses is fixed at $\frac{1}{2}$. In this paper, we first introduce a new evaluation metric that generalizes the tree distance loss, whose solution’s accuracy constraint $\frac{1+c}{2}$ can be controlled by a penalty value $c$ tailored for different tasks: a higher c indicates the emphasis on prediction’s accuracy and a lower one indicates that on specificity. Then, we propose a novel class of consistent surrogate losses based on an intuitive presentation of our generalized metric and its regret, which can be compatible with various binary losses. Finally, we theoretically derive the regret transfer bounds for our proposed surrogates and empirically validate their usefulness on benchmark datasets.

Introduction

Hierarchical classification organizes labels into a tree structure, such as a biological taxonomy or a product catalog. Standard evaluation often relies on tree distance loss, which counts the number of edges between the predicted node and the ground truth. While intuitive, this metric has a significant mathematical limitation: its Bayes optimal solution is fixed to a 0.5 accuracy threshold. This means a model is incentivized to predict a specific category only if it is at least 50% certain. In high-stakes domains like medical diagnosis or autonomous driving, this "safeness" guarantee is often insufficient.

The Generalized Tree Distance Loss

To address this, the authors introduce the Generalized Tree Distance Loss ($\ell_H^c$). This metric incorporates a penalty parameter $c \in [0, 1]$ based on the depth of the predicted node. By adjusting $c$, practitioners can shift the accuracy requirement from a fixed 0.5 to a flexible $\frac{1+c}{2}$.

The effect of penalty cost $c$ on the optimal prediction. As $c$ increases, the model requires higher confidence to predict deeper, more specific nodes.

As shown in Figure 1, a higher $c$ forces the model to prioritize accuracy, potentially predicting a more general parent node if confidence in a specific child is low. Conversely, a lower $c$ encourages specificity.

Methodology: Consistent Surrogate Losses

Optimizing hierarchical metrics directly is challenging due to their discrete nature. The researchers propose decomposing the hierarchical risk into $K-1$ binary classification sub-problems, one for each non-root node. To ensure these classifiers are coherent (e.g., a child node cannot be "true" if its parent is "false"), they introduce the H-Coherency property.

Based on this framework, they derive two consistent surrogate losses:

  1. LOG: A cross-entropy-based loss that is well-suited for deep learning optimization.
  2. MAE: A Mean Absolute Error-based loss with strong theoretical properties.

These surrogates are proven to be "consistent," meaning that minimizing the surrogate loss directly leads to the minimization of the target generalized tree distance metric.

Empirical Evaluation

The approach was evaluated on CIFAR-100 (2-level hierarchy) and Fashion-MNIST using WideResNet and standard CNN architectures. The proposed LOG and MAE methods were compared against standard "FLAT" softmax and "One-vs-All" (OvA) baselines.

Comparison of generalized tree distance loss across different penalty costs $c$. The proposed LOG method consistently achieves the lowest loss (bolded values).

The results in Figure 5 demonstrate that the LOG variant consistently outperforms existing methods across various values of $c$. Notably, the "FLAT" baseline, which ignores hierarchy during training, often produces biased estimates because it fails to account for structural relationships between classes during feature learning.

Key Insights

  • Risk Sensitivity: The parameter $c$ acts as a "risk dial," allowing models to be tuned for safety-first or precision-first applications.
  • Optimization Robustness: While MAE has good theoretical bounds, the LOG surrogate proved easier to optimize in deep networks, avoiding gradient sparsity issues often seen with Hinge or MAE losses.
  • Theoretical Rigor: Beyond empirical gains, the paper provides regret transfer bounds that quantify the relationship between surrogate loss minimization and target metric performance.

Conclusion

This generalized metric and consistent surrogates provide a principled way to handle risk sensitivity in hierarchical classification. While currently limited to tree structures, the framework offers a significant step forward in building reliable, confidence-aware hierarchical models.

Summary updated

BibTeX
@inproceedings{cao2024consistent,
  author = {Yuzhou Cao and Lei Feng and Bo An},
  title = {{Consistent Hierarchical Classification with A Generalized Metric}},
  booktitle = {International Conference on Artificial Intelligence and Statistics},
  year = {2024},
  url = {https://openreview.net/forum?id=l0i3VWptqG},
}
Figure