概念漂移下针对不平衡数据流的推理时先验自适应
摘要
提出 PAI-KNN,一种通过推理时先验调整而非内存修改来适应概念漂移与类不平衡的 KNN 数据流分类器,在合成数据流基准上取得了与最先进方法竞争的性能。
arXiv:2610.33126v1 Announce Type: new
Abstract: Data stream classification under concept drift and class imbalance requires models to adapt continuously while maintaining strong minority-class performance. Many existing approaches rely on active memory management, in- cluding instance removal, memory restructuring, resampling, and synthetic data generation. We present PAI-KNN, a k-nearest neighbor classifier that adapts via inference-time prior adjustment rather than memory modification. PAI-KNN main- tains a simple sliding-window buffer and dynamically adjusts its decision rule using class prior estimates derived from recent observations. Evaluated on a mul- titude of synthetic data streams covering various imbalance and drift scenarios, PAI-KNN achieves competitive performance with state-of-the-art methods, per- forming particularly well under scenarios involving dynamic class imbalance and concept drift. These findings highlight the potential of inference-time adaptation in challenging non-stationary environments and suggest that adaptation in memory- based stream classifiers need not rely exclusively on memory modification.
查看缓存全文
缓存时间: 2026/10/28 07:23
# Inference-Time Prior Adaptation for Imbalanced Data Streams under Concept Drift
Source: [https://arxiv.org/html/2610.33126](https://arxiv.org/html/2610.33126)
###### Abstract
Data stream classification under concept drift and class imbalance requires models to adapt continuously while maintaining strong minority\-class performance\. Many existing approaches rely on*active memory management*, including instance removal, memory restructuring, resampling, and synthetic data generation\. We presentPAI\-KNN, akk\-nearest neighbor classifier that adapts via inference\-time prior adjustment rather than memory modification\.PAI\-KNNmaintains a simple sliding\-window buffer and dynamically adjusts its decision rule using class prior estimates derived from recent observations\. Evaluated on a multitude of synthetic data streams covering various imbalance and drift scenarios,PAI\-KNNachieves competitive performance with state\-of\-the\-art methods, performing particularly well under scenarios involving dynamic class imbalance and concept drift\. These findings highlight the potential of inference\-time adaptation in challenging non\-stationary environments and suggest that adaptation in memory\-based stream classifiers need not rely exclusively on memory modification\.
###### Keywords:
data stream classification class imbalance concept drift inference\-time adaptation prior adaptation
kk\-nearest neighbors
## 1Introduction
Data stream classification\[[18](https://arxiv.org/html/2610.33126#bib.bib1)\]often requires models to operate under two simultaneous challenges:*concept drift*and*class imbalance*\. As data distributions evolve over time, classifiers must continuously adapt to changing data while maintaining reliable performance on underrepresented classes\. This problem arises in numerous real\-world applications, including fraud detection, network monitoring, and predictive maintenance\. Existing approaches address concept drift and class imbalance in different ways\. Many stream classifiers are*model\-based*, maintaining either a single evolving model\[[10](https://arxiv.org/html/2610.33126#bib.bib3)\],\[[20](https://arxiv.org/html/2610.33126#bib.bib17)\]or a pool of models that are continuously updated, reweighted, or replaced over time\[[5](https://arxiv.org/html/2610.33126#bib.bib15)\],\[[13](https://arxiv.org/html/2610.33126#bib.bib16)\],\[[8](https://arxiv.org/html/2610.33126#bib.bib10)\],\[[21](https://arxiv.org/html/2610.33126#bib.bib11)\], often combined with drift detectors like ADWIN\[[4](https://arxiv.org/html/2610.33126#bib.bib14)\]\.KK\-nearest neighbor \(KNN\) classifiers, in contrast, are*instance\-based or lazy learners*that maintain explicit memories of previously observed instances and perform prediction directly from stored observations\. Several KNN\-based stream classifiers have been proposed that address concept drift and class imbalance through increasingly sophisticated*active memory management mechanisms*\[[14](https://arxiv.org/html/2610.33126#bib.bib12),[1](https://arxiv.org/html/2610.33126#bib.bib6)\]\. Adaptation is typically achieved through instance removal, restructuring, compression, or balancing operations\. While effective, active buffer\-management strategies increase algorithmic complexity and may prematurely alter or discard useful information\. In this paper, we investigate whether adaptation in KNN\-based stream classifiers must occur through memory modification\. We proposePAI\-KNN, akk\-nearest neighbor classifier that maintains a simple sliding\-window memory and adapts through inference\-time prior adjustment\. By shifting adaptation from memory management to inference,PAI\-KNNresponds to changing class distributions without the need for expensive memory management mechanisms\. We evaluatePAI\-KNNon a benchmark of synthetic data streams\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\]covering diverse imbalance and drift scenarios\. Despite its simplicity,PAI\-KNNachieves competitive performance with state\-of\-the\-art methods and performs particularly well under scenarios involving high class imbalance and concept drift\. These findings suggest that inference\-time prior adaptation can provide a simple and effective alternative to complex memory management by avoiding structural assumptions\. The rest of the paper is organized as follows: Section[2](https://arxiv.org/html/2610.33126#S2)introduces the preliminaries and basic concepts\. Related work is discussed in Section[3](https://arxiv.org/html/2610.33126#S3)\. In Section[4](https://arxiv.org/html/2610.33126#S4), we present our proposed methodPAI\-KNN\. The experimental evaluation is detailed in Section[5](https://arxiv.org/html/2610.33126#S5)\. Conclusions and outlook are provided in Section[6](https://arxiv.org/html/2610.33126#S6)\.
## 2Preliminaries and basic concepts
A data stream is a potentially infinite sequence of instancesD=\(x1,…,xt,…\)D=\(x\_\{1\},\\dots,x\_\{t\},\\dots\)wherext∈ℝdx\_\{t\}\\in\\mathbb\{R\}^\{d\}denotes add\-dimensional feature vector arriving at timett\. Under the standard prequential evaluation protocol, an observationxtx\_\{t\}is first classified, producing a predictiony^t\\hat\{y\}\_\{t\}\. The true labelyty\_\{t\}is revealed subsequently and can be used to update the classifier\. Instance\-label pairs\(xt,yt\)\(x\_\{t\},y\_\{t\}\)are assumed to be sampled from evolving data distributionsℙt\(x,y\)\\mathbb\{P\}\_\{t\}\(x,y\)\. Concept drift\[[7](https://arxiv.org/html/2610.33126#bib.bib5)\]may hence arise from*class priors*\(ℙt\+1\(y\)≠ℙt\(y\)\{\\mathbb\{P\}\_\{t\+1\}\(y\)\\neq\\mathbb\{P\}\_\{t\}\(y\)\}\),*likelihoods*\(ℙt\+1\(x\|y\)≠ℙt\(x\|y\)\{\\mathbb\{P\}\_\{t\+1\}\(x\|y\)\\neq\\mathbb\{P\}\_\{t\}\(x\|y\)\}\), or*posteriors*\(ℙt\+1\(y\|x\)≠ℙt\(y\|x\)\{\\mathbb\{P\}\_\{t\+1\}\(y\|x\)\\neq\\mathbb\{P\}\_\{t\}\(y\|x\)\}\) changing\.
For classification problems, the*imbalance ratio*𝐼𝑅\\mathit\{IR\}quantifies the class\-prior distribution and is defined as the \(potentially infinite\) ratio of majority to minority class frequencies over a set of instance labels \(in case of multi\-class problems, ratio of largest to smallest class\)\. Consequently, changes in class priors are directly reflected in changes in the imbalance ratio\. SincePAI\-KNNadapts through dynamic prior adjustment, such changes are of particular interest in this work\. In many real\-world streams, class frequencies do not only exhibit strong imbalance but may also change over time, resulting in*dynamic imbalance ratios*\. Depending on the speed of change, such shifts may occur either*suddenly*or*gradually*\. Due to the potentially infinite nature of data streams and processing speed requirements, memory\-based classifiers typically maintain only a bounded subset of previously observed instances \(also known as*buffer*\)\.
## 3Related work
We divide related work into three parts: classifiers for imbalanced data streams \(Section[3\.1](https://arxiv.org/html/2610.33126#S3.SS1)\), KNN classifiers for data streams \(Section[3\.2](https://arxiv.org/html/2610.33126#S3.SS2)\) and KNN classifiers for imbalanced static data \(Section[3\.3](https://arxiv.org/html/2610.33126#S3.SS3)\)\.
### 3\.1Imbalanced stream classifiers
Tree\-based methods and their ensembles remain the dominant approach to stream classification\. For imbalanced streams, numerous methods have been proposed that combine drift detection and adaptation with resampling, cost\-sensitive learning, or imbalance\-aware ensemble construction\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\]\. For the purpose of this work, the distinction between inference\-based interventions \(adjustments to the prediction rule\) and data\-based interventions \(modifications of the data presented to the learner\) is particularly important\.
We therefore restrict our comparison for such methods to two representative state\-of\-the\-art methods selected due to their performance\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\]:*Cost\-sensitive Adaptive Random Forest*\(CSARF\)\[[13](https://arxiv.org/html/2610.33126#bib.bib16)\]introduces a cost matrix to tackle imbalanced performance using adaptive random forests at inference time\.*Synthetic Minority Oversampling Technique with Online Bagging*\(SMOTE\-OB\)\[[3](https://arxiv.org/html/2610.33126#bib.bib13)\]is the best\-performing method among methods heavily influenced by the SMOTE\[[6](https://arxiv.org/html/2610.33126#bib.bib8)\]algorithm, generating synthetic data on subsets of features, which are then used to continually update an ensemble of tree learners\.
### 3\.2KNN\-based stream classifiers
Self\-Adjusting Memory KNN \(SAM\-KNN\)\[[14](https://arxiv.org/html/2610.33126#bib.bib12)\]addresses concept drift through active memory management\. The method maintains a short\-term memory \(STM\) containing recent observations and a long\-term memory \(LTM\) storing compressed historical information\. As the stream evolves, SAM\-KNN continuously restructures these memories based on the label consistency of stored instances with recent observations\. Following drift detection, instances that remain consistent with the STM are retained, whereas inconsistent instances may be permanently removed\. Adaptation is therefore achieved through active modifications of the stored memory\.
Drift\-Aware Multi\-Memory Model \(DAM3\)\[[1](https://arxiv.org/html/2610.33126#bib.bib6)\]extends SAM\-KNN to handle class\-imbalanced streams\. To improve minority\-class performance, DAM3 introduces a third Working Memory \(WM\) and explicitly maintains a balanced class representation while identifying and removing class inconsistencies in the stored data\. As in SAM\-KNN, adaptation is achieved through active management of the underlying memories\.
Both approaches achieve adaptation through active buffer management, i\.e\., modifications of the stored memories\. SAM\-KNN and DAM3 continuously inspect, restructure, and curate stored instances to maintain memory consistency and adapt to changing stream characteristics\. While effective, such mechanisms require ongoing memory interventions and may permanently alter or discard information based on potentially uncertain evidence of change\. This is particularly consequential in evolving streams, where instances initially regarded as outliers or noise may later prove representative of a changing class distribution or decision boundary\[[15](https://arxiv.org/html/2610.33126#bib.bib2)\]\. Prematurely discarding them may therefore remove valuable evidence of concept evolution\.
As our proposed adjustment is independent of the metric, we consider metric\-learning approaches\[[12](https://arxiv.org/html/2610.33126#bib.bib19),[19](https://arxiv.org/html/2610.33126#bib.bib20)\]and extensions as orthogonal to this work’s focus point\.
### 3\.3Static inference\-time prior\-adjusted KNN
An inference\-time prior\-adjusted KNN for static imbalanced learning was proposed in\[[9](https://arxiv.org/html/2610.33126#bib.bib7)\]\. The method adjusts the decision rule rather than the data to compensate for class imbalance and achieves performance comparable to data\-level interventions such as SMOTE\[[6](https://arxiv.org/html/2610.33126#bib.bib8)\]at a substantially lower computational cost\.
In this formulation, KNN classification is viewed as a maximum\-a\-posteriori \(MAP\) estimator, where the class priorsℙ\(yi\)=Ni/N\\mathbb\{P\}\(y\_\{i\}\)=N\_\{i\}/Nare estimated from the data and the likelihood is approximated byℙ\(x\|yi\)=niNiV\(x\)\\mathbb\{P\}\(x\|y\_\{i\}\)=\\frac\{n\_\{i\}\}\{N\_\{i\}\}V\(x\)\. Herenin\_\{i\}is the number of instances of classyiy\_\{i\}among thekknearest neighbors of an instancexx,NiN\_\{i\}is the total number of instances of classyiy\_\{i\}in the dataset,NNis the total number of instances,mmwill denote the number of classes, andV\(x\)V\(x\)is the volume of the neighborhood\.
Under mild assumptions, and using Bayes’ theorem, the posterior can then be written as:
ℙ\(yi∣x\)∝niNiV\(x\)NiN∑j=1mnjNjV\(x\)NjN=ni∑j=1mnj=nik\\mathbb\{P\}\(y\_\{i\}\\mid x\)\\propto\\frac\{\\frac\{n\_\{i\}\}\{N\_\{i\}\}V\(x\)\\frac\{N\_\{i\}\}\{N\}\}\{\\sum\_\{j=1\}^\{m\}\\frac\{n\_\{j\}\}\{N\_\{j\}\}V\(x\)\\frac\{N\_\{j\}\}\{N\}\}=\\frac\{n\_\{i\}\}\{\\sum\_\{j=1\}^\{m\}n\_\{j\}\}=\\frac\{n\_\{i\}\}\{k\}\(1\)
To improve performance on underrepresented classes, the prior estimate is substituted by a uniform prior:ℙ\(yi\)=1m\\mathbb\{P\}\(y\_\{i\}\)=\\frac\{1\}\{m\}\. The new decision rule then becomes:y^=argmax\{j=1,…,m\}njNj\\hat\{y\}=\\arg\\max\_\{\\\{j=1,\\dots,m\\\}\}\\frac\{n\_\{j\}\}\{N\_\{j\}\}\.
In this work, we extend such inference\-time prior adjustment from static imbalanced learning to non\-stationary data streams with evolving class priors\.
## 4PAI\-KNN: Inference\-Time Prior Adaptation KNN
Motivated by the promising results of the prior\-adjusted static KNN\[[9](https://arxiv.org/html/2610.33126#bib.bib7)\]for static imbalance learning and by the prevalence of increasingly sophisticated active memory management mechanisms in KNN\-based stream classifiers, we investigate whether adaptation can be achieved through inference\-time prior adjustment rather than active memory management\. To this end, we extend the concept of inference\-time prior adjustment to non\-stationary data streams\.
An overview of the proposed approach is shown in Fig\.[1](https://arxiv.org/html/2610.33126#S4.F1)\. Relative to a vanilla KNN classifier,PAI\-KNNaugments prediction with a prior\-adjustment mechanism that adapts the decision rule to changing class distributions over time\. Section[4\.1](https://arxiv.org/html/2610.33126#S4.SS1)introduces the model components, followed by the update and inference steps in Section[4\.2](https://arxiv.org/html/2610.33126#S4.SS2)\. Computational complexity is discussed in Section[4\.3](https://arxiv.org/html/2610.33126#S4.SS3)\.

\\Description
Schematic Model Overview presenting PAI\-KNN
Figure 1:Model components \(B\),\(P\),\(C\)\. Target labels are received after prediction### 4\.1Model definition
PAI\-KNNaugments a standard sliding\-window KNN classifier with a prior\-adjustment module that estimates class priors from recent observations and incorporates them into the prediction rule\. Concretely,PAI\-KNNconsists of three components explained hereafter:
- •abufferBBof sizeNN
- •aprior\-adjustment modulePP, which estimates class priors from recent stream history
- •aKNN classifierCC, which combines neighborhood information with the estimated priors during inference\.
BufferBB:The bufferBBis implemented as a FIFO queue and stores recent observations from the stream\.
Prior\-adjusterPP:The prior\-adjustment modulePPestimates the current class prior distribution from recent stream observations\. To do so,PAI\-KNNmaintains multiple sliding windows of different sizes\. The multiple windows allow the classifier to adaptively select the longest statistically consistent history for prior estimation, thereby limiting responsiveness to statistically significant changes\. Class prior estimates are then obtained from the label frequencies within the selected window and incorporated into the prediction rule\.
Concretely, we useLLsliding windowsS1,…,SLS\_\{1\},\\dots,S\_\{L\}that store the latest2lmin,⋯,2lmax2^\{l\_\{\\min\}\},\\cdots,2^\{l\_\{\\max\}\}labels, which can be effectively implemented using the existing buffer queue\. The largest window is chosen to match the buffer size, i\.e\.,lmax=log2\(\|B\|\)l\_\{\\max\}=\\log\_\{2\}\(\|B\|\), andlmin≥5l\_\{\\min\}\\geq 5is recommended for efficient hypothesis testing\. At timett, the sliding windows are given by
Sk\(t\)=\{yi∣t−i≤2lmin\+k−1,i≥1\}S\_\{k\}\(t\)=\\\{y\_\{i\}\\mid t\-i\\leq 2^\{l\_\{\\min\}\+k\-1\},i\\geq 1\\\}\(2\)
The module further maintains a*significance threshold*ppused to compare label distributions across windows\. During inference, aχ2\\chi^\{2\}test is used to assess whether two windows are plausibly generated from the same distribution\.
The KNN classifierCC:The KNN classifierCCoperates on the bufferBBand is associated with the typical KNN hyperparameters: the number of neighborskkand the distance functiond\(ℝd×ℝd\)→ℝ\+d\(\\mathbb\{R\}^\{d\}\\times\\mathbb\{R\}^\{d\}\)\\rightarrow\\mathbb\{R\}^\{\+\}\. In addition,CCincludes a parameterθ∈\[0,1\]\\theta\\in\[0,1\], interpolating between uniform priors and the observed class priors\. This interpolation provides a direct trade\-off between overall accuracy and minority\-class performance, withθ=1\\theta=1corresponding to classical KNN andθ=0\\theta=0optimizing for recall on the minority class, as in knn\-BPP\[[9](https://arxiv.org/html/2610.33126#bib.bib7)\]\.
### 4\.2Model update and inference
Update step:it only consists of queue insertions of\(x,y\)\(x,y\)into the bufferBB, and an insertion of the labelyyinto the sliding windowsSjS\_\{j\}\.
Inference step:For an instancexx, the classifierCCdetermines for every classyj∈Yy\_\{j\}\\in Ythe number of instancesnjn\_\{j\}among thekknearest neighbors ofxx\. The prior\-adjustment modulePPselects the longest statistically consistent history and uses the corresponding label frequencies to estimate the current class priors\. In particular,PPprovides for every class the number of samplesNj=\|\{y=yj∣y∈S∗\}\|N\_\{j\}=\|\\\{y=y\_\{j\}\\mid y\\in S^\{\*\}\\\}\|in the longest consistent sliding windowS∗=Sk∗S^\{\*\}=S\_\{k^\{\*\}\}, where
k∗=min\(\{1≤k<L∣χ2\(Sk,Sk\+1∖Sk\)<p\}∪\{L\}\)k^\{\*\}=\\min\\left\(\\\{1\\leq k<L\\mid\\chi^\{2\}\(S\_\{k\},S\_\{k\+1\}\\setminus S\_\{k\}\)<p\\\}\\cup\\\{L\\\}\\right\)\(3\)With allnjn\_\{j\}andNjN\_\{j\}determined that way,CCadjusts the prior usingθ\\thetato effectively choose the sensitivity to imbalance and calculates the following posterior:
p\(yi∣x\)=niNi\(θNiN\+\(1−θ\)1m\)∑j=1\|Y\|njNj\(θNjN\+\(1−θ\)1m\)p\(y\_\{i\}\\mid x\)=\\frac\{\\frac\{n\_\{i\}\}\{N\_\{i\}\}\\left\(\\theta\\frac\{N\_\{i\}\}\{N\}\+\(1\-\\theta\)\\frac\{1\}\{m\}\\right\)\}\{\\sum\_\{j=1\}^\{\|Y\|\}\\frac\{n\_\{j\}\}\{N\_\{j\}\}\\left\(\\theta\\frac\{N\_\{j\}\}\{N\}\+\(1\-\\theta\)\\frac\{1\}\{m\}\\right\)\}\(4\)The class label ofxxis the one that maximizes the posterior\.
### 4\.3Computational Complexity
The time complexity of the*update step*is effectively negligible as only a queue insertion takes place\. Time complexity in the*inference step*is dominated by the neighborhood search and hence worst\-case complexity naively scales with𝒪\(Nd2\)\\mathcal\{O\}\(Nd^\{2\}\), whereNNis the buffer size andddis the feature space dimensionality\.
Compared to active buffer management methods, worst\-case complexity is therefore significantly faster\. For example, SAM\-KNN scales slightly worse than𝒪\(N2d2\)\\mathcal\{O\}\(N^\{2\}d^\{2\}\)\[[14](https://arxiv.org/html/2610.33126#bib.bib12)\]\. The space complexity of our method scales with𝒪\(Nd\)\\mathcal\{O\}\(Nd\)\.
## 5Experiments
We evaluate PAI\-KNN on a benchmark of synthetic data streams against state\-of\-the\-art competitors\. Section[5\.1](https://arxiv.org/html/2610.33126#S5.SS1)describes the evaluation design, datasets, competitors, metrics, and experimental protocol before presenting comparative results \(Section[5\.2](https://arxiv.org/html/2610.33126#S5.SS2)\) and a parameter analysis \(Section[5\.3](https://arxiv.org/html/2610.33126#S5.SS3)\) with respect to the prior\-adjustment trade\-off parameterθ\\theta, and the neighborhood sizekk\.
### 5\.1Evaluation design
Datasets:
We adopt the synthetic stream benchmark\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\]\. Streams consist of 200\.000 instances, and are generated using multiple random generators to evaluate methods across different feature spaces\. We restrict analysis to \(five\) binary generators producing only numerical features to avoid the need to craft distance functions on categorical features\. Benchmark scenarios fall into four categories: i\) static imbalance ratio, ii\) dynamic imbalance ratio, iii\) instance\-level difficulties, and iv\) concept drift\.
Competitors:We compare our approach to the competitor methods discussed in Section[3](https://arxiv.org/html/2610.33126#S3): CSARF\[[13](https://arxiv.org/html/2610.33126#bib.bib16)\], SMOTE\-OB\[[3](https://arxiv.org/html/2610.33126#bib.bib13)\], and SAM\-KNN\[[14](https://arxiv.org/html/2610.33126#bib.bib12)\]\. For DAM3 \(\[[1](https://arxiv.org/html/2610.33126#bib.bib6)\]\), the available online implementations struggled with long stream sizes\. For CSARF and SMOTE\-OB, we use results and hyperparameters from a recent survey\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\], where they are set according to their self\-reported standard configuration\. For SAM\-KNN, experiments were performed using the reference implementation in\[[17](https://arxiv.org/html/2610.33126#bib.bib18)\]\. To validly compare against our own method, buffer size was set to 1024\.111H\-params SAM\-KNN:k=5k=5,N=1024N=1024, ltm\_size=0\.4=0\.4, min\_stm\_size=50=50, weighting==uniform, use\_ltm==True, stm\_size\_option==maxACCApproxFor PAI\-KNN, we choseN=1024N=1024, sliding windows in the prior adjuster ranging from size6464to10241024,p=0\.01p=0\.01as a statistical significance threshold andk=20k=20\.θ=0\\theta=0was chosen, thereby prioritizing G\-Mean performance\. Although the choice of distance function can have an important impact, it is orthogonal to this work\. We therefore use theL2L\_\{2\}norm throughout to avoid confounding the effects of the prior intervention with those of the chosen metric\.
Evaluation Setup:We run all experiments using River\[[16](https://arxiv.org/html/2610.33126#bib.bib4)\], with data streams generated using the code of\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\]\. In line with their work\[[2](https://arxiv.org/html/2610.33126#bib.bib9)\], we report the median obtained from running methods on 5 streams generated with different random seeds\. Evaluation metrics for each run are calculated by taking the arithmetic mean over sliding windows of size 500\. We aggregate metrics over groups of different synthetic streams, using the arithmetic mean\. Code is available222[https://github\.com/tcallies/streamKNN](https://github.com/tcallies/streamKNN)\.
Evaluation Metrics:Performance is evaluated using Accuracy, Cohen’s Kappa, and G\-Mean\. Accuracy measures overall correctness, Kappa accounts for chance agreement, and G\-Mean emphasizes balanced performance across classes\. We do not report detailed computational costs as these are very platform and implementation dependent\[[11](https://arxiv.org/html/2610.33126#bib.bib21)\]\. To give some reference nonetheless, our not\-optimized Python implementation ofPAI\-KNNprocesses approximately 1000 instances in two seconds, depending on the dimensionality of the feature space\.
### 5\.2Predictive performance
To better understand the behavior ofPAI\-KNNunder changing imbalance ratios, we plot in Fig\.[2](https://arxiv.org/html/2610.33126#S5.F2)the performance for PAI\-KNN, SAM\-KNN, and a baseline KNN method \(operating on a FIFO buffer without any prior adjustment, withk=20k=20,N=1024N=1024\) for a concrete scenario in which the imbalance ratio reverses twice over time \(*reflipping*\)\. We see that SAM\-KNN’s imbalanced performance deteriorates notably more quickly than the baseline KNN method for high imbalance ratios\. On the other hand, PAI\-KNN maintains a high G\-Mean level throughout even significant gradual changes\. We interpret this as follows: maintaining buffer consistency is detrimental if streams change significantly and rapidly enough\.

\\Description
G\-Mean and Accuracy plotted over time over time \- HyperplaneGenerator, gradual reflipping
Figure 2:G\-Mean and Accuracy over time \- HyperplaneGenerator, gradual reflippingThis observation is reflected in the results shown in Fig\.[3](https://arxiv.org/html/2610.33126#S5.F3), where we plot G\-Mean and Accuracy for four different scenarios of imbalance ratio changes, with changes occurring either gradually or suddenly, and results aggregating over streams from different generators\.PAI\-KNNperforms on par with ensemble competitors in terms of G\-Mean, while underperforming in Accuracy\. Sudden changes describe an instantaneous and significant shift in the data generating distribution, which for gradual changes is prolonged through interpolation over several thousands timesteps\.

\\Description
G\-Mean and Accuracy per method for streams with dynamic IR
Figure 3:G\-Mean and Accuracy per method for streams with dynamic IRCSARF, similarly to us, excels in terms of G\-Mean at the sacrifice of Accuracy, showcasing the natural conflict arising from cost\-sensitive adjustments\.
#### Concept Drift
We limit analysis to streams with both gradual and sudden feature space concept drift, for different, static imbalance ratios\. We plot in Fig\.[4](https://arxiv.org/html/2610.33126#S5.F4)performance by drift type and imbalance ratio, and aggregated across generators\. We see that in terms of G\-Mean, we outperform competitors for gradual changes, and high imbalance ratios\. Again, a very clear data\-intrinsic tradeoff can be recognized that is resolved in favor of G\-Mean for PAI\-KNN and CSARF, whereas performance for SAM\-KNN correlates more strongly with SMOTE\-OB\.

\\Description
G\-Mean and Kappa per method for concept drift streams
Figure 4:G\-Mean and Kappa per method for concept drift streams
#### Static Imbalance Ratio
Streams in this category have no intrinsic temporal component; both feature and label distribution remain fixed over time\. Here, the ability to retain and add information over time drives performance, whereas the ability to forget—a focus point ofPAI\-KNN—is irrelevant\. As a result,PAI\-KNNperforms generally worse than competitors, but robust to very high𝐼𝑅\\mathit\{IR\}\(Fig\.[5](https://arxiv.org/html/2610.33126#S5.F5)\)\.

\\Description
G\-Mean and Kappa per method for static streams with varying imbalance ratio
Figure 5:G\-Mean and Kappa per method for static streams with varying𝐼𝑅\\mathit\{IR\}
#### Instance Level Difficulties
Streams with instance level difficulties \(ILD\) incorporate one or multiple challenges to differentiate data: Imbalance ratios changes, class\-specific concept drift, many instances in borderline regions or in rare locations\. For those ILD streams involving concept drift we plot results in Fig\.[6](https://arxiv.org/html/2610.33126#S5.F6)\.
In terms of G\-Mean, we keep up with state of the art competitors in this case despite the generator synthesizing the ILD streams producing distributions not particularly well\-suited to aL2L\_\{2\}distance function\.
We observe that SAM\-KNN performs very well for the scenario involving rare instances\. This is in line with our understanding that the buffer cleaning and management mechanism can perform very well when underlying assumptions are met and retaining information is important\. PAI\-KNN on the other hand performs more evenly across ILD scenarios: due to imposing only weak assumptions, we remain agnostic to different setups\.

\\Description
G\-Mean and Accuracy per method for ILD streams with concept drift
Figure 6:G\-Mean and Accuracy per method for ILD streams with concept drift
### 5\.3Parameter Effect

\\Description
Effects ofθ\\thetaandkkper Experiment Group
Figure 7:Effects ofθ\\thetaandkkper Experiment GroupWe evaluate parameter effects using a subset of 36 streams, grouped by scenario class\.
For the*trade\-off parameterθ\\theta*,θ=1\\theta=1maximizes accuracy, whileθ=0\\theta=0optimizes G\-Mean\. Notably, G\-Mean performance declines only slightly up toθ=0\.4\\theta=0\.4, offering a beneficial tradeoff\. For streams exhibiting instance level difficulties \(ILD\), G\-Mean even slightly improves up toθ=0\.5\\theta=0\.5, which showcases that under the right conditions, significant accuracy gains can be achieved usingPAI\-KNNwithout sacrificing on imbalanced performance\. For the*neighborhood sizekk*, we again fixθ=0\\theta=0\. Low values ofkkshow higher accuracy while G\-Mean benefits from largerkk\. Again, the optimal tradeoff is both dependent on performance preferences and stream characteristics\.
## 6Conclusion
We presentedPAI\-KNN, a KNN\-based stream classifier that introduces inference\-time adaptation for jointly addressing concept drift and class imbalance\. Unlike existing approaches that adapt primarily by modifying stored instances,PAI\-KNNmaintains a simple sliding\-window memory and adapts predictions through dynamic class\-prior adjustment\. Our experimental evaluation demonstrated thatPAI\-KNNachieves competitive performance across a wide range of imbalance and drift scenarios, while performing particularly well under dynamic class imbalance and concept drift\. These results indicate that effective adaptation in KNN\-based stream classification does not require continuous expensive memory operations\.
Instead, shifting adaptation to inference offers a simple and responsive mechanism for handling rapidly changing stream conditions\.
More broadly, our findings suggest that adaptation in memory\-based stream classifiers need not rely exclusively on increasingly sophisticated modifications to stored instances\. The simplicity ofPAI\-KNNallows it to react quickly in highly dynamic settings without permanently altering the stored evidence\. Actively managed memories, by contrast, can improve information retention over longer horizons when the assumptions underlying their management mechanisms hold, but may prematurely modify or discard instances based on uncertain evidence of change\. Memory\-based and inference\-time adaptations should therefore be viewed as complementary design choices, with memory adaptations offering benefits for information preservation over long horizons and inference adaptations better equipped to tackle dynamic imbalance ratio shifts\.
Future work will extend inference\-time adaptation beyond class\-prior adjustment by exploring feature\-aware drift signals, and dynamic neighborhood selection, as well as its integration with memory\-based adaptation\.
#### Disclosure of Interests\.
The authors have no competing interests to declare that are relevant to the content of this article\.
## References
- \[1\]A\. Abolfazli and E\. Ntoutsi\(2020\)Drift\-aware multi\-memory model for imbalanced data streams\.In2020 IEEE International Conference on Big Data \(Big Data\),Vol\.,pp\. 878–885\.External Links:[Document](https://dx.doi.org/10.1109/BigData50022.2020.9378101)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1),[§3\.2](https://arxiv.org/html/2610.33126#S3.SS2.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1)\.
- \[2\]G\. Aguiar, B\. Krawczyk, and A\. Cano\(2024\)A survey on learning from imbalanced data streams: taxonomy, challenges, empirical study, and reproducible experimental framework\.Machine Learning113\(7\),pp\. 4165–4243\.External Links:ISSN 1573\-0565,[Document](https://dx.doi.org/10.1007/s10994-023-06353-6)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1),[§3\.1](https://arxiv.org/html/2610.33126#S3.SS1.p1.1),[§3\.1](https://arxiv.org/html/2610.33126#S3.SS1.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p4.1)\.
- \[3\]A\. Bernardo and E\. D\. Valle\(2021\)SMOTE\-ob: combining smote and online bagging for continuous rebalancing of evolving data streams\.In2021 IEEE International Conference on Big Data \(Big Data\),Vol\.,pp\. 5033–5042\.External Links:[Document](https://dx.doi.org/10.1109/BigData52589.2021.9671609)Cited by:[§3\.1](https://arxiv.org/html/2610.33126#S3.SS1.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1)\.
- \[4\]A\. Bifet and R\. GavaldàLearning from time\-changing data with adaptive windowing\.InProceedings of the 2007 SIAM International Conference on Data Mining \(SDM\),pp\. 443–448\.External Links:[Document](https://dx.doi.org/10.1137/1.9781611972771.42),https://epubs\.siam\.org/doi/pdf/10\.1137/1\.9781611972771\.42Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[5\]A\. Cano and B\. Krawczyk\(2022\)ROSE: robust online self\-adjusting ensemble for continual learning on imbalanced drifting data streams\.Machine Learning111\(7\),pp\. 2561–2599\.External Links:ISSN 1573\-0565,[Document](https://dx.doi.org/10.1007/s10994-022-06168-x)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[6\]N\. V\. Chawla, K\. W\. Bowyer, L\. O\. Hall, and W\. P\. Kegelmeyer\(2002\)SMOTE: Synthetic Minority Over\-sampling Technique\.Journal of Artificial Intelligence Research16,pp\. 321–357\.External Links:ISSN 1076\-9757,[Document](https://dx.doi.org/10.1613/jair.953)Cited by:[§3\.1](https://arxiv.org/html/2610.33126#S3.SS1.p2.1),[§3\.3](https://arxiv.org/html/2610.33126#S3.SS3.p1.1)\.
- \[7\]J\. Gama, I\. Žliobaite, A\. Bifet, M\. Pechenizkiy, and A\. Bouchachia\(2014\)A survey on concept drift adaptation\.ACM Comput\. Surv\.46\(4\)\.External Links:ISSN 0360\-0300,[Link](https://doi.org/10.1145/2523813),[Document](https://dx.doi.org/10.1145/2523813)Cited by:[§2](https://arxiv.org/html/2610.33126#S2.p1.1)\.
- \[8\]H\. M\. Gomes, A\. Bifet, J\. Read, J\. P\. Barddal, F\. Enembreck, B\. Pfharinger, G\. Holmes, and T\. Abdessalem\(2017\)Adaptive random forests for evolving data stream classification\.Machine Learning106\(9\),pp\. 1469–1495\.External Links:ISSN 1573\-0565,[Document](https://dx.doi.org/10.1007/s10994-017-5642-8)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[9\]J\. M\. N\. Gøttcke and A\. Zimek\(2021\)Handling class imbalance in k\-nearest neighbor classification by balancing prior probabilities\.InSimilarity Search and Applications: 14th International Conference, SISAP 2021, Dortmund, Germany, September 29 – October 1, 2021, Proceedings,Berlin, Heidelberg,pp\. 247–261\.External Links:ISBN 978\-3\-030\-89656\-0,[Document](https://dx.doi.org/10.1007/978-3-030-89657-7%5F19)Cited by:[§3\.3](https://arxiv.org/html/2610.33126#S3.SS3.p1.1),[§4\.1](https://arxiv.org/html/2610.33126#S4.SS1.p6.1),[§4](https://arxiv.org/html/2610.33126#S4.p1.1)\.
- \[10\]G\. Hulten, L\. Spencer, and P\. Domingos\(2001\)Mining time\-changing data streams\.InProceedings of the Seventh ACM SIGKDD International Conference on Knowledge Discovery and Data Mining,KDD ’01,New York, NY, USA,pp\. 97–106\.External Links:ISBN 158113391X,[Link](https://doi.org/10.1145/502512.502529),[Document](https://dx.doi.org/10.1145/502512.502529)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[11\]H\. Kriegel, E\. Schubert, and A\. Zimek\(2017\)The \(black\) art of runtime evaluation: are we comparing algorithms or implementations?\.Knowledge and Information Systems52\(2\),pp\. 341–378\.External Links:ISSN 0219\-3116,[Document](https://dx.doi.org/10.1007/s10115-016-1004-2)Cited by:[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p5.1)\.
- \[12\]J\. Kummert, A\. Schulz, and B\. Hammer\(2023\)Metric Learning with Self\-Adjusting Memory for Explaining Feature Drift\.SN Computer Science4\(4\),pp\. 376\.External Links:ISSN 2661\-8907Cited by:[§3\.2](https://arxiv.org/html/2610.33126#S3.SS2.p4.1)\.
- \[13\]L\. Loezer, F\. Enembreck, J\. P\. Barddal, and A\. de Souza Britto\(2020\)Cost\-sensitive learning for imbalanced data streams\.InProceedings of the 35th Annual ACM Symposium on Applied Computing,SAC ’20,New York, NY, USA,pp\. 498–504\.External Links:ISBN 9781450368667,[Document](https://dx.doi.org/10.1145/3341105.3373949)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1),[§3\.1](https://arxiv.org/html/2610.33126#S3.SS1.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1)\.
- \[14\]V\. Losing, B\. Hammer, and H\. Wersing\(2016\)KNN classifier with self adjusting memory for heterogeneous concept drift\.In2016 IEEE 16th International Conference on Data Mining \(ICDM\),Vol\.,pp\. 291–300\.External Links:[Document](https://dx.doi.org/10.1109/ICDM.2016.0040)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1),[§3\.2](https://arxiv.org/html/2610.33126#S3.SS2.p1.1),[§4\.3](https://arxiv.org/html/2610.33126#S4.SS3.p2.1),[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1)\.
- \[15\]M\. Masud, J\. Gao, L\. Khan, J\. Han, and B\. M\. Thuraisingham\(2011\)Classification and novel class detection in concept\-drifting data streams under time constraints\.IEEE Transactions on Knowledge and Data Engineering23\(6\),pp\. 859–874\.External Links:[Document](https://dx.doi.org/10.1109/TKDE.2010.61)Cited by:[§3\.2](https://arxiv.org/html/2610.33126#S3.SS2.p3.1)\.
- \[16\]J\. Montiel, M\. Halford, S\. M\. Mastelini, G\. Bolmier, R\. Sourty, R\. Vaysse, A\. Zouitine, H\. M\. Gomes, J\. Read, T\. Abdessalem, and A\. Bifet\(2021\)River: machine learning for streaming data in python\.J\. Mach\. Learn\. Res\.22\(1\)\.External Links:ISSN 1532\-4435Cited by:[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p4.1)\.
- \[17\]J\. Montiel, J\. Read, A\. Bifet, and T\. Abdessalem\(2018\)Scikit\-multiflow: a multi\-output streaming framework\.Journal of Machine Learning Research19\(72\),pp\. 1–5\.Cited by:[§5\.1](https://arxiv.org/html/2610.33126#S5.SS1.p3.1)\.
- \[18\]J\. Read and I\. Zliobaite\(2025\)Supervised learning from data streams: an overview and update\.ACM Comput\. Surv\.57\(12\)\.External Links:ISSN 0360\-0300,[Document](https://dx.doi.org/10.1145/3737279)Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[19\]J\. L\. Rivero Perez, B\. Ribeiro, and C\. M\. Perez\(2016\)Mahalanobis distance metric learning algorithm for instance\-based data stream classification\.In2016 International Joint Conference on Neural Networks \(IJCNN\),Vol\.,pp\. 1857–1862\.External Links:[Document](https://dx.doi.org/10.1109/IJCNN.2016.7727425)Cited by:[§3\.2](https://arxiv.org/html/2610.33126#S3.SS2.p4.1)\.
- \[20\]S\. Wagner, M\. Zimmermann, E\. Ntoutsi, and M\. Spiliopoulou\(2015\)Ageing\-based multinomial naive bayes classifiers over opinionated data streams\.InMachine Learning and Knowledge Discovery in Databases: European Conference, ECML PKDD 2015, Porto, Portugal, September 7\-11, 2015, Proceedings, Part I 15,pp\. 401–416\.Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.
- \[21\]S\. Wang, L\. L\. Minku, and X\. Yao\(2016\)Dealing with multiple classes in online class imbalance learning\.InProceedings of the Twenty\-Fifth International Joint Conference on Artificial Intelligence,IJCAI’16,New York, New York, USA,pp\. 2118–2124\.External Links:ISBN 978\-1\-57735\-770\-4Cited by:[§1](https://arxiv.org/html/2610.33126#S1.p1.1)\.相似文章
NOMADD:适应数据漂移的模型数值优化
本文介绍了NOMADD,一种事后方法,通过在标记周期上拟合基础模型并外推压缩后的参数变化,来减少表格模型中的概念漂移。它以极低的训练和推理成本,实现了与Drift-Resilient TabPFN相当的性能。
CADENCE:一种用于快速准确时间序列分类的置信度自适应双专家网络
CADENCE 提出了一种置信度自适应的双专家网络,旨在实现快速且准确的时间序列分类,是一篇发表在 arXiv 上的学术预印本。
学习偏差:机器学习增强的粒子滤波器
本文介绍神经最优粒子滤波器(NOPFs),它通过学习摊销提议分布来提高顺序推断任务中的样本效率和分布准确性,并利用数据驱动方法增强经典粒子滤波器。
用于模型校准的摊销局部后验推断及其在海洋湍流闭合模型中的应用
提出了一种基于条件归一化流的摊销变分推断方法,构建加权似然的局部后验来处理模型校准中的模型偏差与上下文不确定性,并在Branin-Hoo孪生实验及单柱海洋模型的k-ε湍流闭合校准中验证了其相较于全局后验的误差降低效果。
KITE:一种用于时间序列事件预测的知识注入式时序编码器
KITE 提出一种知识注入的时间序列编码器,将工程师的领域先验(语义先验)通过可切换的协变量与注意力偏置机制注入自监督事件预测器,在稀有事件预测上显著优于无先验基线,并支持跨域迁移。