# Machine Learning and Sustainable Mobility: The Case of the University of Foggia (Italy)
## 2 Materials and Methods
### Machine Learning Imputation  
After making the dataset usable for different analyses, we can proceed to the _inputation_ process through machine learning. In order to use this system to predict the emissions of pollutants, we need to consider what the missing features might be. For example, gender, age, role and department can be automatically extracted from the respondents since the questionnaire would be submitted directly through a management system that requires authentication. Instead, for some features that can be fundamental (such as those relating to the means of transport), it is necessary to prepare a system that determines them in case there are missing values. The classification was the reference task for the analyses. Because these are multi-class classifications, we used _logistic regression_ with the one-vs-rest (OvR) training algorithm in _Python_. In this way, logistic regression estimates the probability of an event occurring, \begin{table}
\begin{tabular}{l c c c c c c c c c c c c c c} \hline \hline  & **Sex** & **Age** & **Role** & **Dept** & **Km** & **Day Hot** & **Day Cold** & **Means Cold** & **Means Hot** & **Car Power** & **Car reg.** & **Passengers** & **Locations** & **First Choice** & **Lunch** & **Type Lunch** \\ \hline Sex & 0 & 0 & 0 & 0 & 0.875 & 0.0035 & 0.0162 & 0.5056 & 0.4761 & 0 & 0 & 0 & 0.0004 & 0 & 0 \\ \hline Age & 0 & 0 & 0 & 0 & 0.0632 & 0 & 0.9905 & 0.0825 & 0 & 0 & 0.1571 & 0 & 0.0001 & 0 \\ \hline Role & 0 & 0 & 0 & 0 & 0 & 0.1954 & 0.0104 & 0.1465 & 0 & 0 & 0 & 0 & 0.2641 & 0 \\ \hline Dept & 0 & 0 & 0 & 0.0176 & 0.3117 & 0.0070 & 0.397 & 0.0899 & 0.0239 & 0.0543 & 0.0001 & 0 & 0 & 0.0031 & 0.005 \\ \hline Km & 0.875 & 0 & 0 & 0.0176 & 0 & 0 & 0 & 0 & 0 & 0 & 0 & 0.006 & 0 & 0.6761 & 0.0168 \\ \hline Day hot & 0.0035 & 0.0832 & 0 & 0.3117 & 0 & 0 & 0 & 0.1269 & 0.3468 & 0.4339 & 0.7868 & 0.6469 & 0 & 0.5534 & 0 & 0.9799 \\ \hline Day cold & 0.0162 & 0 & 0.1954 & 0.0070 & 0 & 0 & 0.0195 & 0.1495 & 0.0631 & 0.8489 & 0.241 & 0 & 0.5256 & 0 & 0.0001 \\ \hline Mann cold & 0.5068 & 0.9065 & 0.0014 & 0.397 & 0 & 0.1269 & 0.0195 & 0 & 0 & 0 & 0 & 0.8642 & 0.0058 & 0.0689 & 0.0554 \\ \hline Mann's hot & 0.4761 & 0.0925 & 0.1465 & 0.6989 & 0 & 0.3498 & 0.1495 & 0 & 0 & 0 & 0 & 0.0 & 0.874 & 0.0135 & 0.261 & 0.0121 \\ \hline Car power & 0 & 0 & 0 & 0.0239 & 0 & 0.4399 & 0.6361 & 0 & 0 & 0 & 0 & 0 & 0.3192 & 0 & 0.0013 & 0.0288 \\ \hline Car registration & 0 & 0 & 0 & 0.0543 & 0 & 0.7868 & 0.8499 & 0 & 0 & 0 & 0 & 0 & 0.6767 & 0 & 0.0009 & 0.0002 \\ \hline Passengers & 0 & 0 & 0 & 0.0001 & 0.8469 & 0.241 & 0 & 0 & 0 & 0 & 0 & 0.4477 & 0 & 0.0005 & 0 \\ Locations & 0.0004 & 0.1571 & 0 & 0 & 0.0966 & 0 & 0 & 0.8642 & 0.874 & 0.3192 & 0.6767 & 0.4477 & 0 & 0.7958 & 0 & 0 \\ \hline First choice & 0 & 0 & 0 & 0 & 0 & 0.5534 & 0.5256 & 0.0058 & 0.0135 & 0 & 0 & 0 & 0.7968 & 0 & 0.0428 & 0.1915 \\ \hline Lunch & 0 & 0.0001 & 0.2641 & 0.0631 & 0.6761 & 0 & 0 & 0.0589 & 0.261 & 0.0013 & 0.0049 & 0.0005 & 0 & 0.0628 & 0 & 0.5154 \\ \hline Type lunch & 0 & 0 & 0 & 0.005 & 0.0168 & 0.9799 & 0.0001 & 0.0554 & 0.0121 & 0.0288 & 0.0002 & 0 & 0 & 0.1945 & 0.5154 & 0 \\ \hline \hline \end{tabular}
\end{table} 
Table 2: Significance values (\(p\)-values) of the correlation values (_lower the better_). Figure 1: Heat map of correlations. limiting the variation of the dependent variable to the \((0,1)\) interval. The equation of the logistic function is of the type  
\[y=\frac{1}{1+e^{-(\beta_{0}+\beta_{1}x)}} \tag{2}\]  
where \(\beta_{0}\) and \(\beta_{1}\) are the intercept and the rate parameter respectively, generally estimated via maximum likelihood estimation (MLE). In all cases, the training and test sets were divided into 70% and 30% portions, and a _stratified 10-fold cross validation_ was performed to avoid over-fitting problems. To evaluate the goodness of the prediction, we report some indicators such as _accuracy_, _precision_, _recall_, _R\({}^{2}\)-score_, _Mean Absolute Percentage Error (MAPE)_, _F1-score_ and _F2-score_.