# A Data-Driven Model for the Energy and Economic Assessment of Building Renovations
## 2 Materials and Methods  
To systematically address the challenges associated with the energy transition of existing buildings, it is crucial to adopt advanced methodological approaches. The construction sector, particularly the residential sector, is characterized by a high degree of heterogeneity in terms of geometry, construction technologies, ages of buildings, and operating conditions. This makes it particularly difficult to compare energy performance and identify effective, sustainable retrofit strategies. In this context, a data-driven approach that integrates artificial intelligence techniques, statistical modeling, and economic analysis is a powerful and innovative method for objectively and reproducibly addressing the complexity of the issue. ML techniques are selected for their ability to identify complex, non-linear relationships within multidimensional, potentially incomplete datasets. These techniques overcome the limitations of traditional deterministic approaches, which are often constrained by simplifying assumptions or limited generalizability. Two main tools were adopted in particular: a supervised regression algorithm (the random forest regressor), which was used to estimate the relative importance of building variables with respect to annual energy consumption; and an unsupervised learning algorithm (k-means clustering), which was aimed at classifying buildings into homogeneous groups based on similar characteristics and consumption profiles. As an ensemble model, the random forest is based on the aggregation of multiple decision trees built on different subsamples of the dataset. It is distinguished by its high predictive accuracy, robustness to noise in the data, and ability to handle non-linear relationships without requiring particular assumptions about the distribution of variables. It is therefore particularly well-suited to analyzing complex phenomena such as energy in the building sector, where interactions between architectural, plant, and behavioral variables are difficult to model using conventional analytical approaches. Meanwhile, k-means clustering was employed to categorize the building sample into distinct energy digital representative buildings by minimizing intra-cluster distance and maximizing group separability. This process identified recurring building types characterized by homogeneous energy behavior, providing an empirical basis for developing targeted intervention strategies adaptable to specific contexts. The quality of the clustering was validated by analyzing the silhouette coefficient to ensure the internal consistency and significance of the identified groups. Finally, to ensure an integrated approach, the results of the predictive and classification analyses were combined with a multi-intervention economic assessment to estimate the financial viability of the main retrofit strategies. This assessment was based on real technical and economic data obtained from official regional sources and classic economic indicators were used: net present value (NPV), ROI, and payback period. Thus, the proposed approach enables objective, replicable comparisons to be made between the energy and economic benefits of the proposed measures, providing an operational tool for planning interventions at urban or territorial scales. This study employed a comprehensive data-driven methodology integrating algorithms, statistical modeling, and economic analysis to investigate energy consumption patterns in residential buildings and evaluate the cost-effectiveness of retrofit interventions. The primary aim is to identify key factors influencing energy usage, cluster buildings based on their consumption profiles, and assess economic sustainability for different retrofit strategies.