# An Adaptive Active Learning Method for Multiclass Imbalanced Data Streams with Concept Drift
## 3 The Proposed AdaAL-MID Algorithm
### Uncertainty Strategy Based on Dual-Margin Dynamic Threshold Matrix  
This section introduces the proposed hybrid label request strategy, including uncertainty strategy and random strategy. The uncertainty strategy is driven by a dual-margin dynamic threshold matrix to select instances with high information content from the data stream. The random strategy marks instances from the data stream without selection, ensuring that this subset of instances reflects the class distribution of the data stream. It is noteworthy that most multiclass imbalanced active learning algorithms use a label sliding window to estimate class distribution [13], with the imbalance ratio for each class calculated as shown in Equation (2). Here, \(labelnum_{y}\) represents the count of instances labeled as \(y\) within the sliding window, \(sizedab\) denotes the size of the window, \(numNull\) denotes the number of instances selected by the uncertainty strategy (used as placeholders), and \(C\) is the number of classes. Although this method can approximate the class distribution in the data stream, its accuracy heavily depends on the size of the label sliding window. A window that is too small may lack sufficient instances to represent the distribution, while a window that is too large may include outdated concepts, both of which can affect the accurate estimation of the current class distribution. \[imb_{y}=labelnum_{y}/((sizedab-numNull)/C) \tag{2}\]  
To more accurately estimate the class imbalance state of the data stream, this paper employs a time decay model to simulate class proportion changes. This model persists throughout the entire learning process of the data stream and is updated only by labeled instances selected by the random strategy, ensuring it reflects the true distribution of the data stream. As shown in Equation (3), the initial distribution of each class \(cd[i]\) is set to \(1/C\), \(i=\{1,\dots,C\}\). Here, \(\alpha\in(0,1)\) represents the time decay factor, used to control the rate at which old instances are forgotten. For each new instance selected by the random strategy, all class distributions are updated based on the requested label \(y\), increasing the corresponding \(cd[y]\), while simultaneously decaying the other classes. This strategy can effectively estimate the overall distribution of the data stream and reduce the impact of outdated concepts. Based on this, a new imbalance ratio calculation formula is introduced, as shown in Equation (4), and used in subsequent steps. \[cd[i]=\left\{ \begin{array}{ll}\alpha*cd[i]+(1-\alpha),&\text{if }y=i\\ \alpha*cd[i],&\text{else}\end{array} \right. \tag{3}\]  
\[imb_{y}=cd[y]/((\sum_{i\in C}cd[i])/C) \tag{4}\]  
The proposed label request strategy begins with the random strategy. If the conditions for the random strategy are met, the true labels of instances are requested; otherwise, the uncertainty strategy is employed. In the uncertainty strategy, two measures of predictive uncertainty, namely, minimum marginal uncertainty (\(margin_{min}\)) and maximum marginal uncertainty (\(margin_{max}\)), are combined. \(margin_{min}\) is calculated as the difference between the probability of the most likely class and the probability of the second most likely class, while \(margin_{max}\) is calculated as the difference between the probability of the most likely class and the probability of the least likely class. These measures serve to indicate the certainty or uncertainty of the classifier's prediction for an instance, with a significantly larger probability for the most likely class compared to the second most likely or least likely classes indicating certainty and vice versa. Therefore, active learning selects instances with smaller \(margin_{min}\) or \(margin_{max}\) for requesting and learning. Based on these two measures, dual-margin dynamic threshold matrices \(M_{1}\) and \(M_{2}\) are proposed, both of which are matrices with dimensions of \(C\times C\).