Next Article in Journal
Two-Stage Data Envelopment Analysis Models with Negative System Outputs for the Efficiency Evaluation of Government Financial Policies
Previous Article in Journal
Solving Fuzzy Optimization Problems Using Shapley Values and Evolutionary Algorithms
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Indoor Air Quality Analysis Using Recurrent Neural Networks: A Case Study of Environmental Variables

by
Carlos A. Reyes Pérez
1,
Miguel E. Iglesias Martínez
1,2,*,
Jose Guerra-Carmenate
1,
Humberto Michinel Álvarez
2,
Eduardo Balvis
3,
Fernando Giménez Palomares
1 and
Pedro Fernández de Córdoba
1
1
Grupo de Modelización Interdisciplinar, InterTech, Instituto Universitario de Matemática Pura y Aplicada, Universitat Politècnica de València, Camino de Vera, s/n, 46022 València, Spain
2
Grupo de Ingeniería Física, Escuela de Ingeniería Aeronáutica y del Espacio, Universidad de Vigo, Edif. Manuel Martínez Risco, Campus de As Lagoas, 32004 Ourense, Spain
3
Departamento de Ingeniería de Sistemas y Automática, Escuela Superior de Ingeniería Informática, Universidade de Vigo, Edificio Politécnico s/n, 32004 Ourense, Spain
*
Author to whom correspondence should be addressed.
Mathematics 2023, 11(24), 4872; https://doi.org/10.3390/math11244872
Submission received: 16 October 2023 / Revised: 22 November 2023 / Accepted: 3 December 2023 / Published: 5 December 2023
(This article belongs to the Section Computational and Applied Mathematics)

Abstract

:
In the pursuit of energy efficiency and reduced environmental impact, adequate ventilation in enclosed spaces is essential. This study presents a hybrid neural network model designed for monitoring and prediction of environmental variables. The system comprises two phases: An IoT hardware–software platform for data acquisition and decision-making and a hybrid model combining short-term memory and convolutional recurrent structures. The results are promising and hold potential for integration into parallel processing AI architectures.
MSC:
68T07

1. Introduction

The primary source of CO2 in non-industrial indoor environments is human metabolism, resulting in higher concentrations compared to outdoor spaces [1,2]. It has been established that exposure to concentrations exceeding 1000 ppm can adversely affect human cognitive abilities [3]. Additionally, CO2 levels are closely linked to ventilation efficiency [4] and the risk of indoor airborne infections [5]. Due to these critical implications, CO2 concentration is frequently employed as an indicator of indoor air quality.
Presently, a wide range of devices is available for measuring indoor CO2 levels, with some capable of monitoring additional parameters such as relative humidity and temperature. These devices can be categorized into two groups: those that exclusively display real-time measurements, often via a screen, and those that offer data storage capabilities. Devices in the first group often include audible and visual alarms; nevertheless, they lack the capacity for generating historical records of measured variables. Devices in the second group allow for the storage of acquired data, typically through cloud servers managed by the manufacturing or marketing company [6,7].
In many cases, the acquisition of data for indoor air quality and environmental variables lacks the ability for total, unique, and personalized control, leading to limitations in understanding and responding to the data effectively. Additionally, data storage often comes with an extra cost, making long-term monitoring challenging.
Continuous monitoring over an extended period, ideally spanning several weeks, is essential for gaining a deeper insight into usage patterns, occupancy profiles, contamination types (background or localized), periodicity, and the potential for space improvement [8,9,10].
In situations where thermal and humidity comfort is inadequate, it becomes necessary to assess and adjust the air conditioning system, control and regulation mechanisms, the need for humidification or dehumidification, and even calculate the required water vapor adjustments to achieve specific comfort conditions. This process enables the selection of appropriate devices or systems for this purpose. Monitoring CO2 concentration and temperature is instrumental in evaluating the efficiency of ventilation systems and programming their regulation based on CO2 levels [3,11,12]. By addressing these aspects, this research aims to provide valuable insights and solutions for enhancing indoor air quality and environmental conditions in enclosed spaces.

Related Works

