Abstract
Despite the growing reliance on machine learning (ML) models in hydraulic applications, it remains essential to compare both optimized and non-optimized models (regardless of their novelty) to identify the most accurate and reliable predictor. In this study, we developed ML models to predict the discharge coefficient (Cw) of Piano Key Weirs (PKWeirs), using experimental data collected from our own lab tests. A total of six models were evaluated, including baseline and optimized versions of NGBoost and XGBoost, as well as Random Forest and a hybrid M5’-IWOA model, with optimization performed using bio-inspired algorithms (MPA and OOA). The comparative analysis revealed the clear superiority of optimized NGBoost and XGBoost models, which achieved outstanding performance (R² > 0.999, RMSE ≤ 0.0125), significantly outperforming their non-optimized counterparts. To ensure transparency and assess real-world robustness, we validated all models using an independent external dataset not included in our experimental database. The optimized models maintained strong accuracy (R² > 0.90), while others showed noticeable degradation, especially under extreme or noisy conditions. This work highlights the importance of comparing enhanced and standard models, and of validating them with external data for unbiased performance assessment. Additionally, a PyQt6-based interface was developed to facilitate user interaction and real-time predictions.