# An Adaptive Active Learning Method for Multiclass Imbalanced Data Streams with Concept Drift
## 3 The Proposed AdaAL-MID Algorithm
### Instance-Adaptive Sampling and Weighted Ensemble Strategy  
The performance of ensemble classifiers is closely related to the distribution of instances and the diversity among base classifiers, especially in multiclass imbalanced data streams with limited label budgets. To address the issue of insufficient labeled instances, it is necessary to oversample labeled instances and increase the learning rate of minority class instances. Additionally, as the classification performance of base classifiers varies within the ensemble, different levels of oversampling should be applied to the same instance, ensuring a higher diversity within the ensemble. The algorithm proposed in this paper learns from multiclass imbalanced data streams under limited label budgets, where the sampling frequency of instances is determined based on class proportions and classification performance. This paper defines classification performance as the real-time recall of base classifiers, which effectively reflects the performance of classifiers in imbalanced data streams. The formula for calculating the recall is shown in Equation (6).  
\[\text{Recall}=\frac{\text{TP}}{\text{TP}+\text{FN}} \tag{6}\]  
Firstly, given a new instance \((x,y)\), the adaptive sampling weights of each base classifier in the ensemble for this instance are as shown in Equation (7), where _budget_ represents the current label budget, \(y\) denotes the class of the current instance, \(\alpha\) is the previously calculated class distribution, \(E\) is the current ensemble, and \(j\) represents the index of the base classifier. By using the instance weight formula inversely proportional to the label budget, the problem of insufficient labeled instances can be effectively addressed. Under different cases, the lower the recall rate, \(Recall_{\text{E}}[j]\), of the classifier, the smaller the class weight, \(cd[y]\), of the instance and the higher the corresponding instance sampling weight, \(SW_{j}\). Therefore, during the training process, difficult classification instances and minority class instances can receive sufficient attention. During the sampling process, the algorithm follows the idea of online bagging and implements online resampling using the Poisson distribution, where \(k\)-_Poisson_ (\(SW_{j}\)) yields the oversampling frequency of each base classifier for the current instance.  
\[SW_{j}=\frac{1}{budget}(1+\frac{Max(Recall_{E})}{Recall_{E}[j]}*\frac{Max( cd)}{cd[y]}) \tag{7}\]  
In the weighted ensemble stage, because of the varying performance of each base classifier in the ensemble, it is necessary to weight the predictions of the base classifiers. This paper uses the combined results of the base classifier recall rate and kappa coefficient for classifier weighting. The kappa coefficient is also a commonly used performance metric in imbalanced data streams, which evaluates classifier performance based on the consistency of predicted results and data statistical distributions. The weight calculation of base classifier \(j\) in the weighted prediction stage is shown in Equation (8). It is noteworthy that the recall rate adopts the single-class recall rate on the current training instance, so the better the classification performance of the base classifier on the class to which the instance belongs, the higher its weight. By comprehensively considering these two metrics, weights can be flexibly allocated among the base classifiers in the ensemble to achieve good classification results.  
\[CW_{j}=\sqrt{Kappa[j]*Recall_{E}^{y}[j]} \tag{8}\]