## 3 Results and Discussion
### Comparison of FTSW Prediction Using the LSTM Model Performance with Other Models  
The LSTM model with a seven-day look-back and a one-day output length was compared with the RF, SVR, and Linear Regression (LR) models. To achieve the optimal performance of the RF and SVR models for the dataset, the hyperparameters of the RF model were selected using a random grid search. The hyperparameters selected for RF and SVR are listed in Table 8. Note that Sqrt indicates that the maximum number of features is equal to the Square root of the number of features. Table 9 shows the performance of BiLSTM, RF, SVM, and LR on the Colinas do Douro and Quinta de Pancas test datasets. In general, the BiLSTM model performed better on both sets of test data. This was expected given that evapotranspiration directly affects soil moisture [60; 61] and that the BiLSTM model prioritizes this variable. RF achieved the second-best performance, and the most-valuable performance was achieved with LR. Since the relationship between the FTSW and the other independent variables is not linear, LR was expected to achieve the best performance. Moreover, the \(R^{2}\) score of the BiLSTM model on Quinta de Pancas decreased by 8% compared to the \(R^{2}\) score of the BiLSTM model on Colinas do Douro, while this deterioration for RF and SVR was more than 16%. Therefore, the BiLSTM model performed better on the unobserved data and generalized better to the unseen data. Figure 11: Comparison between observed and predicted values of the FTSW at Quinta de Pancas. \begin{table}
\begin{tabular}{c c c c} \hline \hline  & **SVR** & & **RF** \\
**Hparam** & **Value** & **Hparam** & **Value** \\ \hline C & 1.83 & n\_estimators & 118 \\ kernel & RBF & bootstrap & False \\ bootstrap & False & & \\ gamma & scale & max depth & 110 \\ epsilon & 0.26 & max\_features & Sqrt \\ - & - & Min samples leaf & 2 \\ - & - & Min samples split & 2 \\ \hline \hline \end{tabular}
\end{table} 
Table 8: Hyperparameters selected for RF and SVR using random grid search. To better assess the results, the two best models, i.e., BiLSTM and RF, were compared in terms of feature selection and model variance. First, these two models were compared in terms of feature importance. The permutation feature importance technique was used for both models to investigate which feature was more important in predicting the FTSW by each model. Figure 12a,b show the importance of each feature with the LSTM model and RF, respectively. As the figure shows, in the BiLSTM model, the most-important feature was the ETo and then the month, but in RF, the month was selected as the most-important feature and the ETo as the third-most-important feature for predicting the FTSW. The ETo had the strongest correlation (\(-0.56\)) with the FTSW, and LSTM correctly captured this correlation, noting that it was the most-important feature between the independent variables. This fact showed that LSTM was more reliable at predicting the FTSW than RF. Moreover, in both models, the irrigation amount was more important than rainfall. The reason was that, during the irrigation period (summer period), the variations in the FTSW were mainly caused by the water added by irrigation, as rainfall was very low or even absent. Figure 13 shows an example (2019) of the irrigation events (black triangles), rainfall, and the FTSW (0-80 cm). As can be seen in the figure, the irrigation events had a greater impact on the soil moisture than rainfall. Figure 12: (**a**) shows the importance of the input features for predicting the FTSW with the BiLSTM model, and (**b**) shows the importance of the input features for predicting the FTSW with the RF model. The shift of a feature causing the most changes in the RMSE shows the importance of the feature.