Weirs are important hydraulic structures widely used to control the flow rates in open channels and rivers. The discharge coefficient is a vital parameter in computing flow rate over weirs. In this work, we introduce the Walnut algorithm, a new nature-inspired optimization strategy. Then, it is combined with support vector regression (SVR) to predict the discharge coefficient parameter of triangular labyrinth weirs. The proposed Walnut-SVR method takes a set of observations as inputs specified by five non-dimensional features and attempts to find the discharge coefficient of unseen records. Walnut algorithm is proposed for feature selection, and optimum values of SVR parameters are found. The proposed method is evaluated using the Kumar dataset and compared with several counterpart methods. The results show the superiority of the Walnut-SVR method compared to other counterparts with R-2 = 0.986, RMSE = 0.004, SI = 0.006, sigma = 0.858, and NSE = 0.981 on test dataset. Feature analysis shows that the proposed method obtained the best results when three geometric parameters, the ratio of the weir crest length to the weir height (L/w), the ratio of head over the crest to the weir height (h/w), and the vertex angle (theta) are used.