Queue-Based Resampling for Online Class Imbalance Learning

Kleanthis Malialis, Christos G. Panayiotou, Marios M. Polycarpou

Introduction

In real-world monitoring systems—such as power grids or cybersecurity networks—"normal" behavior is the rule, and "faults" or "attacks" are the rare exceptions. This creates a significant class imbalance problem: if 99.9% of the data is "normal," a model can achieve 99.9% accuracy simply by predicting "normal" every time, failing to detect the critical 0.1% of events. This challenge is amplified in online learning environments where data arrives in a continuous stream and must be processed immediately, often amidst "concept drift" where the underlying data distribution shifts over time.

This paper introduces a simple yet effective "queue-based resampling" algorithm designed to maintain a balanced training set in these dynamic, imbalanced streams.

Methodology: Queue-Based Resampling

The proposed algorithm, denoted as $Queue_L$, maintains separate, fixed-length buffers for each class to ensure the model is exposed to a balanced representation of the data.

The Dual Queue Mechanism

The core idea involves two primary components:

  1. Dual Queues: Instead of a single sliding window, the algorithm maintains two separate queues of length $L$: $q_n^t$ for the negative (majority) class and $q_p^t$ for the positive (minority) class.
  2. Selective Memory: As new examples arrive, they are added to their respective class queue. If a queue reaches its capacity $L$, the oldest example in that specific queue is discarded.
  3. Balanced Training: At every time step $t$, the model is trained on the union of both queues.
Mechanism of queue-based resampling over time steps.

This approach acts as a form of "temporal oversampling." Because the minority class queue retains older examples while the majority class queue refreshes rapidly, the model consistently sees a more balanced representation than what is present in the raw data stream. This method avoids the need for pre-defined error weights required by cost-sensitive learning and is computationally lighter than ensemble methods like Online Bagging.

Experimental Setup

The study evaluates the $Queue_L$ method using synthetic benchmarks designed to test non-linear decision boundaries: the Sine Dataset and the Circle Dataset. These datasets were modified to simulate various imbalance rates (e.g., 10% or 1% minority class) and abrupt concept drifts, such as scenarios where minority and majority classes suddenly swap roles.

Key Insights and Results

The performance of the queue-based approach is primarily measured using G-mean, a metric that balances accuracy across both rare and frequent classes.

The Impact of Queue Length ($L$)

The queue length $L$ is a critical hyperparameter. A small $L$ (e.g., $Queue_1$) allows the model to react quickly to changes but may result in lower steady-state performance. Conversely, a larger $L$ (e.g., $Queue_{50}$) provides better long-term accuracy but suffers from a "late start" as the buffers take longer to fill.

Comparison with State-of-the-Art Methods

The proposed $Queue_{25}$ method consistently outperformed $OOB_{sg}$ (a state-of-the-art oversampling-based online bagging method) and other baselines.

Performance comparison (G-mean) across different imbalance ratios.

As shown in the results, in scenarios with severe imbalance (e.g., $p(y=1) = 0.01$), baseline models often fail to learn for thousands of steps. In contrast, $Queue_{25}$ achieves high performance relatively quickly. Furthermore, the queue system adapts naturally to drift; if the minority class suddenly becomes frequent, its queue refreshes faster, allowing the model to adjust without manual intervention.

Conclusion and Future Work

Queue-based resampling provides a robust and computationally efficient solution for online class imbalance. By reframing "memory" as a tool for oversampling, it achieves superior performance compared to complex ensemble methods and shows high resilience to concept drift.

While the current study focuses on synthetic datasets with abrupt drift, future research will explore the effectiveness of fixed-length queues against gradual concept drift and in environments with noisy labels or delayed feedback.

Summary updated

BibTeX
@inproceedings{malialis2018queue,
  author = {Kleanthis Malialis and Christos G. Panayiotou and Marios M. Polycarpou},
  title = {{Queue-Based Resampling for Online Class Imbalance Learning}},
  booktitle = {Icann},
  year = {2018},
  doi = {10.1007/978-3-030-01418-6\_49},
}
Figure