## 4 Methodology
### Feature Extraction  
The emphasis here is on minimizing and simplifying the data provided to the models to accurately represent the underlying thermodynamic processes to the machine learning model. This approach is aimed at improving the model's performance and accuracy.  
From Equation (2), \(\Delta T=T_{system}-T_{env}\), where \(T_{env}\) represents the temperature of the environment, which is the temperature toward which the system tends at any given moment. Consequently, a new variable called _tendency_ is defined. This variable aims to capture the temperature toward which the system's temperature is expected to tend, taking into account the HVAC instructions and the current state of the system. To accurately define this new variable, it is necessary to understand the HVAC system's logic and the conditions under which the HVAC should be activated or deactivated.  
Typically, acclimatized rooms operate based on a straightforward rule: if the temperature drops below the set point, the HVAC system is activated, and if the temperature exceeds the set point, the HVAC system is deactivated. This rule is implemented with considerable precision, incorporating both an upper and a lower threshold. When heating the room, the system continues to heat until the temperature reaches the set point plus the upper threshold. Conversely, when the HVAC system is off, the room cools down until the temperature falls below the set point minus the lower threshold. Figure 3 illustrates this oscillating state as the room is heated.  
With each change in the direction of the oscillation, the room tends toward a specific temperature. When the room is being heated, it tends toward the temperature of the air pumped by the HVAC system. When it is cooling down, it tends toward the outdoor temperature. A challenge arises when the temperature is located between the thresholds: with only one point, it is impossible to determine whether the temperature should increase or decrease. To resolve this and determine the direction of the temperature, the closest previous point is examined, and the slope between them is calculated. A positive slope indicates that the room's temperature will tend toward the air pumped by the HVAC, while a negative slope suggests it will tend toward the exterior temperature. Based on this understanding, the general Algorithm 1 is defined in the function room_tendency.  
Figure 3: Representation of oscillating room temperature between upper and lower thresholds while HVAC status is ON. This figure does not contain any real data and is used only as a support for visual representation of the oscillating behavior of room temperature.  
Algorithm 1 shows the general function that should follow the tendency temperature of a room, while also returning the HVAC status for energy consumption prediction. This serves as a universal formula but may need adjustments based on the specific requirements of each system. The computational cost of executing this function is \(\mathcal{O}(n_{samples})\).  
The objective is to simplify the features provided to the model, ensuring alignment with those used in Equation (2). Consequently, the final set of features for a generic one-room system with an air conditioner should include all relevant heat sources, the temperatures of adjacent spaces that significantly impact the target room (e.g., exterior temperature), and the temperature tendency.