# Fuzzy Based Prediction Model for Air Quality Monitoring for Kampala City in East Africa
## 2 Materials and Methods
### Defining the Input Variables and Fuzzyfication of the Values
#### 2.2.2 Formulation of Fuzzy Rules  
In fuzzy logic, rules play an important role. They determine the input and output membership functions that are later used in inference process. They are represented by a generic form of if-then. A fuzzy rule maps a condition described by linguistic variables and fuzzy sets to a desired output. To design the model, the boundary values of the universal sets for the input and output variables are determined. The fuzzy sets to be defined in universes for the fuzzification process are identified. As shown in Table 1, the boundary values of universal sets are set. Each variable is represented by three different fuzzy sets, 'Low', 'Medium', and 'High' in these universes [27]. Figure 2: Air Quality Index guidelines [24]. In order to determine the boundary values for 'Low', 'Medium' and 'High' fuzzy sets, the corresponding boundary values of the sets are defined in the form of 'Good', 'Moderate-Sensitive', 'Unhealthy-Very-Unhealthy-Hazardous' and fuzzy set values are defined based on the lower and upper boundary values for the universal sets. In this work, the values are defined following the boundaries indicated by the Environmental Protection Agency (EPA) standards [14]. EPA is an international agency that prescribes standards and guidelines relating to air pollution as elaborated in Figure 2[28]. Table 2 shows the boundary values of universal sets and fuzzy sets NO2, SO2, and PM2.5 input variables. The membership functions for the input variables fuzzy sets are defined basing on the boundary values. The selected output variable is KAQI and is represented by the six fuzzy sets, 'Good', 'Moderate', 'Sensitive', 'Unhealthy', 'Very Unhealthy' and 'Hazardous'. The boundary values of these output fuzzy sets are determined by considering the value ranges used by the Environmental Protection Agency standards as indicated in Table 3.  
In Table 4, the relationship between the input variables and output variables is determined by the rule base. The fuzzy associative memory method is used to map input fuzzy values to corresponding output fuzzy sets in order to generate the inference rules. In this, the three variables represented by the three fuzzy sets, a total of twenty-seven rules, are generated in the following rule base: for 3 inputs (M) classified into 3 linguistic variables (N). M to the power N rules (M\({}^{N}=3^{3}\)) are generated. Rules are formed based on the highest values of NO2, SO2 and PM2.5. To generate the rule base, we take into consideration all the pollutant concentrations, that is, if one of the pollutants is high, then the resultant KAQI will be Unhealthy, as clearly indicated in the rule base. \begin{table}
\begin{tabular}{l l l l l} \hline \hline
**Index Class** & **AQI** & **NO2 (ppb)** & **SO2 (ppb)** & **PM2.5 (\#g/m3)** \\ \hline Good & 0–50 & 0–53 & 0–35 & 0–12.0 \\ Moderate & 51–100 & 54–100 & 36–75 & 12.1–35.4 \\ Sensitive & 101–150 & 101–360 & 76–185 & 35.5–55.4 \\ Unhealthy & 151–200 & 361–649 & 186–304 & 55.5–150.4 \\ Very Unhealthy & 201–300 & 650–1249 & 305–604 & 150.5–250.4 \\ Hazardous & 301–500 & 1250–2049 & 605–1004 & 250.5–500.4 \\ \hline \hline \end{tabular}
\end{table} 
Table 1: The boundary values of the air quality pollutants. \begin{table}
\begin{tabular}{l l l l} \hline \hline
**Crisp Input Variables** & **Fuzzy Input Parameters** & **Boundary Values for Universal Sets** & **Universe of Discourse for MFs** \\ \hline NO2 (ppb) & Low, Medium, High & 0–2049 & 0–53, 54–360, 361–2049 \\ SO2 (ppb) & Low, Medium, High & 0–1004 & 0–75, 76–304, 305–1004 \\ PM2.5 (\(\text{\mu}\text{g}/\text{m}^{3}\)) & Low, Medium, High & 0–500.4 & 0–12.0, 12.1–55.4, 55.5–500.4 \\ \hline \end{tabular}
\end{table} 
Table 2: The boundary values of crisp sets and fuzzy sets for input parameters, domain ranges, universe of discourse membership function.