Over the past decade, significant advancements have been made in the field of weather prediction, driven by the application of advanced machine learning techniques. When it comes to analyzing time series datasets, such as signals and text, long short-term memory (LSTM) neural networks have emerged as a prominent choice [13]. LSTM addresses a common challenge faced by recurrent neural networks (RNNs), which is the vanishing gradient problem, by incorporating memory cells and gating mechanisms. This unique architecture empowers LSTMs to effectively capture long-term dependencies within time series data, making them well-suited for tasks involving temporal patterns [14].
Empirical evidence has demonstrated that LSTM architectures often outperform alternative machine learning models in terms of accuracy, particularly when dealing with numerical values.
Artificial neural networks (ANNs) are intricate systems composed of interconnected processing units that operate in parallel. While ANNs have demonstrated excellent performance in applications like optical character recognition (OCR), their superiority over traditional statistical pattern classifiers remains inconclusive [15].
In ANN systems, the initial stage involves processing real-number input signals. The connections, often referred to as edges, link artificial neurons to their respective outputs and are determined by non-linear functions applied to the sum of their inputs. These edges have adjustable weights that evolve iteratively during the learning process, directly influencing the strength of the signal. For a signal to propagate from one layer to another within the ANN, it must surpass a predefined threshold. Typically, ANNs incorporate multiple layers to facilitate various transformations of input signals. After traversing these layers iteratively, the output layer produces the final results [16].
Numerous previous studies have explored various ANN architectures [17], applied LSTM for weather forecasting [14], and developed simulation models to predict rainfall [18], all of which have contributed to improved modeling efficiency. Additionally, research has been conducted to harness LSTM for greenhouse climate modeling, with a focus on forecasting the impact of six climate factors (temperature, light, humidity, CO2 concentration, soil temperature, and soil moisture) on crop growth. To capture climate variations, a sliding time window approach was adopted to record minute-by-minute changes in environmental conditions. This model was evaluated using datasets comprising three different types of vegetables and demonstrated commendable accuracy when compared to alternative models. Notably, it exhibited robustness and optimal performance within a fixed 5 min time window. However, the model’s performance gradually declined as the window size was increased [19].
In previous research [20,21], LSTM-based models have been successfully employed for a range of applications, including the prediction of point of interest (POI) categories and the hourly daily irradiance forecast. The solar prediction technique introduced in these studies, which combines LSTM with weather data, considers the interdependence of hours throughout the day. Results have demonstrated that this novel approach exhibits reduced overfitting and superior generalization capabilities compared to traditional backpropagation algorithms (BPNNs). Specifically, the proposed algorithm led to a remarkable 42.9 percent reduction in root mean squared error (RMSE) in comparison to BPNN [22].
Furthermore, in the context of meteorological applications involving time series data prediction, both LSTM and time-aware LSTM (T-LSTM) models were leveraged. These models were applied to regression problems using a quadratic cost function. The studies also explored two weighting strategies based on the cosine similarity test between test and training samples. Experiments were conducted under varying climatic conditions over two distinct one-year periods. The results revealed that T-LSTM outperformed LSTM in the prediction task [23].
Likewise, a statistical model for predicting weather variables near Indonesian airports, employing both single-layer and multi-layer LSTM models, was developed [24]. The main objective was to assess the impact of intermediate weather variables on prediction accuracy. The proposed model builds upon the standard LSTM architecture by integrating intermediate variable signals into the LSTM memory block. In this approach, visibility serves as a predictor, while pressure, humidity, temperature, and dew point function are independent variables.
In this model, the initial layer comprises separate LSTM models based on location, and the second layer takes the hidden states of the first LSTM layer as input. Experimental results clearly indicate that the inclusion of spatial information from the dataset significantly enhances the prediction performance of the stacked LSTM-based model [25].
The combination of LSTM [26,27] and CNN [28,29] network architectures has found applications in various research fields, including accident prediction, energy consumption forecasting in households, and stock market analysis [30,31,32]. For instance, accident prediction and energy consumption forecasting models, described in [33,34], are based on the CNN–LSTM architecture.
In contrast, an opposite LSTM–CNN architecture was employed for stock market applications as demonstrated in [35]. Similarly, a recent study on CO2 emissions [36] introduced a CNN–LSTM architecture for multivariate and single-step analysis, using a sliding window of three values and a one-step horizon. These studies often rely on large volumes of simulated data for training, given the limited availability of actual data.
It is important to note that both [35] and [36] focused on single-step forecasts into the future and utilized exogenous variables as inputs, increasing the complexity of the architectures.
However, the architectures discussed in these previous works primarily addressed short-term predictions, and their focus was not on behavioral predictions for high-frequency time series. This study proposes a hybrid model with variations in processing layers designed specifically for high-frequency forecasting. The main contributions of this work are as follows:
  • A hybrid LSTM–CNN architecture is proposed for forecasting 48 steps into the future for high-frequency time series. The baseline sampling time was 30 min.
  • The proposal is based on univariate analysis of the environmental variables studied.
  • Unlike other models, our architecture does not use a pooling layer to prevent the loss of information in the network.
The work has been organized as follows: Section 2 presents the theoretical foundations of the research, as well as the validation metrics used, and describes the experimental process and the data acquisition for the development of the work. Section 3 and Section 4 summarizes the obtained results and the discussion. Finally, the conclusions of the research and the references consulted are provided.

2. Basic Foundations of the Proposed Model

This section describes the theoretical foundations of the proposed architecture, which is based on the combination of a model that utilizes long short-term memory and convolution layers for forecasting environmental variables, specifically carbon dioxide and temperature. The description of the long-term memory network architecture that applies to an input sequence for each element involves a convolution layer, which is described as follows:
y i = g j = 0 F 1 w j x i × S + j + b
where:
  • yi is the output value at position i in the convolutional layer.
  • x is the input signal to the convolutional layer.
  • wj is the filter value at position j.
  • b is the bias value of the layer.
  • S is the step or stride used to move the filter along the input signal.
  • F is the filter dimension.
  • g is the activation function applied to the weighted sum of input values and filter weights.
A graphical representation of the proposed recurrent neural network architecture and the sequential input/output data process is shown in Figure 1.
Both neural networks have identical architectures, which include an input layer, two LSTM layers with 32 units each, a convolutional layer with 128 units, and a dense layer with 48 neurons. The dropout regularization method is applied to the LSTM layers with a value of 0.5. This method probabilistically excludes input connections from activation and weight updates during training, with the goal of reducing overfitting and enhancing model performance.
In the process of developing and configuring the proposed architecture, comprehensive testing and hyperparameter optimization processes have been implemented using the Optuna tool. This systematic optimization methodology has allowed for the thorough exploration and adjustment of critical model parameters, including the specific configuration of LSTM networks and the convolutional neural network architecture. Specifically, iterative experiments have been conducted, varying hyperparameters such as the number of neurons in the LSTM layers (opting for 32 neurons in each), the configuration of the convolutional network with 128 neurons, and other architectural aspects.
Figure 2 illustrates the final layer of the network, which is a dense layer responsible for processing the information generated by the LSTM and convolutional layers and producing the model’s outputs. Each network forecast is calculated by applying the activation function, in this case a linear activation function. This function operates on the sum of weights (w) and inputs (a), to which the bias (b) is added.

