## 3 Materials and Methods
### Incremental Online Algorithms  
In the current study, we selected two incremental online classifiers, namely Adaptive Random Forest (ARF) and K-Nearest Neighbors (KNN) [11, 12]. The algorithms are chosen based on their popularity in the online classification area and are freely available in the python framework sickit-multiflow [12]. Adaptive Random Forest (ARF): a modified version of the Random Forest (ARF) method developed to handle data streams. The algorithm includes important extended techniques that modify the way the trees are trained and sampled in order to adapt to streaming data: the online bagging and adaptive resampling techniques. In the standard Random Forest algorithm, each tree is trained on a bootstrap sample of the training data, which is obtained by randomly sampling with replacement from the original data. However, in data streams, new instances arrive continuously, and it is not feasible to store the entire training data in memory. The core idea underlying online bagging is to train a tree in a forest using a sample that is generated by randomly selecting instances from the data stream with replacement. The trees in the forest differ from one another due to the use of several samples, resulting in a varied ensemble. Adaptive resampling is another technique used to adapt to changes in the stream by updating the weight of instances according to their arrival times. Formally, instances that are more recent are given a higher weight, which enables the classifier to adapt to concept drift over time. This technique is used to update the weights of instances in the sample used to build the trees [6, 11]. The pseudo code of the ARF algorithm is given in Algorithm 1. This algorithm begins by initializing a specified number of trees in an ensemble. Each new instance in the data stream is then sent to each tree in the ensemble for testing and training. ARF follows a \"test-then-train\" approach, where an incoming instance is first used to test the model's performance by making a prediction and estimating its accuracy. After testing, the instance is used to train the model. The training process in ARF utilizes online bagging, a technique that randomly selects a subset of features and performs splits based on these features. ```
Inputs: n_trees: the number of trees in the ensemble, STREAM: the stream of data instances, f_s_size: size of the random subset of features to select for each split. Outputs: arf_model: the trained ARF model
1. Initialize an ensemble with a specified number of trees. 2. Receive a stream of data instances. 3. For each new instance in the stream: 1. Test the model's performance by making a prediction. 2. Estimate the model's performance. 3. If the performance is below the test threshold, train the model with the instance. 4. Apply online bagging and select a random subset of features with f_s_size for tree training. 5. Train all background trees on the current instance. 4. Repeat the above steps for all instances in the stream 5. The trained ARF model, which is the ensemble of trees, is the output. ```  
**Algorithm 1**Pseudo Code of Adaptive Random Forest  
K-Nearest Neighbors (KNN): a well-known classification algorithm used in machine learning that relies on the distance metric between data points. In online classification, the algorithm works by maintaining a set of labeled instances in memory, which are used to classify new incoming instances based on their proximity in the feature space. For each incoming data instance x, the algorithm computes the distance between x and each instance in the data stream using a distance metric which is typically the Euclidean distance. Subsequently, the K-Nearest Neighbors of x in D based on their distances are found. The class label of x is assigned based on the majority of its K-Nearest Neighbors. In KNN,K is a hyper parameter that determines the number of nearest neighbors to consider for classification. As new instances are received, the algorithm updates its set of labeled instances and can change its classification decisions accordingly.