## 5 Machine Learning Algorithms  
Maintaining optimal indoor environmental conditions is critical to the well-being of occupants. Accurate monitoring of temperature, relative humidity and understanding of occupancy plays a critical role in providing predictive information for optimal management of heating and cooling systems. This is particularly important in the absence of a building management system (BMS). As a final aspect of the study, indoor air quality was analyzed, focusing on CO\({}_{2}\) levels to assess occupancy status. The method used involved defining CO\({}_{2}\) thresholds, pre-processing the collected data and using algorithms to estimate occupancy, with temperature and humidity controlled to avoid external influences. The critical threshold of 600 ppm CO\({}_{2}\) was set as an indication of inadequate ventilation. Data pre-processing, essential for the continuity and integrity of the analysis, included the elimination of missing values and appropriate format conversions. A specific algorithm has been implemented to estimate occupancy based on CO\({}_{2}\) levels, assuming that each individual contributes 40 ppm CO\({}_{2}\) to the reference concentration. Analysis of the severity of CO\({}_{2}\) critical threshold exceedances makes it possible to visualize the periods when air quality is compromised and to correlate this data with the estimated occupancy of space. This assessment is crucial to understanding the impact of air quality on occupant health and comfort. In the second part of the study, the focus shifted to indoor environmental standards such as temperature and humidity, which are critical to maintaining a healthy and energy-efficient environment. The monitoring of these parameters was integrated with machine learning algorithms such as Long Short-Term Memory (LSTM) networks, a class of recurrent neural networks (RNNs) that are particularly efficient at processing sequential data, to accurately predict future energy consumption, thereby optimizing energy use and reducing operating costs. Energy consumption forecasting uses historical data to identify patterns over time, training LSTM models to recognize seasonal variations and daily cycles. The model was then validated through error analysis and graphical visualizations showing the accuracy of the prediction against real data. In summary, this approach has demonstrated the potential of LSTM networks to handle complex temporal data and provides a methodological framework for efficient energy management in buildings without advanced management systems. Based on the state-of-the-art studies, a list of machine learning models for data analysis is proposed below. The schematic in Figure 4 shows the different models that are suitable to meet the requirements of the DT system. It should be noted that the following is a proposal, and the effectiveness of the solution can only be assessed after a data acquisition and training phase. This list is broader than the project objective and not all the proposed prediction models will be developed and integrated into the Digital Twin system. The data architecture consists of a network of interconnected nodes structured into three distinct layers: a physical layer, a machine learning (ML) layer and a physical action layer. The physical layer contains the primary physical data collected from sensors, while  
Figure 4: Machine Learning architecture. the ML layer processes and extracts relevant information from the physical data. The physical action layer is responsible for defining the main outputs and actions of the DT system. Data generated as input/output by a particular node or model can subsequently serve as input to the next node within the architecture. The selection of ML techniques is based on an extensive review of the relevant literature and is outlined below:  
* Air quality can be assessed using a Gradient Boosting Regression (GBR) model in conjunction with SHapley Additive exPlanations (SHAP).