2.1. Hardware and Experimental Descriptions

The device developed for monitoring ventilation and thermal comfort, known as the ‘AirQ-Monitor’, comprises the following fundamental hardware elements:
  • 1 SoC (System on Chip) ESP32 (integrated into the PCB): serves as the main system processor.
  • 1 SCD30 sensor: a module for sensing the concentration of CO2, temperature, and humidity.
  • 1 TFT 2.4” touch screen: used for equipment display and configuration interface.
  • Plastic chassis (derived from a generic model).
Figure 3 illustrates the system architecture, depicting multiple AirQ-Monitor devices connected to a server. The system is powered by a 5-volt source through a micro-USB connector. Since all components operate at 3.3 volts, a voltage regulator is employed to reduce the voltage to this level. The ESP32 communicates with the SCD30 module through an I2C bus at a frequency of 100 kHz. For controlling and displaying measurements on the screen, as well as handling other graphical elements, one of the SPI interfaces of the SoC is utilized. The touch panel, which enables user interaction with the device, operates in an analog manner and does not use any specific bus or standard protocol. Additionally, the collected data are transmitted to a cloud IoT server via a Wi-Fi network. Figure 3 provides a block diagram that visually represents the composition of the device.
Data processing has been performed using the latest version of Tensor Flow framework v2.14.0. The data used to train the network were collected from devices installed on the campus of the Universitat Politècnica de Valencia in Spain. Data have been collected from various locations since March 2022. Eighty percent of the data were utilized for training the model, while the remaining 20% were used for evaluation.

2.2. Server and Model Deployment

As an additional aspect of this research, the proposed model has been implemented on a server. The development of the server processing utilized the ‘Flask’ framework. The server is hosted on a cloud computing machine and offers several accessible endpoints. Below, we describe some characteristics of these processes:
  • Results: Provides the most current forecast values.
  • Input: Displays the input values used to generate the most recent forecasts.
  • Real: Presents the forecasted values that correspond to the previous input, allowing for a comparison between the model’s estimates and the actual values (from the last input).
Figure 4 illustrates the system architecture after receiving data from the Thingsboard cloud 3.6, which was used in the experiment.
A Python-based data gateway handles the regular and automatic communication between the Thingsboard 3.6 platform and the server. The server hosts the models for CO2 and temperature, which process incoming information and generate forecasts. Data related to the input, forecasts, and timestamps are stored in a SQLite database for future use. Clients can request information from the server through endpoints such as ‘result’, ‘real’, and ‘input’, enabling the presentation of results in a suitable format for decision-making.

3. Results and Discussion

For the implementation of the proposed model, a 48-step sliding window was used, which is equivalent to one day (24 h). The data were sampled at a frequency of every 30 min, and the model generated forecasts with a horizon of 48 steps, also equivalent to one day with the same sampling frequency. The objective is to provide a reliable 24 h forecast for both CO2 and temperature, based solely on their behavior in the preceding 24 h.
The selection of the prediction horizon emerged as a critical aspect, as its extension directly impacts the inherent complexity of the model and the associated prediction error. Considering these factors, we have assessed that a viable middle ground would be to establish a sampling frequency every 30 min, which would equate to 48 samples for the entire day. It is noteworthy that opting for a one-minute sampling frequency would increase the prediction horizon to 86,400 for the same day. While this alternative offers greater granularity, it simultaneously entails a substantial increase in the model’s complexity and the margin of error associated with the prediction.
Figure 5a,b display the results obtained during the model training process for the variables CO2 and temperature, respectively.
As part of the analysis of CO2 samples acquired by the developed device, we processed over 200,000 samples, each acquired at a 60 s interval. However, for the prediction task, the model operated with a 30 min interval between samples, allowing us to evaluate its performance across various temporal horizons. The data for processing were acquired from the platform of the developed ventilation monitoring system, Thingsboard. In Figure 6, a screenshot of the cloud visualization platform and the data obtained from the sensors can be observed.
Initially, the proposed model was trained using all the acquired data. The process of running the trained model unfolded as follows: Every 30 min, a dataset frame was automatically sent from the cloud (Thingsboard 3.6) to the server, updating the information related to the behavior of CO2 and temperature during the previous 24 h. Subsequently, the model predicted the behavior of CO2 and temperature for the next 24 h. Figure 7 and Figure 8 provide screenshots of the obtained results using a sliding window and a 24 h temporal horizon. It is important to note that the results displayed in Figure 7 and Figure 8 were continuously updated as the server processed incoming samples.
After evaluating the model, an error value of 13.8160 ppm was obtained for the 24 h forecasts of CO2 and 0.4623 °C for temperature.
Additionally, Table 1 displays the metrics obtained during the model’s training evaluation. These metrics provide insights into the efficiency and accuracy of the proposed model for predictions of environmental variables.

4. Discussion: Comparison with Other Methods

