## 4 Methods
### Connected and Automated Vehicles (CAVs) Data Characteristics and Anomaly Model
The estimated values of \(\alpha\) and \(\beta\) are represented below:

\[\alpha^{\prime}=\frac{\gamma}{2E_{D}} \tag{11}\]

\[\beta^{\prime}=\frac{N-\gamma}{2E_{D}}\]



The last problem to be discussed when deciding the optimum architecture is the relative value of each input variable is the Automatic Relevance Determination (ARD). Using real-system data, distinguishing the important variables from the redundant ones may be difficult. In the Bayesian framework, the ARD method proposed in Reference [35] can address this problem. By using this method, each input variable is associated with a separate hyper-parameter \(\alpha\) which represents the inverse variance of that input parameter's prior distribution. In this way, each hyper-parameter clearly reflects the importance of an input: a small value implies that a large weight parameter value is permitted and the resulting input is important; on the contrary, a large weight parameter value alpha is allowed and the associated weights parameter is confined to zero, and thus the corresponding input is less relevant [35; 36]. Therefore, the ARD enables inference to be applied in which the \(\alpha\) hyper-parameters are chosen by minimizing evidence for the class of model identified by these hyper-parameters. If the model architecture is established, the importance of each input is assessed. If any hyper-parameters are very high, the relevant input will be removed from the model and the equilibrium design will be re-estimated for the new implementation. Figure 7: Bayesian Hierarchical Framework for Neural Network. The BDL architecture is assumed to comprise of 4 hidden layers, with 20 nodes and 1 bias in the first layer and the rest of the layers have 10 nodes and 1 bias each. To train the BDL mechanism, ReLU activation function is used, coupled with Adam optimizer with default learning rate to minimize the validation binary cross entropy loss. ### The Proposed Method

To improve the detection and identification efficiency of the BDL algorithm, a new framework is proposed (DWT-BDL) based on reliance of DWT and BDL as shown in Figure 8. Prior to feeding the data into the BDL detection algorithm, DWT is added to the BSMs sensory information for denoising (as explained in Section 4.2). In particular, the noisy sensory BSMs data is decomposed by transforming it into an orthogonal domain and processing operations on the resulting coefficients followed. Eventually, through reconstruction process, the sensory input is transformed back to original state. The denoised reconstructed BSMs sensory input is fed into the BDL algorithm for further examination and anomaly detection as explained in Section 4.4. This stage of anomaly detection is achieved by first splitting the data into training and testing data-set. The proposed approach is trained to develop a prediction on the training data-set. while the testing data-set is fed to the algorithm for prediction test. #### 4.5.1 Classification Criterion of the Proposed Approach

This section provides a detailed description of the anomaly detection of the proposed approach in CAVs network and Figure 8 illustrates the process. The value \(\vec{x}\) is a vector of BSMs sensory input of \(D\) variables, while \(c_{k}\) and \(M\) are the relevant class output (ground truth) to be estimated by the proposed method and the model respectively. In other words, \(\vec{x}\) is the piece of evidence to be predicted. The variable \(c_{k}\) is assigned with values 0 or 1. Where 0 or 1, represent the malicious (mal) and honest (hon) information, sent by the nodes respectively. Mathematically, \(\vec{c}_{k}\in\{mal,hon\}\equiv\vec{c}_{k}\in\{0,1\}\) considering a binary classification. The mathematical representation of the classification process can be expressed using Bayes Theorem as follows:

\[ \begin{split} p(C=\vec{c}_{k}\mid M_{j},D\ =\vec{x}_{i})=\\ \frac{p\left(M_{j}\mid C=\vec{c}_{k},D\ =\vec{x}_{i}\right)p(C= \vec{c}_{k}\mid D=\vec{x}_{i})}{p(M_{j}\mid D=\vec{x}_{i})}\end{split}