Abstract Deep learning models are widely used for urban flood prediction, but current research lacks a clear explanation of how indicator weight changes affect model accuracy. This study incorporated the attention mechanism between the convolutional and fully connected layers of the convolutional neural network (CNN) to enable the model to focus on critical flood-inducing factors, and employed the particle swarm optimization (PSO) to optimize the key hyperparameters (for example, the number of filters and learning rate). Furthermore, we employed Shapley additive explanation (SHAP) to analyze how flood-inducing indicator weight changes affect prediction accuracy. The model was tested on Haidian Island, China. The Nash-Sutcliffe efficiency (NSE) coefficient of the CNN model is 0.9287. After incorporating the attention mechanism into the CNN and optimizing the hyperparameters using PSO, the NSE is improved to 0.9503. The model demonstrates higher accuracy in predicting larger inundations, with the NSE for the 100-year return-period flood reaching 0.9535, compared to 0.8341 for the 5-year return period. Interpretability analysis shows that elevation is the most important flood-inducing factor, accounting for 44% of the total importance, followed by tidal levels, which account for 33%. The attention mechanism increases the weights of important flood-inducing factors (for example, elevation, tide level); after hyperparameter optimization, the model achieves more comprehensive learning, increasing the weights of the rainfall indicators that are neglected by the unoptimized model, and these weight changes improve the accuracy of the model. The research revealed the impacts of different flood-inducing factors on flooding and the influence of indicator weight changes on model accuracy.
Xu et al. (Tue,) studied this question.