# Explanation of Air Quality Data Using Takagi-Sugeno Fuzzy Inference System
## 5 Data Analysis  
The main objective of the presented work is to find a function that approximates the relationship between input and output values as accurately as possible. Part of this research study was performed and mentioned in [8]. In this work, we continue the research study with an emphasis on the explainability of the system. As mentioned before, we consider ten input variables and one output variable. As an approximation method, we used the Takagi-Sugeno FIS. For this system, an IF-THEN rule base needs to be created. Let us give an example of such a rule for our task:  
\(R_{k}\): _IF The wind speed is high AND... AND The number of vehicles is low,_  
_THEN The value of \(PM_{10}\) is low._  
The values _low_, _high_, etc., in the assumptions are expressed by using fuzzy sets. Note that fuzzy sets are uniquely determined by using their membership functions, which can be of several types (triangular, trapezoidal, Gaussian, bell-shaped, etc.). In this research study, we chose Gaussian membership functions, as we assume a normal data distribution. These functions need to be specified by using two parameters \([u\;v]\). In MATLAB software, parameter \(u\) represents the standard deviation of the curve, and parameter \(v\) represents the position of the centre of the curve peak. The height of this curve is always equal to one. The values in the consequences could be expressed by using constant or linear functions. If we want to design a system that is explainable, it is more appropriate to use a constant function for an output. In the first step, we wanted to create the rules ourselves. Based on the knowledge from experts, we knew some relationships between variables, for example, the aforementioned rule that strong wind can cause an area with strong polluting elements to have a similar amount of emissions as windless quiet city streets. We wanted to determine relationships among multiple inputs and find further dependencies among them. Therefore, we proceeded as follows: We sequentially sorted the input data based on the first input, second input, etc., and we tried to evaluate the effect of specific input values on the overall output. Since we had ten input variables and this problem is quite complex, we were not able to state rules that would cover the entire input data space. Therefore, we decided to use another approach--analyse the known data by using methods the described in Section 4. The first approach, using the Grid Partition method, allows the definition domain of each input to be divided into several parts (cuboids). From them, \(n\)-dimensional cuboids, containing the input values, are subsequently created. The output value is assigned to each cuboid. Then, the processed values of the cuboid together with the output value represent one IF-THEN rule. Since we have ten input variables, as an example, we divide each definition domain into three parts, and we obtain 310 = 59,049 rules. MATLAB software is unable to generate such a large rule base. Even if we could generate the entire rule base, it would be problematic to explain the behaviour of the system. For this reason, we need a lower number of the rules. This lower number of the rules is given as a result of another method for Takagi-Sugeno FIS creation--Subtractive Clustering. This method consists of two steps: In the first step, the ideal number of clusters is found by using a clustering algorithm called Subtractive Clustering (see [26]). In the second step, each cluster centre is identified with the variables of one IF-THEN rule. Note that the Subtractive Clustering method, which is implemented in MATLAB software, always assigns Gaussian membership functions for input variables and linear functions for output variables. We used the above-mentioned procedure to analyse our data. In the first step, we used the predefined parameters of Subtractive Clustering. The algorithm found 28 clusters and generated 28 rules. The number of obtained rules was acceptable, but we wanted to reach an even lower number of rules.