Countries must establish an effective early warning system to predict financial crises in order to avoid their catastrophic effects. To this end, we construct early warning systems based on the logistic model and seven machine learning methods, and we also use the Shapley value decomposition and Shapley regression to explore the causality of the machine learning methods. By comparing the performance of different early warning models in out-of-sample tests, we find that the machine learning models, especially the random forest, gradient boosting decision tree, and ensemble models, outperform the logistic model in terms of providing early predictions of financial crises. In addition, the Shapley value can be used to find more effective predictive indicators and analyze the causes of risks in different countries to a certain extent, enabling policymakers to supplement the policy toolbox to deal with such crises. Thus, we suggest that machine learning methods should be considered when establishing early warning systems to predict financial crises in the future.