# Optimizing Energy Forecasting Using ANN and RF Models for HVAC and Heating Predictions
## 3 Results and Discussions
### Actual and Predicted Energy Demand
Figure 6a shows a boxplot comparing real HVAC (Heating, Ventilation, and Air Conditioning) demand with ANN and RF model predictions. Using a box plot allowed us to see the entire distribution or spread of the data, which offers us some insight into how each model performed when forecasting HVAC demand. The box plot comparing the actual data with the ANN model shows a tighter spread and less variability than the actual data. With respect to the box plot, the median prediction from the ANN recursive neural network model was very close to the actual data and captured the 'center' of HVAC demand, as other researchers in predictive modeling call it. In fact, the IQR (interquartile range) for the predicted demand values of the ANN model were tighter than the actual data. This implies that the ANN model had reduced variability overall and better predictions of HVAC demand. Figure 6b illustrates the differences in the distributions of real heating demand values with the predicted heating demand values from the ANN and RF models. Real heating demand ranges from 0 to just over 35, reaching a 50 th percentile (median) of about 5 kWh. Real heating demand exhibits high variability. The predicted heating demand by the ANN is more centralized with a smaller interquartile range (IQR). In addition, the median predicted value sits closer to the median of true heating demand. This suggests that the ANN model captured heating demand patterns well. The RF model had similarities to the ANN model but had more variability and more extreme values with a larger IQR. Although its median value is also around 5 kWh, it is not as centralized as the ANN model. The analysis in this study helps to assess model performance and shows when the output of the ANN and RF models can be used for improvement assessments when predicting the heating demand of the FUHEM Building. The cumulative distribution function (CDF) analysis reveals strong agreement between actual HVAC demand and predictions from both ANN and RF models in Figure 7. The characteristic S-shaped curves demonstrate that HVAC demand predominantly falls within  
Figure 6: Box plot: actual vs. predicted demand: (**a**) (LUCIA Building, nZEB-HVAC), (**b**) (FUHEM Building-Heating). moderate ranges, with relatively few extreme values observed. Both machine learning models successfully capture this distribution pattern, with their prediction curves closely following the empirical data. This close alignment indicates robust predictive capability for HVAC demand across both approaches. While the models show comparable overall performance, subtle differences in their CDF curves emerge, particularly in how they handle the upper and lower tails of the distribution. These variations likely stem from fundamental differences in how each algorithm processes noise and nonlinear relationships within the dataset. The ANN model appears slightly more responsive to demand fluctuations at distribution extremes, while the RF maintains a more consistent performance across the central range of values. Such nuanced performance characteristics may inform model selection depending on specific application requirements. Residuals play a vital role in assessing how well the models predict HVAC demand and their overall accuracy. Below, we discuss each curve and its implications for HVAC demand in detail. Most residuals are close to zero, indicated by a prominent peak at zero on the horizontal axis. Since the predicted values generally fall within a narrow range of the actual values, we can conclude that both models effectively forecast HVAC demand. The histogram for the ANN model is distinct, featuring a larger and narrower peak on the left compared to the RF model on the right, as shown in Figure 8. This indicates that the ANN model has fewer and less varied residuals overall. These findings suggest that the ANN model is better suited for high-precision applications, such as real-time HVAC or energy management. Figure 8: Histogram of residuals for LUCIA Building, nZEB-HVAC. Figure 7: CDF for LUCIA Building, nZEB-HVAC.