The issuing of credit is the main source of income for Banks, but the borrower's default will bring huge losses to Banks. How to effectively evaluate and identify the borrower's potential default risk and calculate the borrower's default probability before issuing loans is the foundation and important link of modern financial institutions' credit risk management. This paper mainly studies the statistical analysis of the historical data of Banks and other financial institutions by using the idea of non-equilibrium data classification, and establishes the model of loan default by using the random forest algorithm. Experimental results show that neural network and random forest algorithm outperform decision tree and logistic regression classification algorithm in predicting performance. Moreover, the stochastic forest model can be used to rank the importance of features, which intuitively reflects the important reference value of different data of borrowers, so as to effectively judge the risk of lending in the financial field.