In order to verify the effectiveness of the proposed architecture in this work, we conducted a comparative analysis with other models from previous research. The comparison includes the following architectures: long short-term memory (LSTM), convolutional neural network (CNN), gated recurrent unit (GRU), and two hybrid variants of the LSTM and CNN architectures.
The models used for the comparative study were trained on the same carbon dioxide and temperature data obtained from Universitat Politècnica de València. The early-stopping method was applied to prevent overfitting.
It is important to acknowledge the limitations of our method, which include the need for meticulous hyperparameter selection and the model’s sensitivity to the quality of data collection. Additionally, the performance of our model is highly influenced by the specific characteristics of indoor environments, and its generalizability to different contexts requires further investigation. Our model has been trained with data from UPV facilities; therefore, it only reflects the seasonal characteristics and trends of this specific center.
In pursuit of identifying the most effective configuration for each neural network architecture, comprehensive hyperparameter tests were conducted utilizing the Optuna tool. All models utilize Adam as the optimization algorithm, chosen for its efficiency. Presented below is a representative sample of the conducted trials; it is important to note that each model underwent over 50 trials (Table 2).
The ultimately chosen LSTM model consists of two layers: the initial layer incorporates 64 neurons, followed by a second layer with 32 neurons. Additionally, the model employs a dropout rate of 0.5 and was trained with a learning rate set to 0.001. It is noteworthy that the standardization of the number of neurons in the models was implemented using commonly adopted values such as 32, 64, and 128. This approach ensures a level of consistency and facilitates comparisons with established practices in the field.
On the other hand, Table 3 provides a comprehensive overview of the optimization trials conducted for the convolutional neural network (CNN). This table encapsulates the iterative process undertaken to fine-tune the CNN model, showcasing various configurations and hyperparameter settings explored during the optimization phase. The presented information in Table 3 offers insights into the diverse trials executed to enhance the performance and efficiency of the CNN architecture, providing a valuable reference for understanding the evolution and selection of optimal configurations for the model.
The ultimately chosen convolutional neural network (CNN) model exhibits a refined architecture that contributes to its robust performance. This final configuration encompasses a singular convolutional layer, strategically designed with 64 neurons to capture intricate patterns within the input data. Complementing this, a dense layer consisting of 128 neurons enhances the model’s ability to distill complex features and representations. To promote generalization and mitigate overfitting, a dropout rate of 0.4 has been implemented, strategically discarding a fraction of neurons during training. The learning rate, set to 0.004, plays a pivotal role in optimizing the model’s convergence during the training process. This carefully tailored combination of architectural elements and hyperparameter settings reflects a meticulous optimization process aimed at maximizing the CNN’s effectiveness in extracting relevant features from the input data. As mentioned previously, the advanced LSTM–CNN hybrid model introduces a sophisticated architecture that synergizes the strengths of both long short-term memory (LSTM) and convolutional neural network (CNN) components. This hybrid framework incorporates two LSTM layers, each comprising 32 neurons, facilitating the model’s ability to capture sequential dependencies and long-term patterns in the input data. In addition, a convolutional layer with 128 neurons is integrated into the architecture, strategically positioned to extract hierarchical features and spatial relationships from the input sequences. The model’s learning dynamics were finely tuned, with a learning rate set to 0.0002, optimizing the convergence speed during the training process. To mitigate the risk of overfitting and enhance generalization, a dropout rate of 0.5 was implemented, introducing stochasticity by randomly deactivating neurons during training. This multifaceted configuration underscores a meticulous design aimed at harnessing the complementary strengths of LSTM and CNN components for enhanced predictive capabilities in complex data analysis scenarios (Table 4).
Building upon the preceding analyses, the ultimate iteration of the CNN-LSTM model represents a refined and carefully calibrated architecture. This culminating configuration features a dual-layered convolutional component, strategically designed to extract hierarchical features from the input data. The initial convolutional layer boasts 128 neurons, allowing for the nuanced capture of complex patterns, followed by a second layer with 32 neurons to further distill essential information. Complementing this, a singular long short-term memory (LSTM) layer with 32 neurons enhances the model’s capacity to discern and remember temporal dependencies within sequential data. To foster generalization and guard against overfitting, a dropout rate of 0.4 has been implemented, introducing controlled randomness during training. Additionally, the learning rate has been meticulously set to 0.003, optimizing the model’s convergence speed during the training process.
Figure 9 illustrates that for both the carbon dioxide and temperature models, the error minimization curve during training exhibits a shallower slope in the proposed model compared to the other evaluated architectures.
On the other hand, in Figure 10, in terms of validation loss metrics, the proposed model demonstrates superior performance and lower errors. While temperature initially exhibits a high error and slower convergence, its error minimization is also more significant compared to other methods.
The results demonstrate that the architecture proposed in this work, utilizing a hybrid model with modifications in the pooling layer structure, yields superior CO2 and temperature data forecasts. Table 5 and Table 6 summarize the obtained results in terms of validation losses, quantifying the total number of errors in the validation set.
The preceding outcomes were attained employing data spanning from March 2022 to March 2023. Subsequently, the ensuing results are presented herein, utilizing data from March 2022 to November 2023, with the intent of corroborating our experiment. This substantial augmentation of data imparts valuable insights to the models regarding the temporal trends’ behavior.
Below, the training and validation plots for the models CO2 and temperature are shown. These plots offer a visual representation of the training process, illustrating how the models evolve over successive epochs. The training plots typically show the model’s performance on the training dataset, indicating how well it is learning from the provided data. In parallel, the validation plots demonstrate how effectively the model generalizes to unseen data, providing insights into its overall performance and potential for accurate predictions beyond the training set (Figure 11 and Figure 12).
The following table presents the evaluation metrics for different models, providing insights into their performance on a specific task. According to the obtained results for CO2:
  • LSTM: This model has an R2 of 0.3409, indicating moderate predictive performance. It has relatively low MAE and MSE, suggesting accurate predictions, and a response time of 0.4019.
  • GRU: The GRU model shows similar predictive performance to LSTM (R2: 0.3353), with slightly higher MAE and MSE. It has a faster response time of 0.3499.
  • CNN: This model performs slightly better with an R2 of 0.3584 and the lowest MAE and MSE among individual models. The response time is 0.3697.
  • CNN + LSTM: Combining the CNN and LSTM yields a good R2 of 0.3535, comparable to individual models. The response time is higher at 0.6684.
  • Proposed model: The proposed model stands out with the highest R2 (0.3812) among the presented models, indicating improved predictive performance. It achieves this while maintaining a low MAE and MSE. The response time is 0.4171, demonstrating a reasonable balance between accuracy and computational efficiency.
