# Rogue Node Detection Based on a Fog Network Utilizing Parked Vehicles
## 3 Network Model
### Parked Vehicle Stability Prediction Model  
The proposed parked vehicle stability prediction model in this subsection is executed by the cluster head, with the aim of predicting the parking probability of each member. The parking probability denotes the probability that the vehicle will continue to stay in the cluster in the future period of time. The parked vehicles with higher parking probabilities are selected as fog computing nodes to ensure the relative stability of parked vehicles that will perform fog computing. The data set used here comes from the Jiaxiaigou county government office [19], which contains parking datasets from 11 March 2020 to 29 March 2020 in the Jiaxiaigou scenic area, Sichuan, China. This data set contains 11 features, as shown in Table 1. In addition, this data set records the specific time that vehicles enter and exit the parking lot. Based on this data set, both the number of daily parking times and the average daily parking duration of each vehicle are analyzed. Figure 2 shows the statistics of the distribution of parking times in each time period within 24 h of a day. As shown in Figure 2, the number of parking times is the maximum from 8:00 a.m. to 17:00 p.m. of a day, and the peak of the stop of vehicles is around 10:00 a.m. in the morning. The least number of stops are from 4:00 a.m. to 6:00 a.m. in the morning. Figure 3 shows the average parking duration of the vehicles in the parking lot. It can be seen from this figure that most of the parked vehicles stay in the parking lot for 1 to 8 h, and the number of vehicles that parked for more than 3 h account for 87.8% of the total number of parked vehicles. Figure 1: Basic network architecture. Feature extraction is the key to data analysis. Combined with the attribute information of the data set, we select 10,000 pieces of data and extract 6 key attribute features for model analysis. These six features are vehicle code, parking lot ID number, parking order number, historical times of parking, average parking time and the longest parking duration of each parked vehicle. Through the extraction of the above features, the corresponding relationship between each vehicle and each parking lot is sorted out and 2826 new pieces of \begin{table}
\begin{tabular}{c c c} \hline \hline
**No.** & **Features** & **Type** \\ \hline
1 & gate & Char \\
2 & operator & Varchar \\
3 & p-imppath & Varchar \\
4 & vehicle code & Varchar \\
5 & parking lot ID & Varchar \\
6 & type (1: enter, 2: out) & Char \\
7 & vehicle state (0: unlock, 1: lock) & Char \\
8 & creation time & Datetime \\
9 & parking order number & Varchar \\
10 & car type & Varchar \\
11 & last time & Datetime \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Features of parked vehicles in the data set. Figure 3: The distribution of average parking duration. Figure 2: The distribution of vehicles’ parking times. data is obtained. The first 2000 pieces of data are selected as training data and the rest of the data are test data. The training set is processed by a linear model to raise and then reduce the original four-dimensional data. Finally, one-dimensional data are obtained. In addition, since this problem is a binary classification problem, it needs to be activated by the sigmoid function so that the parking probability is distributed between 0 and 1. The neural network model is shown in Figure 4, which adopts a fully connected neural network, including an input layer, hidden layers and an output layer. The probability of stable parking of the vehicle is given by the sigmoid function. Figure 5a denotes the variation of the average entropy loss vs. the training epochs. It can be seen that the cross entropy loss converges around 0.37 after about 1000 epochs. Figure 5b shows the variation of average prediction accuracy with the varying of training epochs. As can be seen from the figure, the prediction accuracy reaches about 76%, and the average accuracy on the test set is 72.67%.