# A Practical and Adaptive Approach to Predicting Indoor CO2
## 4 Methodology  
### Neural Network Architecture  
A 1-dimensional convolutional neural network (CNN) was used as the deep learning architecture. 1D CNNs, which find applications in natural language processing (NLP) [15], in network security [16] and in other domains, are able to automatically analyze and extract features from a single spatial dimension (in our case, time) by means of convolution operations [17], hence learning in-depth patterns among data. From a computational point of view, they guarantee good performance by using a shallow structure and advanced features, such as weight sharing, and have the possibility of using a small amount of data for training the model [18] without significantly impacting the accuracy. Unlike other types of neural networks (e.g., recurrent neural networks) proposed in the literature [9; 11], 1D \begin{table}
\begin{tabular}{c c c c c} \hline \hline
**Related Work** & **Dataset Size** & **Input Variables** & **AI Architecture** & **Automated Model** \\  & & & & **Update** \\ \hline
**This Work** & **Adaptive (Max 30 days)** & **Temperature, Humidity, CO\({}_{2}\)** & **1D CNN** & **Yes** \\ \hline [PERSON] et al. [7] & One year & Temperature, humidity, time, date & Random Forest & No \\ \hline [PERSON] et al. [8] & 242 days & CO\({}_{2}\), weekday, hour, minute & ANN & No \\ \hline [PERSON] et al. [9] & Six months & Fine dust, light amount, VOC, CO\({}_{2}\), temperature & GRU & No \\  & & and humidity & & \\ \hline [PERSON] et al. [10] & One year & CO\({}_{2}\), PIR, temperature and humidity & Ridge, Decision Tree, Random Forest, MLP & No \\ \hline [PERSON] et al. [11] & One week & Indoor NO\({}_{2}\), wind speed, wind direction, number of student & LSTM & No \\ \hline [PERSON] et al. [12] & One week & CO\({}_{2}\) & ANN & No \\ \hline [PERSON] et al. [13] & One week & CO\({}_{2}\), humidity, temperature & MLP & No \\ \hline [PERSON] et al. [14] & Six months & Temperature, humidity & MLP & No \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Summary of the SoA. CNNs are less computationally demanding [19], making them suitable for limited-power and resource-constrained devices. The neural network architecture was developed using Keras [20], the framework built on TensorFlow platform (version 2.4.0), and Python (version 3.7.3), following specific guidelines to adapt 1D CNN for time-series forecasting [21]. The proposed CNN architecture, depicted in Figure 2, consists of the following layers:  
* _Input layer_. A sample consists of the values of the input environmental variables (i.e., temperature, humidity and CO\({}_{2}\)) covering a window of n quarters of an hour. Basically, a sample is a data matrix of size \(n\times f\), where n is the number of quarters of an hour and f is the number of features. This kind of approach is possible due to the temporal nature of environmental variables. Indeed, the values of temperature, humidity or CO\({}_{2}\) at close time intervals are correlated with each other. Before feeding the neural network, the input values are normalized by defining a maximum and minimum value for each variable. * _1D Convolutional Layer_. It is devoted to analyzing and extracting features along the time-dimensional axis of the input data. This layer outputs a matrix of size \((n-h+1)\times k\) in which each column is a feature vector extracted through so-called convolutional filters or kernels. Each of these \(k\) kernels slides over the input matrix with a step equal to 1 and performs a convolution operation to extract the most significant local information. The common rectified linear activation function (i.e., \(ReLU(x)=max(0,x)\) is used to extract non-linearity patterns from data. * _Max Pooling layer_. It aims to learn most valuable information from extracted feature vectors by applying a subsampling operation to the output matrix from the CNN layer.