<?xml version="1.0" encoding="UTF-8"?><!DOCTYPE article  PUBLIC "-//NLM//DTD Journal Publishing DTD v3.0 20080202//EN" "http://dtd.nlm.nih.gov/publishing/3.0/journalpublishing3.dtd"><article xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:xlink="http://www.w3.org/1999/xlink" dtd-version="3.0" xml:lang="en" article-type="research article"><front><journal-meta><journal-id journal-id-type="publisher-id">IIM</journal-id><journal-title-group><journal-title>Intelligent Information Management</journal-title></journal-title-group><issn pub-type="epub">2160-5912</issn><publisher><publisher-name>Scientific Research Publishing</publisher-name></publisher></journal-meta><article-meta><article-id pub-id-type="doi">10.4236/iim.2022.145011</article-id><article-id pub-id-type="publisher-id">IIM-120102</article-id><article-categories><subj-group subj-group-type="heading"><subject>Articles</subject></subj-group><subj-group subj-group-type="Discipline-v2"><subject>Computer Science&amp;Communications</subject></subj-group></article-categories><title-group><article-title>
 
 
  Machine Learning Approaches to Predict Loan Default
 
</article-title></title-group><contrib-group><contrib contrib-type="author" xlink:type="simple"><name name-style="western"><surname>Wanjun</surname><given-names>Wu</given-names></name><xref ref-type="aff" rid="aff1"><sub>1</sub></xref><xref ref-type="corresp" rid="cor1"><sup>*</sup></xref></contrib></contrib-group><aff id="aff1"><label>1</label><addr-line>Bytedance Data Analysis Group, Beijing, China</addr-line></aff><pub-date pub-type="epub"><day>28</day><month>09</month><year>2022</year></pub-date><volume>14</volume><issue>05</issue><fpage>157</fpage><lpage>164</lpage><history><date date-type="received"><day>11,</day>	<month>August</month>	<year>2022</year></date><date date-type="rev-recd"><day>25,</day>	<month>September</month>	<year>2022</year>	</date><date date-type="accepted"><day>28,</day>	<month>September</month>	<year>2022</year></date></history><permissions><copyright-statement>&#169; Copyright  2014 by authors and Scientific Research Publishing Inc. </copyright-statement><copyright-year>2014</copyright-year><license><license-p>This work is licensed under the Creative Commons Attribution International License (CC BY). http://creativecommons.org/licenses/by/4.0/</license-p></license></permissions><abstract><p>
 
 
  Loan lending plays an important role in our everyday life and powerfully promotes the growth of consumption and the economy. Loan default has been unavoidable, which carries a great risk and may even end up in a financial crisis. Therefore, it is particularly important to identify whether a candidate is eligible for receiving a loan. In this paper, we apply Random Forest and XGBoost algorithms to train the prediction model and compare their performance in prediction accuracy. In the feature engineering part, we use the variance threshold method and Variance Inflation Factor method to filter out unimportant features, and then we input those selected features into Random Forest and XGBoost models. It turns out that Random Forest and XGBoost show little difference in the accuracy of their predictions since both get high accuracy of around 0.9 in the loan default cases.
 
