# Traffic Noise Prediction Applying Multivariate Bi-Directional Recurrent Neural Network
## 2 Materials and Methods
### Data Pre-Processing
#### 2.5.2 Traffic Features Generation  
To train a supervised machine-learning model, the input variables and output variable should be well defined in advance. In this specific problem, the traffic features are the input variables, and the corresponding traffic noise is the output variable. The next critical task is to convert the individual vehicle trajectory into traffic features, because the obtained noise level at each time step is contributed by the traffic as a whole. Two methods are proposed to represent the traffic features: statistic representation and histogram representation.  
The initial individual vehicle trajectory data were in the order of vehicle ID. The whole dataset is re-ordered to time domain, at the time window of 1, 5, 9, 15 and 46 s, respectively. It takes around 10 to 15 s for one vehicle from driving in the roundabout to leaving the roundabout, when the traffic is flowing fluently. At each time step, all the individual vehicle features, such as speed, acceleration, deceleration, distance to receivers and vehicle category can be aligned together in different lists, as shown below in Table 3.  
Figure 8: Video pre-processing and vehicle trajectory detection.  
However, at different time steps, these data lists have different sizes, because the traffic recorded by the camera changes dynamically with time. Therefore, further feature variables are extracted from these data, in order to generate uniform data size, which can be used as input for training machine-learning model. Statistic representation and histogram representation are applied and compared, respectively. With statistic methods, summary statistics are extracted from each data list. Hence, the data distribution of each feature--speed, acceleration, deceleration, distance to microphone--is converted to its mean, min, max, standard deviation, median, range, mid-point, skewness and kurtosis. In terms of mean speed, both time mean speed and space mean speed are calculated. With regards to those lists of vehicle category, at each time step the number of vehicles is counted, equal to the size of the list, the proportions of each vehicle category are calculated. As a result, a total of 44 features have been generated, which can be observed below in Table 4:  
As shown in Table 4, the left column corresponds to the raw data, while the right column shows the transformed results from raw data, and they are the final forty-four input variables used for the machine-learning model. With the histogram method, the width of bins and number of bins are pre-defined. The extracted features are the counts of instances falling in each bin. The number of features is the number of bins. Due to the spread of the data, more bins have to be predefined, in order to cover all the data. As a consequence, a total of 391 features have been generated. Compared to statistic representation, histogram representation results in a high dimension and data sparsity. Besides, the data are discretized and have lost the physical meaning, as they are simply the counts of instances falling in that bin.