The deep learning method faces the challenges of small sample data and high dimensional shield operational parameters in predicting the longitudinal surface settlement caused by shield excavation. In this study, various optimization algorithms were compared, and the slime mould algorithm (SMA) was optimally chosen to optimize the hyperparameters of random forest (RF), and SMA-RF was used for dimensionality reduction and feature contribution analysis. A double-input deep neural network (D-DNN) framework was proposed for the prediction of surface settlement, which considers the influence of twin tunnels and effectively increases the high-fidelity data in the database. The results show that SMA performs best among various optimization algorithms; employing features that have a cumulative contribution value exceeding 90% as input can result in high prediction accuracy; there is significant uncertainty in the feature contribution analysis for small sample data; the reduced shield running parameters show a strong nonlinear relationship with surface settlement; compared with S-DNN, D-DNN takes into account the excavation of twin tunnels and expands the database capacity by more than 1.5 times, with an average increase of 27.85% in the R2 and an average decrease of 53.2% in the MAE.