## 2 Preliminaries and Background
### AICrit  
AICrit [2] is designed to provide real-time process monitoring for ICS with the goal of preserving control behavior integrity. It utilizes a combination of artificial intelligence and design knowledge to learn the normal spatio-temporal relationships among correlated components. AICrit is composed of two main modules: AiBox and RuleBox. AiBox uses deep learning algorithms such as deep Multi-Layer Perceptron (MLP) and Long-Term Short Memory (LSTM) neural networks, to model sensor behavior. Similarly, RuleBox utilizes a decision tree algorithm to generate rules associated with relationships among sensors and actuators. By combining the models and rules generated by these modules, the functional dependencies of sensors and actuators are continuously monitored to detect and report anomalies in the ICS. The operation of AiBox in modeling the behavior of the water level sensor LIT101 in SWaT, shown in Figure 1, can be demonstrated using the following strategies. 1. PbNN (Physics-based Neural Network) approach [5]: This method employs a physics-based deep learning algorithm to model the behavior of LIT101. It considers the spatiotemporal relationships between the interdependent components of LIT101, i.e., FIT101 and FIT201, as a non-linear function \(f_{pbNN}()\) formulated as follows, \[x_{1}(t+1)=f_{pbNN}(x_{1}(t),x_{2}(t),x_{3}(t))\] (1) where \(x_{1}(t),x_{2}(t)\), and \(x_{3}(t)\) denote measurements from the sensors LIT101, FIT101 and FIT201, respectively, at time \(t\). With the availability of historical data, a physical model can be built using Equation (1) to predict \(x_{1}(t+1)\) with minimal error. 2. NN (Neural network) approach [6]: This method considers the prediction of LIT101 as a time series forecasting problem. The LSTM is utilized to learn and model the temporal dependencies represented as \(f_{NN}()\) present in the historical readings of LIT101. \[x_{1}(t+1) = f_{NN}(x_{1}(t),x_{1}(t-1),..,\] \[x_{1}(t-i),..,x_{1}(t-n))\ \forall i\in[1,n]\]  
The resulting model is then deployed to predict LIT101. In both the approaches, fine-tuning the hyper-parameters of the deep learning algorithms was carried out during the training process with constraints aimed at minimizing the prediction error as in Equation (3)  
\[minimize\ \epsilon=\frac{1}{n}\sum_{i=1}^{n}(x_{1}(t)-\hat{x_{1}}(t))^{2};w.r.t. \ H_{p} \tag{3}\]  
where \(n\) is the number of samples and \(H_{p}\) the set of hyperparameters. In this work, we adopt the scikit-optimize ([[https://scikit-optimize.github.io/stable/](https://scikit-optimize.github.io/stable/)]([https://scikit-optimize.github.io/stable/](https://scikit-optimize.github.io/stable/)), accessed on 29 November 2023) algorithm to automate the process of selecting the best hyperparameter values. Once the optimal model has been selected for each sensor, the predicted measurements are compared against the actual data from the plant to discover anomalies. The difference between the actual and predicted values, known as the forecasting error, will always be non-zero. To quantify it effectively, and avoid false positives, we use the Cumulative SUM (CUSUM). The CUSUM approach defines two parameters, namely, the Upper Control Limit (UCL) (Equation (5)) and Lower Control Limit (LCL) (Equation (7)), to determine the acceptable levels of positive and negative deviation in the forecasting error. \[P(t)=Max(0,r(t)-\tau-b)\forall t,1\leq t\leq T \tag{4}\]  
\[UCL=Max(P(t)) \tag{5}\]  
\[N(t)=Min(0,r(t)-\tau+b)\forall t,1\leq t\leq T \tag{6}\]  
\[LCL=Min(P(t)) \tag{7}\]  
where, \(P(t)\) and \(N(t)\) are, respectively, the allowable positive and negative side deviations. \(\tau\) represents the safety limit and \(b\) corresponds to the allowable slack. During the anomaly detection phase, \(P(t)>UCL\) or \(N(t)<LCL\) indicates an anomaly.