# IAQ Prediction in Apartments Using Machine Learning Techniques and Sensor Data
## 5 Discussion  
The summary of median performance metrics (R2, MAPE, and RMSE) for all MLTs, together with the naive approach, is presented in Table 3. Figure 10 shows the performance metrics of one of the best MLT, i.e., multiple linear regression (MLR), for tests on the data from the individual apartments, i.e., A1, A2, A3, A4, and A5. The comparison of the observed time series of indoor air parameters and the time series predicted by the MLR model is displayed in Figure 11. Apartments A3 and A4 were chosen for presentation, as they were also referred in Figure 4.  
Figure 10: Time series of measurement data that were collected for three days during the IAQ monitoring study in the living room of (**a**) apartment A3 and (**b**) apartment A4 and the associated predictions made by the MLR model. Based on the results of this study, several observations could be made. (1) In the apartments, there exists a co-dependency between indoor air parameters in the kitchen and the living room. (2) This relationship has a common component that is pertinent in multiple apartments despite their versatility. (3) The relationship may be exploited by MLTs and utilized for prediction purposes. (4) Various MLTs perform differently in predicting living room IAQ based on kitchen air monitoring. (5) The prediction of distinct indoor air parameters is not equally effective. (6) MLT model performance varies among flats. R\({}^{2}\) characterizes the percentages of variance of the individual air parameters in the living room explained by prediction models. Based on the R\({}^{2}\) medians shown in Table 3, the highest percentages of variance explained for the individual air parameters in the living room were R\({}^{2}\) = 0.72 (MLR for T), R\({}^{2}\) = 0.72 (naive for RH), R\({}^{2}\) = 0.52 (MLP2 for CO\({}_{2}\)), R\({}^{2}\) = 0.75 (MLR and MLP2 for TVOC based on SGP30 sensor), and R\({}^{2}\) = 0.56 (naive for TVOC based on SGP30 sensor). Given these results, the existence of co-dependency between indoor air parameters in the kitchen and the living room of apartments could be confirmed. Due to the applied cross-validation procedure (see Section 3.3), the calculated coefficients of determination reflect the magnitude of the component of the relationship, which is common in multiple apartments despite their versatility. Despite the problem's complexity, high-performance models could be attained upon a favorable selection of training and test apartments. The analysis of plots in Figure 5a to Figure 9 reveals a considerable spread of R\({}^{2}\) for a particular MLT applied to predict an individual air parameter in five folds. The spread comes from the fact that model performance was dependent on the combination of apartments providing training and test data in the individual folds. In particular, for some combinations of apartments, R\({}^{2}\) was objectively very high, as shown by its maximum values, which were R\({}^{2}\) = 0.94 (MLR and MLP2 for T), R\({}^{2}\) = 0.94 (MLR and MLP2 for RH), R\({}^{2}\) = 0.63 (MLR and MLP2 for CO\({}_{2}\)), R\({}^{2}\) = 0.84 (MLR and MLP2 for TVOC, based on the SGP30 sensor), and R\({}^{2}\) = 0.92 (MLR and MLP2 for TVOC, based on the SGP30 sensor). Additional work could be undertaken to identify the similarity criteria allowing for apartment grouping to support the selection of the representative training data and allowing for the preparation of MLT models applicable to certain categories of apartments. With this option, the necessity of apartment-specific model parametrization could be eliminated. Based on our analysis, MLTs may be effectively applied to predict living room IAQ based on indoor air monitoring in the kitchen. Moreover, this work establishes that linear approaches yielded the best results, whereas nonlinear MLTs fell short in predicting indoor air parameters accurately. As already mentioned, a high R\({}^{2}\) was found for linear MLTs. In addition, they offered the smallest prediction errors in the case of all indoor air parameters, except for CO\({}_{2}\).