</p></abstract><kwd-group><kwd>Machine Learning</kwd><kwd> Random Forest</kwd><kwd> Loan Default</kwd><kwd> Prediction Model</kwd></kwd-group></article-meta></front><body><sec id="s1"><title>1. Introduction</title><p>Loan lending plays an important role in our everyday life and powerfully promotes the growth of consumption and the economy [<xref ref-type="bibr" rid="scirp.120102-ref1">1</xref>]. Taking a loan has been inevitable for people since individuals around the world depend on loans to overcome financial constraints to achieve their personal goals, and organizations rely on loans to expand their production [<xref ref-type="bibr" rid="scirp.120102-ref2">2</xref>]. In most cases, loan lending is beneficial to both the borrowers and the lenders. However, loan default is still unavoidable, which carries a great risk and may even end up in a financial crisis. Therefore, it is particularly important to identify whether a candidate is eligible for receiving a loan.</p><p>In the past, the evaluation primarily depended on manual review, which was time-consuming and labor-intensive [<xref ref-type="bibr" rid="scirp.120102-ref3">3</xref>]. Recently, banks have opted for machine learning approaches to automatically predict the loan default since it can highly enhance the accuracy and the efficiency of the prediction. On the one hand, banks can collect a massive amount of transaction data due to the prosperity of online shopping and mobile payments. On the other hand, machine learning models are rapidly evolving and have successful applications in various fields, motivating the bank industry to use them to predict loan default. Researchers have found that Random Forest performed better than other models such as logistic regression, decision trees, and support vector machines in some loan lending cases [<xref ref-type="bibr" rid="scirp.120102-ref4">4</xref>]. We will also apply XGBoost to predict the loan default to make a comprehensive comparation since XGBoost is one of the most advanced methods for machine learning that has been developed in recent years [<xref ref-type="bibr" rid="scirp.120102-ref5">5</xref>].</p><p>In this paper, based on the loan default data provided by Imperial College London, we predict whether a loan will default, as well as the loss incurred if it does default. We choose Random Forest and XGBooost to build the prediction model and decide which one performs better.</p><p>The rest of this paper is organized as follows. Section 2 describes the characteristics of the raw data and shows the methodology of this paper, including feature engineering and introductions of Random Forest and XGBooost. In Section 3 we show the experiment process of applying models and evaluate the results. Finally, we draw our conclusion and discuss the potential applications of our outcomes in Section 4.</p></sec><sec id="s2"><title>2. Literature Review</title><p>At present, researchers generally use machine learning methods to predict loan defaults, including Logistic Regression, Decision Trees, Random Forest, XGBoost, and other advanced techniques.</p><p>The main advantages of Logistic Regression lie in its simple understanding, sturdy performance, and easy implementation [<xref ref-type="bibr" rid="scirp.120102-ref6">6</xref>]. Logistic Regression naturally outperforms Linear Regression in predicting the probability of loan default since its outcome contains a continuous range of grades between 0 and 1, which represents the likelihood of an event occurring [<xref ref-type="bibr" rid="scirp.120102-ref7">7</xref>]. Han used Logistic Regression and Cox proportional hazard algorithm to predict student loan default, whose findings indicated that the main affected factors that led to student loan default lie in age, household income, monthly repayable amount, and the college major. The Logistic Regression model that they developed gained an AUC of 0.697 for the test data, which showed the accuracy and robustness of LR [<xref ref-type="bibr" rid="scirp.120102-ref8">8</xref>].</p><p>Decision Trees generates a structure like a tree by classifying the instances and using recursive portioning algorithm [<xref ref-type="bibr" rid="scirp.120102-ref7">7</xref>]. Each leaf node represents a class label and branches present the outcomes for the test, which are represented by internal nodes for an attribute [<xref ref-type="bibr" rid="scirp.120102-ref9">9</xref>]. In order to predicting the businesses’ past due in service accounts, Wang developed models using Logistic Regression and Decision Trees in SAS and compared their results. It turned out that Decision Trees outperformed Logistic Regression when there were small amount of attributes in a large enough sample [<xref ref-type="bibr" rid="scirp.120102-ref10">10</xref>].</p><p>Random Forest runs by constructing multiple decision trees while training and outputting the class that is the mode of the classes output by individual trees, which outperformed single decision trees [<xref ref-type="bibr" rid="scirp.120102-ref11">11</xref>]. Malekipirbazari and Aksakalli built a Random Forest based classification model to identify high-quality peer-to-peer borrowers. They compared the different machine learning techniques and found out that the Random Forest based model performed significantly better than the FICO credit scores [<xref ref-type="bibr" rid="scirp.120102-ref4">4</xref>].</p><p>XGBoost has been shown to achieve state-of-art results on many machine learning tasks. It is an improvement of Gradient Boosting algorithm and a decision tree based on the gradient boosting algorithm. Li constructed an XGBoost-based model to predict peer-to-peer loan default and compare its outcome with Logistic Regression and Decision Trees. The results indicated that the accuracy of the XGBoost-based model achieved 97.705%, which fitted the actual results better [<xref ref-type="bibr" rid="scirp.120102-ref12">12</xref>].</p></sec><sec id="s3"><title>3. Experiment</title><p>The framework of our experiment process is shown in <xref ref-type="fig" rid="fig1">Figure 1</xref>.</p><sec id="s3_1"><title>3.1. Data Processing</title><p>First, we take a quick look at the whole data. The dataset provided by Imperial College London includes 105,471 records and 771 columns, containing customers’ ids, 778 features, and the loss of the record. The detailed description is shown in <xref ref-type="table" rid="table1">Table 1</xref>.</p><p>Next, we clean the NAs in the dataset. There are 525 columns containing NAs. When dealing with the numeric columns, we fill those NAs with the average of the columns.</p><table-wrap id="table1" ><label><xref ref-type="table" rid="table1">Table 1</xref></label><caption><title> The detailed description of the dataset, including the columns and the data types</title></caption><table><tbody><thead><tr><th align="center" valign="middle" >Columns</th><th align="center" valign="middle" >Description</th></tr></thead><tr><td align="center" valign="middle" >id</td><td align="center" valign="middle" >The ids of customers. Float type.</td></tr><tr><td align="center" valign="middle" >F1, F2, …, F778</td><td align="center" valign="middle" >Different features of the customer behaviors. Numeric types.</td></tr><tr><td align="center" valign="middle" >Loss</td><td align="center" valign="middle" >The loss incurred. Float type. Note: If the record does default, the number shows the severity of the loss that result. If there is no default, the number is 0.</td></tr></tbody></table></table-wrap></sec><sec id="s3_2"><title>3.2. Feature Engineering</title><p>Feature selection aims to drop those redundant columns which contain little useful information and reduce the number of input features when developing an effective model.</p><p>First, we use the variance threshold method to quickly filter out those columns whose variance equals 0, since those columns do not contain useful information for classification. After applying the variance threshold method, we get 760 columns left.</p><p>Second, we apply Variance Inflation Factor method to reduce multicollinearity. Multicollinearity inflates unnecessarily the standard errors of the coefficients, and increased standard errors indicates that the coefficients of some features might be close to 0, which will make some features insignificant when they should be significant. A useful way to measure multicollinearity is Variance Inflation Factor (VIF). If no features are correlated, the VIF will be 1. If the VIF is greater than 10, it shows that the regression coefficients are poorly estimated due to multicollinearity [<xref ref-type="bibr" rid="scirp.120102-ref13">13</xref>]. In this paper, we remove all those features whose VIF is greater than 10.</p><p>After filtering features by the variance threshold method and the VIF, we have 419 columns left.</p></sec><sec id="s3_3"><title>3.3. Model Training &amp; Testing Data</title><p>In this paper, we apply Random Forest and XGBoost algorithms to train the model and compare their performance in prediction accuracy. Empirical studies show that the best results are obtained if we use 20% - 30% of the data for testing, and the remaining 70% - 80% of the data for training [<xref ref-type="bibr" rid="scirp.120102-ref14">14</xref>]. Thus, we separate the dataset randomly into 2 parts. The first part is the training dataset, which contains 80% data, and the remaining 20% of data belong to the testing dataset. We use the training dataset to train the model and use the testing dataset to evaluate the efficiency of the model.</p><sec id="s3_3_1"><title>3.3.1. Random Forest</title><p>Random Forest is a decision tree based supervised learning algorithm, which implements the classification by constructing multiple decision trees. The metric we choose for splitting attributes in decision trees is the Gini index. For a candidate split attribute X<sub>i</sub>, denote possible levels as L 1 , L 2 , ⋯ , L j , the Gini Index is calculated as [<xref ref-type="bibr" rid="scirp.120102-ref15">15</xref>]:</p><p>G ( X i ) = ∑ j = 1 J Pr ( X i = L j ) ( 1 − Pr ( X i = L j ) ) = 1 − ∑ j = 1 J Pr ( X i = L j ) 2</p><p>The steps of Random Forest algorithm is explained as follows.</p><p>1) Start with the selection of random samples.</p><p>2) Construct a decision tree for every sample, and get the result from every decision tree.</p><p>3) Perform voting for every result.</p><p>4) Select the most voted result as the final prediction result.</p><p>Random Forest has its own predominance. On the one hand, it costs relatively little time on a large dataset. On the other hand, it performs well for estimating missing data, which makes the accuracy of the prediction model robust even when a large amount of data is missing.</p><p>In this paper, we use Random Forest Classifier from the sklearn package in python to build the model.</p></sec><sec id="s3_3_2"><title>3.3.2. XGBoost</title><p>XGBoost is also a decision tree based algorithm and is an improvement of the gradient boost algorithm. The steps of Random Forest algorithm is explained as follows.</p><p>1) First, we input the training set { ( x i , y i ) } , a loss function L ( y , F ( x ) ) , weak learners M and a learning rate α.</p><p>2) Initialize model with a constant</p><p>f ^ ( 0 ) ( x ) = arg min θ ∑ i = 1 N L ( y i , θ )</p><p>3) For m = 1 to M:</p><p>a) Compute the gradient and the hessians:</p><p>g ^ m ( x i ) = [ ∂ L ( y i , f ( x i ) ) ∂ f ( x i ) ] f ( x ) = f ^ ( m − 1 ) ( x )</p><p>h ^ m ( x i ) = [ ∂ L ( y i , f ( x i ) ) ∂ f ( x i ) 2 ] f ( x ) = f ^ ( m − 1 ) ( x )</p><p>b) Fit a base learner using the training set { x i , − g ^ m ( x i ) h ^ m ( x i ) } i = 1 N by solving the optimization question below:</p><p>φ ^ m = arg min φ ∑ i = 1 N 1 2 h ^ m ( x i ) [ − g ^ m ( x i ) h ^ m ( x i ) − φ ( x i ) ] 2</p><p>f ^ m ( x ) = α φ ^ m ( x )</p><p>c) Update the model:</p><p>f ^ m ( x ) = f ^ ( m − 1 ) ( x ) + f ^ m ( x )</p><p>4) Output</p><p>f ^ ( x ) = f ^ ( X ) ( x ) ∑ m = 0 M f ^ m ( x )</p><p>In this paper, we use XGBClassifier from the xgboost package in python to build the model.</p></sec></sec><sec id="s3_4"><title>3.4. The Prediction Accuracy</title><p>The prediction accuracy of the Random Forest model is 0.90657, while the prediction accuracy of the XGBoost model is 0.90635. The result indicates that Random Forest and XGBoost show little difference in the accuracy of their predictions, and both get high accuracy in the loan default cases. The prediction distributions of Random Forest and XGBoost are shown in <xref ref-type="fig" rid="fig2">Figure 2</xref>.</p></sec></sec><sec id="s4"><title>4. Conclusions &amp; Discussion</title><p>This paper verifies the ability of Random Forest as well as XGBoost to predict loan default. In the feature engineering part we use the variance threshold method and Variance Inflation Factor method to filter out unimportant features, and then we input those selected features into Random Forest and XGBoost models. It turns out that Random Forest and XGBoost show little difference in the accuracy of their predictions since both get high accuracy in the loan default cases. In future research, we will implement comparative studies using other advanced machine learning algorithms such as Neural Network, KNN, and MLP, or the mixed model of them, to find the most suitable model for loan default prediction.</p></sec><sec id="s5"><title>Conflicts of Interest</title><p>The author declares no conflicts of interest regarding the publication of this paper.</p></sec><sec id="s6"><title>Cite this paper</title><p>Wu, W.J. (2022) Machine Learning Approaches to Predict Loan Default. Intelligent Information Management, 14, 157-164. https://doi.org/10.4236/iim.2022.145011</p></sec></body><back><ref-list><title>References</title><ref id="scirp.120102-ref1"><label>1</label><mixed-citation publication-type="other" xlink:type="simple">Lai, L. (2020) Loan Default Prediction with Machine Learning Techniques. 2020 International Conference on Computer Communication and Network Security (CCNS), Xi’an, 21-23 August 2020, 5-9. https://doi.org/10.1109/CCNS50731.2020.00009</mixed-citation></ref><ref id="scirp.120102-ref2"><label>2</label><mixed-citation publication-type="other" xlink:type="simple">Aslam, U., Tariq Aziz, H.I., Sohail, A., et al. (2019) An Empirical Study on Loan Default Prediction Models. Journal of Computational and Theoretical Nanoscience, 16, 3483-3488. https://doi.org/10.1166/jctn.2019.8312</mixed-citation></ref><ref id="scirp.120102-ref3"><label>3</label><mixed-citation publication-type="other" xlink:type="simple">Madaan, M., Kumar, A., Keshri, C., et al. (2021) Loan Default Prediction Using Decision Trees and Random Forest: A Comparative Study. IOP Conference Series: Materials Science and Engineering, 1022, 012042. https://doi.org/10.1088/1757-899X/1022/1/012042</mixed-citation></ref><ref id="scirp.120102-ref4"><label>4</label><mixed-citation publication-type="other" xlink:type="simple">Malekipirbazari, M. and Aksakalli, V. (2015) Risk Assessment in Social Lending via Random Forests. Expert Systems with Applications, 42, 4621-4631. https://doi.org/10.1016/j.eswa.2015.02.001</mixed-citation></ref><ref id="scirp.120102-ref5"><label>5</label><mixed-citation publication-type="other" xlink:type="simple">Ma, X., Sha, J., Wang, D., et al. (2018) Study on a Prediction of P2P Network Loan Default Based on the Machine Learning LightGBM and XGboost Algorithms According to Different High Dimensional Data Cleaning. Electronic Commerce Research and Applications, 31, 24-39. https://doi.org/10.1016/j.elerap.2018.08.002</mixed-citation></ref><ref id="scirp.120102-ref6"><label>6</label><mixed-citation publication-type="other" xlink:type="simple">Nali&amp;#263;, J. and &amp;#352;vraka, A. (2018) Using Data Mining Approaches to Build Credit Scoring Model: Case Study—Implementation of Credit Scoring Model in Microfinance Institution. 2018 17th International Symposium Infoteh-Jahorina (INFOTEH), East Sarajevo, 21-23 March 2018, 1-5. https://doi.org/10.1109/INFOTEH.2018.8345543</mixed-citation></ref><ref id="scirp.120102-ref7"><label>7</label><mixed-citation publication-type="other" xlink:type="simple">Baesens, B., Roesch, D. and Scheule, H. (2016) Credit Risk Analytics: Measurement Techniques, Applications, and Examples in SAS. John Wiley &amp; Sons, Hoboken. https://doi.org/10.1002/9781119449560</mixed-citation></ref><ref id="scirp.120102-ref8"><label>8</label><mixed-citation publication-type="other" xlink:type="simple">Han, J.T., Choi, J.S., Kim, M.J., et al. (2018) Developing a Risk Group Predictive Model for Korean Students Falling into Bad Debt. Asian Economic Journal, 32, 3-14. https://doi.org/10.1111/asej.12139</mixed-citation></ref><ref id="scirp.120102-ref9"><label>9</label><mixed-citation publication-type="other" xlink:type="simple">Marqués, A.I., García, V. and Sánchez, J.S. (2012) Exploring the Behaviour of Base Classifiers in Credit Scoring Ensembles. Expert Systems with Applications, 39, 10244-10250. https://doi.org/10.1016/j.eswa.2012.02.092</mixed-citation></ref><ref id="scirp.120102-ref10"><label>10</label><mixed-citation publication-type="other" xlink:type="simple">Wang, Y. and Priestley, J.L. (2017) Binary Classification on Past Due of Service Accounts Using Logistic Regression and Decision Tree. Grey Literature from PhD Candidates. http://digitalcommons.kennesaw.edu/dataphdgreylit/</mixed-citation></ref><ref id="scirp.120102-ref11"><label>11</label><mixed-citation publication-type="journal" xlink:type="simple"><name name-style="western"><surname>Li</surname><given-names> X.H. </given-names></name>,<etal>et al</etal>. (<year>2013</year>)<article-title>Using “Random Forest” for Classification and Regression</article-title><source> Chinese Journal of Applied Entomology</source><volume> 50</volume>,<fpage> 1190</fpage>-<lpage>1197</lpage>.<pub-id pub-id-type="doi"></pub-id></mixed-citation></ref><ref id="scirp.120102-ref12"><label>12</label><mixed-citation publication-type="other" xlink:type="simple">Li, Z., Li, S., Li, Z., et al. (2021) Application of XGBoost in P2P Default Prediction. Journal of Physics: Conference Series, 1871, 012115. https://doi.org/10.1088/1742-6596/1871/1/012115</mixed-citation></ref><ref id="scirp.120102-ref13"><label>13</label><mixed-citation publication-type="other" xlink:type="simple">Akinwande, M.O., Dikko, H.G. and Samson, A. (2015) Variance Inflation Factor: As a Condition for the Inclusion of Suppressor Variable(s) in Regression Analysis. Open Journal of Statistics, 5, 754-767. https://doi.org/10.4236/ojs.2015.57075</mixed-citation></ref><ref id="scirp.120102-ref14"><label>14</label><mixed-citation publication-type="other" xlink:type="simple">Gholamy, A., Kreinovich, V. and Kosheleva, O. (2018) Why 70/30 or 80/20 Relation between Training and Testing Sets: A Pedagogical Explanation. Departmental Technical Reports (CS). https://scholarworks.utep.edu/cs_techrep/1209</mixed-citation></ref><ref id="scirp.120102-ref15"><label>15</label><mixed-citation publication-type="other" xlink:type="simple">Breiman, L. (2001) Random Forests. Machine Learning, 45, 5-32. https://doi.org/10.1023/A:1010933404324</mixed-citation></ref></ref-list></back></article>