## 3 The Proposed HSDW-MI Algorithm  
### Training Process of HSDW-MI Algorithm  
In existing data stream classification methods, sampling techniques simply add or remove instances randomly, neglecting the original data distribution and the importance of individual instances. Moreover, the ratio of classes in the data stream may change over time, causing minority and majority classes to transform. Current methods have not extensively studied such variable data streams. Addressing concept drift, variable data streams, and extremely imbalanced data streams simultaneously presents a significant challenge for data stream learning tasks. To address these issues, this paper proposes a hybrid sampling and dynamic weighting based multi-class imbalanced data stream ensemble classification algorithm, HSDW-MI. The HSDW-MI is a block-based ensemble classification method. The framework and symbol definitions of the HSDW algorithm are shown in Figure 2 and Table 1, respectively. In order to solve the above problems, this paper proposed HSDW-MI, an ensemble classification algorithm for multi-class imbalanced data streams based on hybrid sampling and dynamic weighting. HSDW-MI is a chunk-based method, and the procedure of this ensemble algorithm framework for processing data streams is shown in Figure 2. The HSDW-MI algorithm proposed in this paper is divided into hybrid sampling phase and dynamic weighting phase, and the work flow of the algorithm is as follows: \begin{table}
\begin{tabular}{c c} \hline \hline
**Symbols** & **Definitions** \\ \hline \(S\) & Data stream \\ \(D\) & Data chunk \\ \(D^{\prime}\) & Balanced data chunk \\ \(E\) & Ensemble of classifiers \\ \(C_{new}\) & New created classifier \\ \(\theta\) & Update threshold of classifiers \\ \hline \hline \end{tabular}
\end{table} 
Table 1: HSDW-MI symbol definitions. Figure 2: The framework of HSDW-MI algorithm. In training, the data stream is passed in as chunks denoted as an ordered collection of elements \(S=\{D_{1},\ldots,D_{t-1},D_{t}\}\). 3. To begin with, the algorithm enters the hybrid sampling phase, which is responsible for dealing with the imbalances that exist in the incoming data chunk. 2. In the hybrid sampling phase, the number of samples needed to sample each class in the current data chunk is determined by calculating the class ratio of the current chunk. 3. Then, the samples of each class in the data chunk are clustered by adaptive spectral clustering, and a number of samples for each cluster in each class is determined based on the number of samples to be sampled for each class obtained in step (2). 4. After that, the safety factors of all samples in each class are calculated and ranked in descending order. 5. Based on the safety factor of the samples, the samples with a high safety factor in each class are stored in the sample storage pool. If the storage pool is full, the old samples are deleted and new samples are added. 6. Judge whether the current class is a minority class. If not, the samples with low safety factor in each cluster are removed based on the clusters divided into the current class and the number of samples to be sampled in each cluster in step (3). 7. If the current class is minority class, then the number of samples of the current class is further judged whether it is lower than the number of samples to be sampled obtained in step (2). If not, go directly to the oversampling phrase and oversample the samples with high safety factor of the current class based on the clusters divided into the current class and the number of samples to be sampled for each cluster in step (3). 2. Dynamic weighting phase. 1. [label=()]
4. Dynamic weighting phases are responsible for dynamically updating the classifiers in the ensemble to accommodate concept drift. In the dynamic weighting phase, the algorithm trains a classifier Cnew on the balanced data chunk to add to the ensemble. 2. For the classifiers in ensemble E, the algorithm calculates the G-mean value of the classifier on the current data chunk as the weight of each classifier. 3.