In summary, the proposed model shows promising results, outperforming the other models in terms of R2 while maintaining competitive MAE, MSE, and response time.
In Table 7, it is shown that the proposed model shows an R2 of 0.3812 on the CO2 dataset. It is crucial to consider that indoor CO2’s time series exhibits high volatility, posing challenges for models to capture data variance. Additionally, it is noteworthy that in this work the study was conducted in a univariate manner, considering solely past values of the series. This indicates that while the proposed model shows promise with the achieved R2, the volatile nature of indoor CO2 levels presents a challenge in accurately capturing its behavior. Moreover, our focus on univariate analysis solely based on past values might limit the model’s ability to account for additional influential factors affecting CO2 levels.
On the other hand, in the obtained results using the temperature variable it can be seen that the proposed model demonstrates the best overall performance, outperforming other models in terms of R2, MAE, and MSE while maintaining a reasonable response time (Table 8).
The following Figure 13 and Figure 14 showcase specific instances of predictions produced by the models regarding CO2 data. This presentation involves providing concrete examples of the outcomes yielded by the models, demonstrating their proficiency in forecasting CO2 levels. These examples may encompass detailed results of the models’ predictions, aiming to illustrate and quantify their accuracy in predicting the dynamics of CO2 concentrations. To enhance comprehension, visualizations or in-depth descriptions of these predictions could be included, providing a more nuanced insight into how effectively the models perform in capturing the intricacies of CO2 variations. Such detailed presentations contribute to a more comprehensive evaluation of the models’ performance in the specific context of predicting CO2 levels.

5. Conclusions

This study has presented the outcomes of predictive analysis involving CO2 and temperature values using a novel hybrid neural network architecture. The developed predictive model for high-frequency time series aims to assess the behavior of these variables and their potential impact on indoor spaces’ occupant performance when ventilation levels are insufficient. The novelty of our model lies in its omission of the pooling layer to prevent information loss within the network. Notably, we achieved favorable results up to 48 time steps into the future with a 30 min sampling interval.
Some studies [37] performed real-time analysis on data with intervals of 10 min or even 1 h; however, our model is capable of making predictions for complex time series, such as indoor environmental variables (CO2 and temperature), with a sampling interval of 30 min.
Our model operates by synchronizing with a cloud-based data server, ensuring continuous forecasting. Furthermore, the proposed architecture offers optimization flexibility concerning data window size and the prediction time horizon. These findings highlight the model’s potential for improving indoor air quality and supporting decision-making for maintaining optimal environmental conditions.

Author Contributions

Conceptualization, M.E.I.M. and P.F.d.C.; methodology, J.G.-C. and F.G.P.; software, C.A.R.P. and E.B.; validation, C.A.R.P., M.E.I.M. and P.F.d.C.; formal analysis, H.M.Á. and M.E.I.M.; investigation, C.A.R.P. and E.B.; resources, F.G.P., H.M.Á. and M.E.I.M.; data curation, F.G.P., E.B. and J.G.-C.; writing—original draft preparation, C.A.R.P.; writing—review and editing, H.M.Á., M.E.I.M. and P.F.d.C.; visualization, J.G.-C.; supervision, F.G.P. and P.F.d.C. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Data Availability Statement

Data are contained within the article.

Acknowledgments

