## 4 Methodology
### Model Selection for Online Drift Detection and Adaptation  
In our work, we present TWIN-ADAPT, a continuous learning framework for online anomaly classification using digital twins. This framework incorporates advanced machine learning models, optimization and adaptive algorithms to maintain the precision and effectiveness of digital twins in classifying real-time anomalies. It is worth mentioning that each digital twin is a specialized model designed for anomaly classification specific to its respective CPS component of the cleanroom. For instance, the digital twin of the Fumehood classifies anomalies in multivariate data, including temperature, humidity and airflow, which are vital for maintaining stringent cleanroom standards. The digital twin for the Vacuum Pump focuses solely on the temperature data for anomaly classification to capture essential thermal dynamics of the Pump, while the digital twin for the Karl Suss Lithography Unit integrates both temperature and humidity data, crucial for accurate microfabrication process control. Specifically, the TWIN-ADAPT framework integrates the LightGBM model into the digital twin of each CPS component in order to enhance the system's responsiveness and adaptability to dynamic environments. This robust machine learning model, an off-the-shelf gradient boosting decision tree (GBDT) system, is distinguished by its fast training speed, low memory requirements, superior accuracy and parallel processing capabilities. These attributes make LightGBM especially well suited for handling the vast and complex data streams inherent in cleanroom operations, where small fluctuations in equipment activity can significantly influence operational efficiency [14; 48]. LightGBM's unique capabilities stem from its innovative Gradient-based One-Side Sampling (GOSS) and Exclusive Feature Bundling (EFB). GOSS enhances model training efficiency by focusing on data samples with large gradients that are more informative for creating predictive models, thereby reducing the computational burden without compromising model accuracy [49]. Concurrently, EFB optimizes feature handling by bundling mutually exclusive features, significantly reducing the dimensionality of the data, which is crucial for processing the high-dimensional data typically found in cleanroom's cyber-physical system sensors. These features of LightGBM are crucial for maintaining the digital twin's accuracy and reliability over time, enabling it to effectively detect and adapt to concept drift within the data streams. In coupling LightGBM with a dual windowing \begin{table}
\begin{tabular}{l c c c c c c} \hline \hline
**CPS Datasets** & \multicolumn{3}{c}{**Training Data**} & \multicolumn{3}{c}{**Testing Data**} \\ \cline{2-7}  & **Noise Distribution** & **Noise Level (\(\sigma_{N}\))** & **Noise Ratio** & **Noise Ratio** & **Noise Level** (\(\sigma_{N}\))** & **Noise Ratio** \\ \hline Vacuum Pump & Gaussian & 0.1 & 10\% & \begin{tabular}{c} Gaussian and \\ Uniform \\ \end{tabular} & 0.5 & 35\% \\ \hline Lithography Unit & Gaussian & 0.1 & 10\% & \
\begin{tabular}{c} Gaussian and \\ Uniform \\ \end{tabular} & 0.5 & 65\% \\ \hline Fumehood & Gaussian & 0.1 & 10\% &
\begin{tabular}{c} Gaussian and \\ Uniform \\ \end{tabular} & 0.5 & 80\% \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Type of noise distribution, noise level and noise ratio for training and testing datasets. strategy consisting of a sliding window and an adaptive window, the model is equipped to dynamically adjust its parameters in response to changing data distributions. The sliding window monitors the model's performance on recent data, while the adaptive window accumulates new data to update the model when drift is detected. The algorithm operates by comparing the accuracy of the current observation window with that of the previous window. If the accuracy drops below a certain threshold, it indicates potential drift, prompting the system to adapt (see details for Algorithm 1 in Section 5.1).