## 5 Results
### Performance Comparison of Random Forest and LSTM  
In flood risk forecasting, it is crucial to utilize machine learning models that deliver accurate predictions while also capturing the underlying dynamics of the data. The model employed in this analysis was Random Forest (RF), validated through comparison with Long Short-Term Memory (LSTM), a model widely recognized for time series forecasting. Figure 13: Flood risk map of Calopinace. To ensure a comprehensive evaluation, the model performance was assessed using multiple metrics tailored to both regression and classification approaches. Specifically, Mean Squared Error (MSE), Root Mean Squared Error (RMSE), and R\({}^{2}\) were employed to quantify the prediction error and explanatory power of the model, ensuring robust numerical evaluation of risk levels. Additionally, given the ordinal nature of flood risk categories (low, moderate, high, very high), classification-oriented metrics were integrated, including accuracy, precision, recall, and F1-score. These indicators provide further insights into the model's ability to correctly classify risk levels, addressing potential misclassifications between adjacent categories and reinforcing the reliability of the predictions. This approach ensures that the continuous and categorical aspects of flood risk estimation are effectively captured, enhancing model interpretability and robustness. Valuation metrics such as MSE, RMSE, and R\({}^{2}\) provide important insights into forecasting model performance. The comparison of the metric values between the two models, as shown in Figure 14, revealed that the following:  
Mean Squared Error (MSE):  
RF: 0.014  
LSTM: 0.1502  
Root Mean Squared Error (RMSE):  
RF: 0.118  
LSTM: 0.3876  
R-squared (R\({}^{2}\)):  
RF: 0.80  
LSTM: 0.757  
The RF model's mean squared error (MSE) is notably lower than that of the LSTM, indicating that RF makes fewer prediction errors. Similarly, the root mean squared error (RMSE) for RF is lower, confirming its higher accuracy. Moreover, the R-squared (R\({}^{2}\)) value for the RF model is slightly higher than that of the LSTM, suggesting that RF better explains the variance in the data. Figure 14: Comparative Metrics RF vs. LSTM. In the light of the fact that more metrics were obtained, it was possible to make a detailed comparison between the Random Forest and LSTM models, the results of which are summarized in Figure 15.  
Accuracy: The Random Forest model (0.89) outperforms the LSTM (0.85), demonstrating a greater overall ability to correctly classify risk levels. This is particularly relevant in real-world scenarios, where any errors can have significant operational consequences. Precision: Random Forest (0.91) exhibits higher accuracy than LSTM (0.88), reducing the likelihood of false alarms and helping to avoid unnecessary intervention. Recall: Also in terms of sensitivity, Random Forest (0.87) proves to be more effective than LSTM (0.83), being more suitable for risk management, where it is essential not to underestimate situations of real danger. F1-score: Random Forest (0.89) maintains a better balance between accuracy and recall than LSTM (0.84), making it more reliable in contexts where it is important to correctly balance false positives and false negatives. Comparing the Random Forest (RF) and Long Short-Term Memory (LSTM) models, it becomes clear that the RF model significantly outperforms the LSTM regarding predictive accuracy. In the context analyzed, the Random Forest model proves to be more effective in classifying flood risk than the LSTM model. The comparison between Random Forest and LSTM was conducted with the following three objectives in mind:  
* To verify the validity of the Random Forest model against a more advanced model like LSTM. * To identify the strengths and weaknesses of each model. * To determine the most suitable model for flood risk prediction in the context of this study. The performance differences can be attributed to several factors.