Optimizing the Geometric Mean for Imbalanced Learning

20 concepts13 papers1 proposal

When a dataset is heavily skewed—such as in rare disease diagnosis, fraud detection, or equipment failure monitoring—standard machine learning objectives break down. If 99% of the data belongs to a majority class, a naive model can achieve 99% accuracy simply by predicting the majority class every time.

To prevent models from ignoring rare events, researchers have increasingly turned to the Geometric Mean (G-mean) of class-specific metrics. Rather than just using it as an afterthought for evaluation, modern techniques integrate the geometric mean directly into loss functions and optimization objectives.

The Intuition: Why the Geometric Mean?

To understand why the geometric mean is uniquely suited for imbalanced learning, consider the difference between an arithmetic mean and a geometric mean. Suppose we have two classes, and a model achieves a true positive rate (TPR) of $100\%$ on the majority class but $0\%$ on the minority class.

The arithmetic mean of these rates is deceptively high: $$\frac{1.0 + 0.0}{2} = 0.50$$

The geometric mean, however, is unforgiving: $$\sqrt{1.0 \times 0.0} = 0.0$$

Because the geometric mean multiplies the metrics together before taking the root, it is highly sensitive to small values. If performance on any single class approaches zero, the entire metric drops precipitously. This mathematical property acts as a severe penalty against neglecting underrepresented categories, forcing the model to maintain a balance between identifying rare events and preserving overall precision.

Exposing Hidden Failures in Evaluation

Before using the geometric mean to train models, it must be used to evaluate them. Traditional metrics like standard accuracy or even macro-F1 can mask poor minority class recognition.

For instance, in deep learning, there is a common misconception that scaling up network depth automatically resolves data complexities. However, Ghosh et al. (2021) and Ghosh et al. (2024) demonstrated that deep architectures inherit the same sensitivities to data skew as shallow models. By using the geometric mean of class-specific accuracies as a robust evaluation metric, the authors showed that network depth and standard regularization offer surprisingly little relief for severe class imbalance, a reality that standard accuracy metrics frequently hide.

The metric's robustness makes it valuable across diverse domains:

  • Stream and Fault Detection: Wang et al. utilized G-mean to provide a balanced assessment of continuously arriving data streams in online fault detection.
  • Social Media Text Mining: In rumor stance classification, where standard comments vastly outnumber critical "support" or "deny" replies, Li et al. used Geometric Mean Recall (GMR) to prevent models that perform poorly on scarce classes from appearing superior.
  • Label Ranking: Zhang et al. (2018) extended G-mean to subjective emotion mining by decomposing label ranking into pairwise comparisons and computing the geometric mean of recall for each pair.
  • AI Safety Monitoring: Even in advanced AI alignment tasks, Guan et al. leveraged the squared geometric mean of the True Positive Rate and True Negative Rate to evaluate monitoring systems where safety violations are exceedingly rare compared to standard operations.

Moving from Evaluation to Direct Optimization

If the geometric mean is the ultimate arbiter of performance on imbalanced data, why not optimize for it directly? Historically, models were trained on smooth losses like cross-entropy, and cost-sensitive adjustments were made post-hoc. Early work by Karakoulas et al. proved that modifying training frameworks to prioritize the minority class could significantly boost the geometric mean of precision and recall (e.g., from 0.77 to 0.89).

Modern approaches embed the geometric mean directly into the training loop:

1. Geometric Mean Loss Functions

In long-tailed image classification, models often achieve high average accuracy by completely sacrificing the hardest categories. To combat this, Du et al. introduced Geometric Mean Loss (GML). By optimizing for the geometric mean of per-class recalls during a fine-tuning stage, the loss function shifts the training focus entirely toward the most difficult categories as soon as their accuracy drops. This lifts the performance floor of the entire system without compromising overall accuracy.

2. Online Gradient Optimization

For streaming data, models cannot afford a secondary fine-tuning stage. Maurya et al. developed OGMEAN, an online anomaly detection algorithm that directly optimizes the G-mean metric in real time. This allows the model to update its decision boundaries dynamically as new data arrives, maintaining a fast and consistent balance between minority and majority class recall.

3. Cost-Sensitive Architectures and Metaheuristics

Instead of altering the loss function alone, some frameworks integrate the metric into the architecture's optimization routine. Zhang et al. (2018) designed a Cost-Sensitive Deep Belief Network that uses the geometric mean of sensitivity and specificity as its primary objective function, preventing the network from defaulting to majority-class predictions. Similarly, Feng et al. employed the geometric mean of class success rates as a fitness function within a nature-inspired metaheuristic optimizer to simultaneously select features and learn misclassification penalties.

Complementary Paradigms

While geometric mean optimization directly targets the product of class accuracies, parallel research directions tackle the problem by modifying boundaries or ranking structures.

For example, Cheng et al. focused on the "margin gap"—the difference in decision boundaries between majority and minority classes—showing that enforcing uneven margins during data augmentation improves generalization. Alternatively, when dealing with black-box models where internal gradients are inaccessible, Zhang et al. (2025) bypassed class-distribution adjustments entirely by reframing prompt tuning as a minimax optimization to maximize the Area Under the Curve (AUC).

Ultimately, whether through margin adjustments, rank-based minimax games, or direct geometric mean optimization, the goal remains the same: forcing machine learning models to respect the minority class by making the neglect of rare events mathematically intolerable.

Key Foundational Work

Online Class Imbalance Learning and its Applications in Fault Detection (2013) — contributed 2 concept elements to this direction.
Optimizing Classifers for Imbalanced Training Sets (1998) — contributed 1 concept elements to this direction.
History & citationVersion 1 · 2026-10-04

Current · Permanent link

View frozen version 1

Cite this direction

Latest version (a living page):

@misc{lacuna_geometric_mean_optimization_c12e18a4,
  title = {geometric mean optimization},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/geometric-mean-optimization/rdr_c12e18a415b3433eb10590887454543b},
  note = {Latest version of a living research direction; cite a version for a fixed text. Accessed 2026-11-24},
}

This exact version (version 1, frozen text):

@misc{lacuna_geometric_mean_optimization_c12e18a4_v1,
  title = {geometric mean optimization},
  author = {{Lacuna}},
  howpublished = {Lacuna research direction},
  year = {2026},
  url = {https://lacuna.tiptreesystems.com/direction/geometric-mean-optimization/rdr_c12e18a415b3433eb10590887454543b/v/1},
  note = {Version 1, frozen 2026-10-04. Accessed 2026-11-24},
}
About

These directions overlap with this one through shared papers.

See something wrong? Report a mistake