## 4 Methods
### Connected and Automated Vehicles (CAVs) Data Characteristics and Anomaly Model
The mathematical representation is stated below:

\[y_{k}\left(x,w\right)=h\left(\sum_{j=1}^{H}w_{kj}^{\left(2\right)}g\left(\sum_{i =1}^{D}w_{ji}^{\left(1\right)}x_{i}+w_{j0}^{\left(1\right)}\right)+w_{k0}^{ \left(2\right)}\right), \tag{8}\]

where \(y_{k}\) is taken to be the \(k\)th output of the NN, \(x\) is the vector of the variable \(D\) for the input layer, while \(w\) remains the combination of the adaptive weight parameters \(w_{ji}^{\left(1\right)}\) and \(w_{kj}^{\left(2\right)}\), and the bias \(w_{j0}^{\left(1\right)}\) and \(w_{k0}^{\left(2\right)}\), while \(H\) is the number of units in the hidden layer. From the traditional approach, the variable \(\theta\) from the training samples is estimated by possible minimization of the error function [32; 33]

\[E=E_{D}+E_{W}=\frac{1}{2}\sum_{n=1}^{N}\sum_{k=1}^{N_{0}}\left\{y_{k}\left(x^ {n};w\right)-c_{k}^{n}\right\}^{2}+\frac{\alpha}{2}\sum_{i=1}^{W}\left|w_{i}^ {2}\right|\]

Figure 6: Denoised Multiple anomaly on Speed, \(Ax\) and radius of curvature (\(RoC\)) sensor readings. where \(y_{k}\) denotes the \(k\)th NN output with respect to \(x^{n}\), of the \(n\)th training input data; \(c_{k}^{n}\) remains the \(n\)th target of the output training data, N is the corresponding input and output pairs in the target data set; \(N_{o}\) is denoted as the number of output variables;while \(W\) is the number of parameters in \(w\) and \(\alpha\) is the regularization parameter.The variable \(E_{D}\) and \(E_{\theta}\) remain the error between the data and the approximation with respect to NN and decay regularization. To present the NN model within the Bayesian context, the learning processing is to be interpreted as probabilistic ally. Bayesian phase achieves this probabilistic nature of NN by adding strong distribution and uncertainty on the weights in the network. The uncertainty in the weight of the network model enhances the practical framework in automatic calculation of error associated with the predictions when dealing with data of unknown targets. This also leverages the system to learn from a small amount of evidence [34] when Information sparsity is experienced in a given network. Generally, data need to be pre-processed reduces the complexity. A suitable network architecture is then selected, and the model probability is defined as:

\[p\left(w\mid\mathcal{D},\alpha,\beta,M\right)=\frac{p\left(\mathcal{D}\mid w, \beta,M\right)p\left(\alpha,\beta\mid M\right)}{p\left(\mathcal{D}\mid M \right)} \tag{9}\]

where \(w\) is the adaptive weight parameter,\(\mathcal{D}\) is the data, \(\mathcal{H}\) denotes the Bayesian model class that specifies the form of the likelihood function and the prior probability distribution, and \(\alpha,\beta\) are the regularization parameters. At this stage, network training starts with the optimization of the input and output data by maximising the posterior likelihood of the model specific by \(w\). At the end of the preparation, the degree of understanding and generalisation is considered adequate, the iterative network optimization process is stopped and predictions can be made using the training network. Bayes' Theorem can be extended as seen below to select the appropriate values for the hyper-parameters:

\[p\left(\alpha,\beta\mid\mathcal{D},M\right)=\frac{p\left(\mathcal{D}\mid\alpha,\beta,M\right)p\left(\alpha,\beta\mid M\right)}{p\left(\mathcal{D}\mid M\right)} \tag{10}\]

The hyper-parameters \(\alpha\) and \(\beta\) are assumed to be known. Initial values for \(\alpha\) and \(\beta\) are chosen as seen in Figure 3, and the associated values of \(w\) are obtained by maximising their posterior likelihood. Then, using the following relationship, the hyper-parameters are re-estimated where their MAP values are based on uniform prior values for \(\alpha\) and \(\beta\), and the estimate of these values maximise evidence \(p\left(D\mid\alpha,\beta,\mathcal{H}\right)\) in (10).