Without rigorous testing, it is challenging to predict the compressive strength of concrete directly from the mix ratio. This study explored an optimal method for predicting the compressive strength of concrete based on various ensemble machine learning methods. The database was collected from real projects, using the Mahalanobis distance to verify database quality. Firstly, the background of ensemble machine learning techniques was presented typically represented by random forest (RF), the adaptive boosting algorithm (AdaBoost), the gradient boosting regression tree (GBRT), extreme gradient boosting(XGBoost), the light gradient boosting machine (LightGBM), the categorical boosting algorithm (CatBoost). Secondly, the K-fold cross-validation (K-fold CV) and Tree-structured Parzen Estimator (TPE) algorithm were applied to find the optimal hyperparameter combinations for the models. Then, the models were compared with the individual machine learning models by using four evaluation indexes, including the root mean squared error (RMSE), mean absolute error (MAE), mean absolute percentage error (MAPE), and the coefficient of determination (R2), results showed that the LightGBM model achieved the best comprehensive performance. The SHapley Additive exPlanations (SHAP) approach was used to produce both global and local explanations for the predictions of the LightGBM model. And a graphical user interface (GUI) was developed to offer users a useful tool. Finally, a conditional generative adversarial network (cGAN) was applied to address the issue of database scarcity or the lack of data for a specific concrete strength grade in the database.