# The Impacts of Open Data and eXplainable AI on Real Estate Price Predictions in Smart Cities
## 3 Results
### Model Training and Optimization  
Our analysis employs an XGBoost model trained on an 80-20 train-test split in our modeling process. The model undergoes training using the training dataset, and Optuna is employed for hyperparameter optimization. Within Optuna, the objective function utilizes 10-fold cross-validation to compute the model's Mean Absolute Error (MAE) with the best hyperparameters found. The data are randomized before fold-splitting, ensuring that each fold is a representative mix of the whole dataset, thus improving the robustness and reliability of the cross-validation process and effectively preventing any order-based biases during the data division process. In shuffling the data, a fixed Hitchhiker's 42 random seed was set to ensure reproducible results. The model is trained and evaluated during each cross-validation fold, and the MAE is calculated. Optuna intelligently searches the hyperparameter space, and the objective function reports intermediate results and determines if a trial should be pruned based on performance, speeding up the optimization process. Early stopping is also used to prevent overfitting during training. This method divides the dataset into ten subsets (or folds). The model is trained on nine of these folds and tested on the remaining one. This process is repeated ten times, each time with a different fold used as the test set, and the MAE is calculated for each iteration. The average MAE across all folds is then used as a criterion for optimization, and it measures how close the model's predictions are to the actual values, with a lower MAE indicating the better performance of the model. Optuna's objective is to identify a combination of hyperparameters that minimize this average MAE. This iterative process is optimized over 100 trials. Each trial involves training a model with a different set of hyperparameters to see which combination yields the best performance, evaluated by its MAE score. Once the best-performing model (i.e., the best set of hyperparameters) is identified in each trial, this model is then retrained on the entire training dataset. This approach validates model performance and guarantees the model's robustness. After 100 trials are completed, the overall best model is selected--the one with the best MAE performance across all trials. This model is considered the most optimal and is used for further testing and evaluation. The model with the most optimal hyperparameter set is then used to make predictions on the test dataset to evaluate the model's performance on unseen data. Predictions are made, and the model's performance is thoroughly evaluated using the metrics MAE, MAPE, RMSE, and R\({}^{2}\) computed for the test set. Additionally, residuals were analyzed to diagnose potential issues in predictions. The above predictive analytics pipeline, involving training, hyperparameter tuning, and evaluation for an XGBoost model, was thus first used to develop a Baseline Model containing the seven features derived from proprietary data. Building on the Baseline Model, we retrained the XGBoost model by integrating 18 additional features from open data sources. Like the Baseline Model, the Open Data Model underwent the same pipeline. The Baseline and Open Data Models are thus instantiations of the same XGBoost model. Additionally, for both models, we conducted a fine-tuning process with several runs to refine the hyperparameter space further and curb overfitting by iteratively adjusting the ranges based on the previous best values found, considering the individual importance of each hyperparameter. This process allowed the optimization algorithm to fine-tune the hyperparameters more closely. The goal was to balance model complexity with its generalization ability to unseen data, achieving a balance between performance and avoidance of overfitting.