# Machine Learning and Sustainable Mobility: The Case of the University of Foggia (Italy)
## 2 Materials and Methods
### Data Preparation  
First, we can make manipulations of the data. Many features in Table 1 are categorical, and the rest are numeric. Our goal was to understand which variables to use so that it is possible to reduce the number of features while maintaining a certain acceptable variance level. We can transform categorical variables into numerical ones via _one-hot encoding_ for data that do not require a relationship between labels (e.g., sex, role, department, and type lunch) and via _LabelEncoder_ for those in which there is a natural order (e.g., car power, car registration, and age), through _sklearn_ (in Python). Furthermore, since it is advisable to standardize the data to carry out analyses, we use a _StandardScaler_ (always in _sklearn_). We know that the variable that indicates the travel time (**Min**) cannot be considered since it includes times that do not fall within the calculation of emissions (linked to the structure of the questionnaire made to obtain the dataset). For this reason, trip duration from one's home to the department was eliminated a priori, as were the second, third, and fourth choices of alternative sustainable mobility solutions (**second-, third-,** and **fourth-choice rent**) since we assumed that the first choice was the most representative. At this point, the dataset comprised 16 features describing transportation by the academic community.  
To better understand the links between the different features, we can represent their Pearson's correlations via a heat map, as shown in Figure 1. Table 2 shows the significance levels of the various correlations (\(p\)-value), from which it is possible to extract the most important relationships between the variables and how these are statistically significant (e.g., car registration, passengers, car power, age, and role). Of course, many of these correlations are conceivable a priori, such as the strong link between variables that explain the means of transport during the two seasons (as also highlighted by the significance levels).  
\begin{table}
\begin{tabular}{c c} \hline \hline
**Feature** & **Description** \\ \hline
**Sex** & Sex of respondents \\
**Age** & Age of respondents \\
**Role** & Role within the university \\
**Department** & Respondent department \\
**Distance** & Kilometers covered by respondents (round trip) \\
**Min** & Time taken to reach the department \\
**Day hot** & Number of days (hot season) that the respondent goes to university \\
**Day cold** & Number of days (cold season) that the respondent goes to university. \\
**Means cold** & Means of transport (cold season) used to get to the university \\
**Means hot** & Means of transport (hot season) used to get to the university \\
**Car power** & Power supply of the car (if it has been chosen as a means of transport) \\
**Car registration** & Year of registration of the car \\
**Passengers** & Number of passengers carried during the car journey \\
**Locations** & Moving to other university locations (other than your own department) \\
**First choice rent** & First choice alternative solutions for clean mobility \\
**Second choice rent** & Second choice alternative solutions for clean mobility \\
**Third choice rent** & Third choice alternative solutions for clean mobility \\
**Fourth choice rent** & Fourth choice alternative solutions for clean mobility \\
**Lunch** & Number of times the respondent has lunch at the university \\
**Type lunch** & Type of lunch eaten at the university (brought from home or purchased) \\ \hline \hline \end{tabular}
\end{table}
Table 1: Description of the features in the dataset.