Shear strength (SS) parameters are essential for understanding the mechanical behavior of materials, particularly in geotechnical engineering and rock mechanics. This study proposes a novel hierarchical ensemble model (HEM) to predict SS parameters: cohesion (C) and angle of internal friction (ϕ). The HEM addresses the limitations of traditional machine learning models. Its performance was validated using leave-one-out cross-validation (LOOCV) and out-of-bag (OOB) evaluation methods. The model’s accuracy was assessed with R-squared correlation (R2), absolute average relative error percentage (AAREP), Taylor diagrams, and quantile–quantile plots. The computational results demonstrated that the proposed HEM outperforms previous studies using the same database. The model predicted ϕ andC with R2 values of 0.93 and 0.979, respectively. The AAREP values were 1.96% for φ and 4.7% forC. These results indicate that the HEM significantly improves the prediction quality of ϕ andC, and exhibits strong generalization capability. Sensitivity analysis revealed that σ_3maxσ3max (maximum principal stress) had the greatest impact on modeling both ϕ andC. According to uncertainty analysis, the LOOCV and OOB had the widest uncertainty bands for the ϕ andC parameters, respectively