# Smart Cities Big Data Algorithms for Sensors Location
## 3 Process Implementation  
A critical problem in the big cities is air quality. Therefore, air pollution indicators of the Guadalajara Metropolitan Zone (GMZ) in the Jalisco State of Mexico were treated. The GMZ is the second most populous area in Mexico with more than 5 million habitants. In order to choose our data sample, we consulted the official Mexican standards for population health [23; 24], which recommended the following variables: PM\({}_{10}\), PM\({}_{2.5}\), O\({}_{3}\), NO\({}_{2}\), SO\({}_{2}\), and carbon monoxide (CO) [23], and the World Health Organization (WHO) whose guidelines for improving air quality include the reduction of particulate matter (PM), ozone (O\({}_{3}\)), nitrogen dioxide (NO\({}_{2}\)), and sulfur dioxide (SO\({}_{2}\)). For Phase 1 of the process (see Figure 2), we downloaded files from the information page of the Secretariat of the Environment and Territorial Development of Jalisco State [25], in Microsoft Office Excel software format. Data from 21 years of air variables, from 1996 to 2017, were recovered. Sensor data monitoring started with eight stations and, in 2012, two additional stations were added. The records contained data from every hour for each station. After analyzing the data, January to December, 2015 was selected as a sample. In this year, the 10 stations were implemented, and it presented fewer missing values when compared with other years. For Phase 2 of the process, the dataset was cleaned--that is, null data were eliminated. Also, the variable PM\({}_{2.5}\) was not considered because, initially, there were no sensors for it. Moreover, when sensors that could monitor it were installed, they contained a massive amount of null values. Observations were labeled according to a certain level of air quality, as indicated by the Mexican reference Metropolitan Index of Air Quality (IMECA by its Spanish initials), as shown in Table 1.  
The variables have a different range. The variable with the highest value according to its range is the one that indicates the air quality level by color. Pollution levels are classified as: good = level 1 in green color; fair = level 1 in yellow color; bad = level 5 in orange color; very bad = level 4 in red color, and extremely bad = level 5 in magenta color. Table 2 shows an extract of registered entries in a file after being classified with the quality label in the sixth column. Then, data analysis algorithms were selected. As mentioned with the objective of discarding, if possible, some variables with less influence for the quality classification. Also, algorithms to train with machine learning that require fixed-size datasets and disk storage were selected, because it added \begin{table}
\begin{tabular}{c c c c c c} \hline
**IMECA** & **O\({}_{3}\) [ppm]** & **NO\({}_{2}\) [ppm]** & **SO\({}_{2}\) [ppm]** & **CO [ppm]** & **PM\({}_{10}\) [mg/m\({}^{3}\)]** \\ \hline
0–50 & 0.000–0.055 & 0.000–0.105 & 0.000–0.065 & 0.00–5.50 & 0–60 \\
51–100 & 0.056–0.110 & 0.106–0.210 & 0.066–0.130 & 5.51–11.00 & 61–120 \\
101–150 & 0.111–0.165 & 0.211–0.315 & 0.131–0.195 & 11.01–16.50 & 121–220 \\
151–200 & 0.166–0.220 & 0.316–0.420 & 0.196–0.260 & 16.51–22.00 & 221–320 \\ \textgreater{}200 & \textgreater{}0.220 & \textgreater{}0.420 & \textgreater{}0.260 & \textgreater{}22.00 & \textgreater{}320 \\ \hline \end{tabular}
\end{table} 
Table 1: Concentration intervals for color assignment or air quality levels [24]. \begin{table}
\begin{tabular}{c c c c c c} \hline
**CO** & **NO\({}_{2}\)** & **O\({}_{3}\)** & **PM\({}_{10}\)** & **SO\({}_{2}\)** & **Quality** \\ \hline
0.588 & 0.0181 & 0.0176 & 7.31 & 0.00207 & 1 \\
1.139 & 0.02767 & 0.01062 & 14.6 & 0.00197 & 1 \\
2.235 & 0.03053 & 0.00178 & 65.8 & 0.00232 & 2 \\
1.204 & 0.03698 & 0.01597 & 123.4 & 0.002 & 3 \\
1.361 & 0.03257 & 0.0149 & 154.18 & 0.002 & 3 \\
0.64 & 0.01578 & 0.00308 & 58.8 & 0.001 & 1 \\
22.83 & 0.01503 & 0.00217 & 49.1 & 0.001 & 5 \\ \hline \end{tabular}
\end{table} 
Table 2: Fragment of the sample of observations captured by sensors classified with a quality label.