Miguel E. Iglesias Martínez’s research was supported by a postdoctoral research scholarship titled ‘Ayudas para la Recualificación del Sistema Universitario Español 2021–2023, Modalidad: Margarita Salas’, funded by the UPV, Ministerio de Universidades, Plan de Recuperación, Transformación y Resiliencia, Spain, and made possible by the European Union Next Generation EU. P.F.d.C. acknowledges partial support from the Spanish government via projects PID2021-128676OB-I00 and PID2022-142407NB-I00 (AGENCIA ESTATAL DE INVESTIGACIÓN). The authors would like to express their gratitude for the invaluable support and facilities provided by the Galician Supercomputing Center (CESGA: https://www.cesga.es/ in the period of 10 January 2023–30 June 2023) for conducting modeling calculations.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Alberts, W.M. Indoor air pollution: NO, NO2, CO, and CO2. J. Allergy Clin. Immunol. 1994, 94 Pt 2, 289–295. [Google Scholar] [CrossRef] [PubMed]
  2. Parajuli, I.; Lee, H.; Shrestha, K.R. Indoor air quality and ventilation assessment of rural mountainous households of Nepal. Int. J. Sustain. Built Environ. 2016, 5, 301–311. [Google Scholar] [CrossRef]
  3. Central Pollution Control Board & ASEM-GTZ. Conceptual Guidelines and Common Methodology for Air Quality Monitoring, Emission Inventory & Source Apportionment Studies for Indian Cities; Parivesh Bhawan: Delhi, India, 2006. [Google Scholar]
  4. Batterman, S. Review and extension of CO2-based methods to determine ventilation rates with application to school classrooms. Int. J. Environ. Res. Public Health 2017, 14, 145. [Google Scholar] [CrossRef] [PubMed]
  5. Satish, U.; Mendell, M.J.; Shekhar, K.; Hotchi, T.; Sullivan, D.; Streufert, S.; Fisk, W.J. Is CO2 an indoor pollutant? Direct effects of low-to-moderate CO2 concentrations on human decision-making performance. Environ. Health Perspect. 2012, 120, 1671–1677. [Google Scholar] [CrossRef] [PubMed]
  6. Medidores de CO2 de alta precisión con conexión a internet. Control de calidad del aire. Available online: https://ruc.udc.es/dspace/handle/2183/30387 (accessed on 15 September 2023).
  7. Rudnick, S.N.; Milton, D.K. Risk of indoor airborne infection transmission estimated from carbon dioxide concentration. Indoor Air 2003, 13, 237–245. [Google Scholar] [CrossRef]
  8. Wang, J.; Spicher, N.; Warnecke, J.M.; Haghi, M.; Schwartze, J.; Deserno, T.M. Unobtrusive Health Monitoring in Private Spaces: The Smart Home. Sensors 2021, 21, 864. [Google Scholar] [CrossRef]
  9. Franco, A.; Schito, E. Definition of Optimal Ventilation Rates for Balancing Comfort and Energy Use in Indoor Spaces Using CO2 Concentration Data. Buildings 2020, 10, 135. [Google Scholar] [CrossRef]
  10. Matos, P.; Vieira, J.; Rocha, B.; Branquinho, C.; Pinho, P. Modeling the provision of air-quality regulation ecosystem service provided by urban green spaces using lichens as ecological indicators. Sci. Total Environ. 2019, 665, 521–530. [Google Scholar] [CrossRef]
  11. Ministry for the Environment. Good-Practice Guide for Air Quality Monitoring and Data Management; Ministry for the Environment: Wellington, New Zealand, 2000.
  12. Cincinelli, A.; Martellini, T. Indoor air quality and health. Int. J. Environ. Res. Public Health 2017, 14, 1286. [Google Scholar] [CrossRef]
  13. Kim, T.; Kim, H.Y. Forecasting stock prices with a feature fusion LSTM-CNN model using different representations of the same data. PLoS ONE 2019, 14, e0212320. [Google Scholar] [CrossRef]
  14. Zaytar, M.A.; El Amrani, C. Sequence to sequence weather forecasting with long short-term memory recurrent neural networks. Int. J. Comput. Appl. 2016, 143, 7–11. [Google Scholar]
  15. Jain, A.K.; Mao, J.; Mohiuddin, K.M. Artificial neural networks: A tutorial. Computer 1996, 29, 31–44. [Google Scholar] [CrossRef]
  16. Papadatou-Pastou, M. Are connectionist models neurally plausible? A critical appraisal. Encephalos 2011, 48, 5–12. [Google Scholar]
  17. Huang, C.-J.; Kuo, P.-H. A deep CNN-LSTM model for particulate matter (PM2.5) forecasting in smart cities. Sensors 2018, 18, 2220. [Google Scholar] [CrossRef] [PubMed]
  18. Hu, C.; Wu, Q.; Li, H.; Jian, S.; Li, N.; Lou, Z. Deep learning with a long short-term memory networks approach for rainfall-runoff simulation. Water 2018, 10, 1543. [Google Scholar] [CrossRef]
  19. Liu, Y.; Li, D.; Wan, S.; Wang, F.; Dou, W.; Xu, X.; Li, S.; Ma, R.; Qi, L. A long short-term memory-based model for greenhouse climate prediction. Int. J. Intell. Syst. 2022, 37, 135–151. [Google Scholar] [CrossRef]
  20. Liu, Y.; Pei, A.; Wang, F.; Yang, Y.; Zhang, X.; Wang, H.; Dai, H.; Qi, L.; Ma, R. An attention-based category-aware GRU model for the next POI recommendation. Int. J. Intell. Syst. 2021, 36, 3174–3189. [Google Scholar] [CrossRef]
  21. Liu, Y.; Song, Z.; Xu, X.; Rafique, W.; Zhang, X.; Shen, J.; Khosravi, M.R.; Qi, L. Bidirectional GRU networks-based next POI category prediction for healthcare. Int. J. Intell. Syst. 2021, 37, 4020–4040. [Google Scholar] [CrossRef]
  22. Qing, X.; Niu, Y. Hourly day-ahead solar irradiance prediction using weather forecasts by LSTM. Energy 2018, 148, 461–468. [Google Scholar] [CrossRef]
  23. Karevan, Z.; Suykens, J.A.K. Transductive LSTM for time-series prediction: An application to weather forecasting. Neural Netw. 2020, 125, 1–9. [Google Scholar] [CrossRef]
  24. Salman, A.G.; Heryadi, Y.; Abdurahman, E.; Suparta, W. Single Layer & Multi-layer Long Short-Term Memory (LSTM) Model with Intermediate Variables for Weather Forecasting. Procedia Comput. Sci. 2018, 135, 89–98. [Google Scholar] [CrossRef]
  25. Azzouni, A.; Pujolle, G. A long short-term memory recurrent neural network framework for network traffic matrix prediction. arXiv 2017, arXiv:170505690. [Google Scholar]
  26. Sepp, H.; Juergen, S. LSTM can solve hard long time lag problems. Adv. Neural Inf. Process. Syst. 1996, 9, 473–479. [Google Scholar]
  27. Gers, F.A.; Schmidhuber, J.; Cummins, F. Learning to Forget: Continual Prediction with LSTM. Neural Comput. 2000, 12, 2451–2471. [Google Scholar] [CrossRef] [PubMed]
  28. Khan, S.; Rahmani, H.; Shah, S.A.A.; Bennamoun, M. A guide to convolutional neural networks for computer vision. Synth. Lect. Comput. Vis. 2018, 8, 1–207. [Google Scholar]
  29. Qin, J.; Pan, W.; Xiang, X.; Tan, Y.; Hou, G. A biological image classification method based on improved CNN. Ecol. Inform. 2020, 58, 101093. [Google Scholar] [CrossRef]
  30. Nasir, J.A.; Khan, O.S.; Varlamis, I. Fake news detection: A hybrid CNN-RNN based deep learning approach. Int. J. Inf. Manag. Data Insights 2021, 1, 100007. [Google Scholar] [CrossRef]
  31. Qiao, Y.; Wang, Y.; Ma, C.; Yang, J. Short-term traffic flow prediction based on 1DCNN-LSTM neural network structure. Mod. Phys. Lett. B 2020, 35, 2150042. [Google Scholar] [CrossRef]
  32. Cheng, J.; Liu, Y.; Ma, Y. Protein secondary structure prediction based on integration of CNN and LSTM model. J. Vis. Commun. Image Represent. 2020, 71, 102844. [Google Scholar] [CrossRef]
  33. Li, P.; Abdel-Aty, M.; Yuan, J. Real-time crash risk prediction on arterials based on LSTM-CNN. Accid. Anal. Prev. 2020, 135, 105371. [Google Scholar] [CrossRef]
  34. Kim, T.-Y.; Cho, S.-B. Predicting residential energy consumption using CNN-LSTM neural networks. Energy 2019, 182, 72–81. [Google Scholar] [CrossRef]
  35. Livieris, I.E.; Pintelas, E.; Pintelas, P. A CNN–LSTM model for gold price time-series forecasting. Neural Comput. Appl. 2020, 32, 17351–17360. [Google Scholar] [CrossRef]
  36. Faruque, O.; Rabby, A.J.; Hossain, A.; Islam, R.; Rashid, M.U.; Muyeen, S. A comparative analysis to forecast carbon dioxide emissions. Energy Rep. 2022, 8, 8046–8060. [Google Scholar] [CrossRef]
  37. Oh, S.; Song, S. Detailed Analysis of Thermal Comfort and Indoor Air Quality Using Real-Time Multiple Environmental Monitoring Data for a Childcare Center. Energies 2021, 14, 643. [Google Scholar] [CrossRef]
Figure 1. Architecture of the LSTM–CNN neural network used.
Figure 1. Architecture of the LSTM–CNN neural network used.
Mathematics 11 04872 g001
Figure 2. Final layer operations of the proposed architecture.
Figure 2. Final layer operations of the proposed architecture.
Mathematics 11 04872 g002
Figure 3. Block diagram of the developed device.
Figure 3. Block diagram of the developed device.
Mathematics 11 04872 g003
Figure 4. General system architecture.
Figure 4. General system architecture.
Mathematics 11 04872 g004
Figure 5. Training models: (a) CO2 model training; (b) temperature model training.
Figure 5. Training models: (a) CO2 model training; (b) temperature model training.
Mathematics 11 04872 g005
Figure 6. Screenshot of the cloud visualization platform and the obtained data from the sensors.
Figure 6. Screenshot of the cloud visualization platform and the obtained data from the sensors.
Mathematics 11 04872 g006
Figure 7. Screenshot of the obtained results of the proposed CO2 model using the hybrid LSTM–CNN architecture.
Figure 7. Screenshot of the obtained results of the proposed CO2 model using the hybrid LSTM–CNN architecture.
Mathematics 11 04872 g007
Figure 8. Screenshot of the results obtained from the hybrid LSTM–CNN architecture-based temperature model.
Figure 8. Screenshot of the results obtained from the hybrid LSTM–CNN architecture-based temperature model.
Mathematics 11 04872 g008
Figure 9. Training models comparison: (a) CO2 training loss; (b) temperature training loss.
Figure 9. Training models comparison: (a) CO2 training loss; (b) temperature training loss.
Mathematics 11 04872 g009
Figure 10. Validation models comparison: (a) CO2 validation loss; (b) temperature validation loss.
Figure 10. Validation models comparison: (a) CO2 validation loss; (b) temperature validation loss.
Mathematics 11 04872 g010
Figure 11. The training and validation plots of the model for CO2.
Figure 11. The training and validation plots of the model for CO2.
Mathematics 11 04872 g011
Figure 12. The training and validation plots of the model for temperature.
Figure 12. The training and validation plots of the model for temperature.
Mathematics 11 04872 g012
Figure 13. Predictions for (a) LSTM model and (b) GRU model.
Figure 13. Predictions for (a) LSTM model and (b) GRU model.
Mathematics 11 04872 g013
Figure 14. Predictions for (a) CNN model, (b) CNN-LSTM model, and (c) proposed model.
Figure 14. Predictions for (a) CNN model, (b) CNN-LSTM model, and (c) proposed model.
Mathematics 11 04872 g014
Table 1. Metrics of the model during its evaluation.
Table 1. Metrics of the model during its evaluation.
MetricsCarbon DioxideTemperature
MAE13.39250.6062
RMSE19.2680.880
MAPE3.26905.3623
Table 2. LSTM Optuna trials.
Table 2. LSTM Optuna trials.
LSTM
Layers
LSTM Units Layer 1LSTM Units Layer 2LSTM Units Layer 3Dropout RateLearning RateValidation Error
34817500.330.000060.00482
2394200.220.00760.005
2453100.210.00530.0051
2176400.360.000080.0047
32616390.480.000020.007
35941340.50.0030.0051
32152320.20.00260.0049
31643340.430.00070.0047
2184700.690.00450.00468
133000.420.000010.0068
129000.570.000090.00469
2246200.330.000130.005
2356400.320.00020.0054
135000.520.00030.0047
2526200.560.00020.0048
2585600.380.00060.0048
151000.270.00010.0047
2645700.390.000040.005
144000.320.00070.0049
Table 3. CNN Optuna trials.
Table 3. CNN Optuna trials.
CNN LayersCNN
Units
Layer 1
CNN Units Layer 2CNN Units Layer 3Kernel SizeDense UnitsLearning RateValidation Error
2485905220.00430.005
33823383810.000010.006
1280021250.0010.0047
120002250.000020.0048
1440021180.0010.0046
35225242530.000010.0056
117004910.0010.0050
34838413950.0020.0051
2521904520.00040.0048
2581703960.000010.0052
117005610.000010.0046
1290041270.00990.0048
1280041070.0010.0051
1260041020.00090.0050
2226404780.00010.0047
135005950.00070.0049
21644041070.00040.0047
124003680.00020.0048
133005830.00040.0048
Table 4. LSTM–CNN Optuna trials.
Table 4. LSTM–CNN Optuna trials.
LSTM LayersLSTM Units
Layer 1
LSTM Units
Layer 2
LSTM Units
Layer 3
CNN
Layers
CNN Units
Layer 1
CNN Units
Layer 2
CNN Units
Layer 3
Dropout RateLearning RateValidation Error
336203237129000.500.00020.0047
286226035962180.580.0040.0052
114400121000.660.00060.0044
116900151000.240.0010.0044
32982290130000.600.0030.0045
35027199137000.310.00840.0049
11100031744450.550.0010.0054
2174640116000.230.0060.0049
2249230033551180.200.00020.0050
31061821802516300.640.0010.0050
1220002241800.680.000010.0072
1168002482700.410.00010.0048
116100149000.420.000070.0044
113800146000.460.000070.0044
1206002443100.430.000050.0049
21371470161000.380.00020.0044
177002553500.490.00010.0047
21981190143000.360.000030.0045
1123002644700.470.00040.0046
Table 5. Validation loss of the proposed model compared to other models.
Table 5. Validation loss of the proposed model compared to other models.
ModelCO2 Validation LossTemperature Validation Loss
LSTM0.011240.00934
GRU0.009960.00986
CNN0.009030.00690
CNN + LSTM0.010880.01021
Proposed Model0.007120.00622
Table 6. Metrics of the updated model during its evaluation.
Table 6. Metrics of the updated model during its evaluation.
ModelCO2 Validation LossTemperature Validation Loss
LSTM0.004630.00231
GRU0.004500.00172
CNN0.004660.00212
CNN + LSTM0.004540.00227
Proposed Model0.004340.00164
Table 7. Metrics of the models on CO2 data.
Table 7. Metrics of the models on CO2 data.
ModelR2MAEMSEResponse Time
LSTM0.34090.04550.00460.4019
GRU0.33530.04690.00470.3499
CNN0.35840.04460.00450.3697
CNN + LSTM0.35350.04520.00450.6684
Proposed Model0.38120.04460.00430.4171
Table 8. Metrics of the models on temperature data.
Table 8. Metrics of the models on temperature data.
ModelR2MAEMSEResponse Time
LSTM0.79750.03000.00180.6842
GRU0.81110.02790.00170.2536
CNN0.79370.03050.00180.6831
CNN + LSTM0.74710.03320.00231.3325
Proposed Model0.83210.02510.00150.7657
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Reyes Pérez, C.A.; Iglesias Martínez, M.E.; Guerra-Carmenate, J.; Michinel Álvarez, H.; Balvis, E.; Giménez Palomares, F.; Fernández de Córdoba, P. Indoor Air Quality Analysis Using Recurrent Neural Networks: A Case Study of Environmental Variables. Mathematics 2023, 11, 4872. https://doi.org/10.3390/math11244872

AMA Style

Reyes Pérez CA, Iglesias Martínez ME, Guerra-Carmenate J, Michinel Álvarez H, Balvis E, Giménez Palomares F, Fernández de Córdoba P. Indoor Air Quality Analysis Using Recurrent Neural Networks: A Case Study of Environmental Variables. Mathematics. 2023; 11(24):4872. https://doi.org/10.3390/math11244872

Chicago/Turabian Style

Reyes Pérez, Carlos A., Miguel E. Iglesias Martínez, Jose Guerra-Carmenate, Humberto Michinel Álvarez, Eduardo Balvis, Fernando Giménez Palomares, and Pedro Fernández de Córdoba. 2023. "Indoor Air Quality Analysis Using Recurrent Neural Networks: A Case Study of Environmental Variables" Mathematics 11, no. 24: 4872. https://doi.org/10.3390/math11244872

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop