# A Data-Driven Model for the Energy and Economic Assessment of Building Renovations
## 3 Results
### Feature Importance Analysis by Random Forest  
Understanding which building features most significantly influence energy consumption is fundamental to developing effective retrofit strategies and making informed policy decisions. To address this, a random forest regressor model has been employed to analyze the predictive contribution of architectural and occupancy-related characteristics to the total  
Figure 2: A correlation matrix between building design parameters and their energy consumption. annual energy consumption (measured in kWh/m\({}^{2}\)/year). In scenarios where datasets are limited or not large enough to support the training of complex models, such as deep learning (DL) architectures or ensemble methods, simple statistical models have proven effective for decision making on energy consumption [29]. The analysis was conducted across a combined dataset of residential buildings from the years 2022 and 2023 (refer to the Github of Energy4 Rome \"[[https://github.com/zahraziran/Energy4](https://github.com/zahraziran/Energy4) Rome]([https://github.com/zahraziran/Energy4](https://github.com/zahraziran/Energy4) Rome) (accessed on 10 July 2025)\". Key features included the number of floors, number of dwellings, average dwelling size, total occupancy, surface area, wall and glass heat transfer coefficients (U-values), percentage of glass surface, floor spacing, and surface-to-volume ratio. These variables were selected for their direct relevance to thermal performance and spatial efficiency, all of which are known to affect a building's energy profile. To enhance the robustness and transparency of the ML approach, we performed systematic hyperparameter tuning of the random forest model using a grid search method. Key parameters--such as the number of estimators (100, 200, 500), maximum tree depth (10, 20, 30, none), minimum samples per split (2, 5, 10), and feature selection criteria (\"sqrt\", \"log2\")--were optimized through 5-fold cross-validation on the training set. Model performance was assessed using R\({}^{2}\), mean absolute error (MAE), and root mean squared error (RMSE). The final model achieved an R\({}^{2}\) of 0.91, an MAE of 4.23 kWh/m\({}^{2}\)/year, and an RMSE of 6.71 kWh/m\({}^{2}\)/year on the test data, indicating strong predictive accuracy. To ensure methodological rigor and evaluate the robustness of our predictive framework, the random forest model has been benchmarked against three alternative ML algorithms commonly used in energy modeling: gradient boosting (XGBoost), support vector regression (SVR), and a multilayer perceptron (MLP). Among these, XGBoost achieved slightly higher predictive performance (R\({}^{2}\) = 0.93, MAE = 4.12), but its implementation required significantly more computational resources, complex parameter tuning, and lacked native interpretability. SVR and MLP produced lower accuracy (R\({}^{2}\) = 0.86 and 0.89, respectively) and demonstrated higher sensitivity to feature scaling and initialization settings. The random forest model, by contrast, provided an optimal trade-off between accuracy, stability, and explainability. After systematic hyperparameter tuning using a grid search approach and 5-fold cross-validation, the final model achieved strong performance on the test set: R\({}^{2}\) = 0.91, MAE = 4.23 kWh/m\({}^{2}\)/year, and RMSE = 6.71 kWh/m\({}^{2}\)/year. The model was trained using an 80/20 split between training and testing data and consisted of an ensemble of 100 decision trees. Random forest's non-parametric nature, robustness to multicollinearity and outliers, and capacity to model non-linear relationships without requiring distributional assumptions made it especially suitable for the diverse and heterogeneous nature of building energy datasets. Furthermore, the ability of random forest to directly compute interpretable feature importance rankings is a key advantage in retrofit applications, where stakeholders demand both predictive performance and transparent justification for decisions.