# A Comparative Analysis for Air Quality Estimation from Traffic and Meteorological Data
## 2 Materials and Methods
### Experiments  
In summary, the main goal of this work is AQI classfication. We tackled this problem by first defining a regression task on each individual pollutant, then merging the results using the index thresholds and computing an overall performance on air quality estimation. Therefore, in the following \begin{table}
\begin{tabular}{l r} \hline \hline
**Package** & **Version** \\ \hline joblib & 0.14.1 \\ matplotlib & 3.2.1 \\ numpy & 1.18.2 \\ pandas & 1.0.3 \\ pip & 20.0.2 \\ python & 3.7.6 \\ pytorch & 1.5.0 \\ scikit-learn & 0.23.1 \\ statsmodels & 0.11.1 \\ \hline
**Package** & **Version** \\ \hline gdata & 2.18.0 \\ brm & 0.8 \\ tidyverse & 1.3.0 \\ reshape2 & 1.4.4 \\ dataPreparation & 0.4.3 \\ \hline \hline \end{tabular}
\end{table} 
Table 4: List of Python (top) and R (bottom) libraries and respective versions installed on the machine. paragraphs the discussion will first focus on regression results and then move to the classification problem, analysing the estimates of the different models employed. The first regression task was carried out with different evaluation runs performed on each pollutant independently, using the same setup for each target variable with the only exception of particulate matter. In the latter configuration, the training procedure remained the same described below, with the only change of dataset employed, as stated in Section 2.2. For simplicity, in the following paragraphs we refer to the original set of time series with hourly resolution as Hourly Set (HSet), while referring to the daily-averaged data as Daily Set (DSet). Despite the definition of a standard regression task, special care must be taken in the event of time series data. First, features in the training and test subdivisions are inherently dependent on time, therefore a random selection of a portion of samples cannot be considered a viable option as the temporal dependency must be respected. This is also crucial for training the LSTM model or any recurrent network in general, given their sequential nature. Additionally, both meteorological trends, transit counts and consequently pollutant measurements are bound to change in the longer period. Considering the available information spanning almost three years, we had to take into account that even the same models may present extremely different results, depending on the training intervals and the test windows selected. In order to assess the performance of the aforementioned models,we identified 3 folds of equal size over the three year interval, each one subsequently divided into training, validation and test sets. We maintained a continuous timeline in the second subdivision as well, by keeping the first 70% as training, 10% as validation and the remaining 20% as test data. The presence of a validation set is useful to assess the number of iterations required to maximize the performance without overfitting, moreover provides a clear separation between train and test data, avoiding any possible time dependency. Every model was then fitted and evaluated independently and the final results were obtained by averaging the scores over the three splits. We trained the linear model using the default tolerance threshold \(t=1\times 10^{-4}\), the Random Forest model using 100 base estimators with maximum depth set to 8 to further reduce overfitting and the LSTM model using two layers of 100 hidden cells, using a dropout between hidden and linear layer to improve the generalization, with a drop rate set to \(p=0.5\). For this last training configuration we used an Adam optimizer with learning rate \(\lambda=1\times 10^{-3}\), iterating for 20 epochs with a batch size of 32. Lastly, the BRNN was initialized using the parameters defined in previous work in order to maintain a comparable setup. In every testing scenario we employed a Mean Squared Error loss, then we computed on every model two common regression metrics in order to better assess and compare the results.