# Concept Drift Detection Based on Deep Neural Networks and Autoencoders
## 3 Methodology
### Concept Drift Detection  
The detection process is depicted in Figure 5, with the corresponding algorithm detailed in Algorithm 4. In this work, we utilize an autoencoder (Model3) combined with the 3\(\sigma\) principle for anomaly detection in streaming data. The 3\(\sigma\) principle assumes that the data follow a normal distribution, where \(\mu\) represents the mean and \(\sigma\) denotes the standard deviation. According to this principle, the probability of a value falling within the range \((\mu-3\sigma,\mu+3\sigma)\) is 0.9974. Consequently, values outside this range are considered anomalous and classified as drift data.We conducted experiments on the selection of different drift thresholds, with detailed results provided in Appendix A. During the drift detection phase, the 3\(\sigma\) criterion serves as the threshold for identifying anomalies. Given the assumption of normality, over 99.7% of the data points should fall within this range, with outliers beyond it being flagged as anomalous.The autoencoder functions similarly to a sliding window when filtering the data. However, unlike traditional sliding windows, the autoencoder is more sensitive to changes in the underlying data distribution and does not require predefined window sizes or step lengths. Its role is analogous to that of a one-class classifier: by training the autoencoder on data from the old concept distribution, it learns to reconstruct data conforming to that distribution. Data from a new concept distribution, which the autoencoder has not encountered before, are more difficult to reconstruct, leading to reconstruction errors that differ from those of the old data. Concept drift is detected by analyzing the reconstruction errors of the streaming data, in conjunction with the 3\(\sigma\) principle. Using the last-layer hidden outputs, \(a^{(L)}\), of Model1 for the last 5000 samples (indicated as red neurons in the yellow box), Model3 is initialized (see Algorithm 4, lines 2-8). The reconstruction errors, \(e_{a}\), for the training data are then computed, along with the mean, \(\mu\), and standard deviation, \(\sigma\), of all reconstruction errors. The upper and lower threshold limits are established based on the 3\(\sigma\) principle. The overall process is illustrated by the red arrows in Figure 5, with the corresponding steps outlined in Algorithm 4 (lines 9-10). The formulas for calculating the mean, \(\mu\), and threshold limits are as follows:  
\[\mu=\sum_{i=1}^{5000}train\_reconstruction\_error/5000 \tag{1}\]  
\[lower\_threshold=\mu-3\sigma \tag{2}\]  
\[upper\_threshold=\mu+3\sigma \tag{3}\]When the final hidden layer output \(o^{(L)}\) (deep pink neuron--green box) from Model2 is received, it is used as test data to compute the reconstruction error \(e_{s}\) (refer to the blue arrow in Figure 5). This error is then compared with the threshold limits derived from the \(3\sigma\) principle. Data points whose errors fall outside the threshold range are classified as drift data (refer to lines 11-16 of Algorithm 4). The reason for selecting the final hidden layer outputs of the model as both training and test data is as follows: Model2, initialized by copying and freezing the connection weights from Model1, is capable of distinguishing between data belonging to old and new concepts. Consequently, the model's performance varies for data associated with different concepts, which is reflected in the model's predictions. Since the weights in the model are influenced by error backpropagation during training, we reason that the output of the final hidden layer, being closest to the model's prediction, will also manifest this distinction. Therefore, in both Model1 and Model2, we collect the outputs of the final hidden layer and use them separately as training and test data.