# The Impacts of Open Data and eXplainable AI on Real Estate Price Predictions in Smart Cities
## 2 Materials and Methods
### Methods
#### 2.2.1 Extreme Gradient Boosting
In this study, we employ the eXtreme Gradient Boosting (XGBoost) algorithm, a highly performant and robust tree-based machine learning method developed by [PERSON] and [PERSON] [71], for predicting real estate prices [72, 73]. XGBoost, an advanced implementation of [PERSON]'s Gradient Tree Boosting algorithm [74], excels due to its unique combination of bagging and boosting techniques for ensemble learning. The bagging component enhances model stability and accuracy by training multiple models in parallel with independent sampling. The boosting aspect sequentially generates trees, with each new tree aiming to rectify the shortcomings of its predecessor, thereby incrementally improving the model's accuracy. This dual approach makes XGBoost particularly effective and widely adopted in research and industry, suitable for diverse applications, including regression and classification problems [75]. The XGBoost algorithm employs an objective function that combines a loss function for assessing prediction error and a regularization component that imposes penalties on model complexity to prevent overfitting. This combination is crucial for maintaining the balance between bias and variance. The loss function (\(l\)) measures how well the model's predictions match the actual data. For classification problems, it could be a log loss function, and for regression problems, it might be a mean squared error or another suitable metric. The regularization term (\(\Omega\)) is the part of the objective function that penalizes complexity, which helps to prevent overfitting. This term is made up of two parts: one that penalizes the number of leaves in the trees (\(\gamma T\)) and another that penalizes the magnitude of the leaf weights (\(\frac{1}{2}\lambda\|w\|^{2}\)), where \(\gamma\) and \(\lambda\) are regularization parameters. The combination of these two elements constitutes the XGBoost objective function and is formally represented as [71]:  
\[L(\phi)=\sum_{i}l(g_{i},y_{i})+\sum_{k}\Omega(f_{k}) \tag{1}\]  
where \(\Omega(f)=\gamma T\ +\frac{1}{2}\lambda\|w\|^{2}\). This composite objective function aims to find a balance between fitting the model accurately to the training data (minimizing the loss function) while keeping the model simple enough to generalize well to unseen data (minimizing the regularization term). This dual-component objective function ensures a balance between model complexity and predictive performance, which is crucial to the effectiveness of the XGBoost algorithm. The algorithm's performance is primarily influenced by its hyperparameters, including \"gamma\", which controls regularization on the tree's leaves; \"n_estimators\", which specifies the number of trees to be built; and \"max_depth\", which determines the depth of each tree and is essential in controlling overfitting. These hyperparameters control model complexity, thus influencing the trade-off between bias and variance and, ultimately, the model's predictive prowess on unseen data. One can significantly enhance the model's predictive capabilities by fine-tuning these hyperparameters. The interplay of these hyperparameters with the loss reduction and regularization terms allows XGBoost to enhance its performance adaptively with each iteration, effectively handling various predictive modeling tasks. Moreover, XGBoost enables parallel tree boosting to expedite computational processes, which not only quickens the training speed but also ensures more efficient employment of hardware resources, thereby enhancing overall model training throughput and scalability [71].