Capstone Project - Credit Risk of LendingClub

Posted on Aug 2, 2021

Github Repository

LendingClub is one of the earliest and largest financial-technology companies that provides loans to client. As a person working in a financial institute, I would like to know more detailed business trending of LendingClub by analyzing its historical data of loans issued. I will then use machine learning models on predicting the credit risk of the loans.

I found dataset from Kaggle with more than 2.2 million samples and 151 features that contains loans issued by LendingClub from 2007 to 2018.

Data Cleaning

There are many cells with missing value from the original dataset. I droped features with more than 80% of missing value. I also dropped features that do not affect the data analysis nor machine learning, such as zip code and loan ID. Next, I dropped samples with more than 80% of missing value as well.

For numerical features, I filled in the median to the null values and for categorical features, I filled in with mode to the null values.

Data Analysis

Most of my analysis will be focusing on loan interest and loan amount. Therefore, Before I do anything to the dataset, let’s take a look of the distribution of these two essential features.

As shown below, the loan interest is slightly right skewed with median of 12.62%. 25/75 range is from 9.49% - 15.99%. Average of loan interest is 13.09%.

Same as loan interest, distribution of loan amount is also right skewed with average of $15,047 and median of $12,900. 25/75 range is from $8,000 – $20,000.

Grade is an essential feature that effects the loan amount and interest. When looking into the loan interest rate by grade as below, I found that interest rate increases from A to G. We can also tell that grade E, F, and G are having a wider range which I think may be caused by the outliers because the minimum rate of each of these three grades is 6%. The lowest rate is grade A with 5.31% while the highest rate is grade G with 30.99%. Loans under grade G is more profitable with a higher range of interest rate. However, this also indicates that loans with grade G has higher risk.

Below box plot shows the loan amount range of each grade. Loans under grade E, F, and G are having higher ranges of loan amount which means that borrowers who get E, F, or G are having larger loan amount of each transaction.

However, even though grade E, F, and G are having higher interest rate with larger loan amount, when I count the amount of loans of each grade as below, we can tell that LendingClub is having more business with grade B and C instead of the ones with high interest rate, i.e. grade G, which makes it less risky.

How about the trend of LendingClub’s business through the years? Below graph shows loan amount of LendingClub by year. It grew steeply from 2012 to 2015 and after 2017 especially on the grade A, B, C, and D, the loans with lower interest. What seems unusual to me is between 2015 and 2017, business trend looks more flat than significate growth. This made curious about what happened to the company during this period of time. After doing research, I found a news published by New York Times in 2018 with subject line stating “LendingClub Founder, Ousted in 2016, Settles Fraud Charges”. I also found some other articles/news indicating that LendingClub facing jurisdiction in 2016 after CEO resigned. I assume that this impacted company’s reputation and further negatively affected company’s business for a few years.

               

All loans were issued with tenor of 36 or 60 months. 60.3% of the loan amounts are issued under the tenor of 36 months which is less risky.

Shorter tenor also lowers the interest rate when we look into the graph below. Grade A, which has the lowest interest rate range, has more loans with 36 months’ tenor while grade G has more loans under tenor of 60 months than 36 months.

Does home ownership affect a borrower’s interest rate and amount? After analyzing the data, the answer is no. Correlation coefficient between interest rate and home ownership is 0.073. Correlation between loan amount and home ownership is -0.18. Which indicates that whether a borrower owns a real estate property or not, it doesn’t affect the interest rate and amount.

   

Most of loans were used for debt consolidation and credit card. However, based on my analysis, loan purpose does not affect a borrower’s interest rate and loan amount. Correlation coefficient is 0.097 between interest rate and loan purpose and it’s -0.15 between loan amount and loan purpose.

Below table indicates the number of loans with different loan status. There are 40 default loans among the 2.2 million samples and 269,320 were charged off. Charged off loans are the debt that company is no longer expecting to collect the funds as borrower has become delinquent on payment.

I therefore converted charged off to default since both of these types of loans are considered as bad debt and will be booked as reserve amount in company’s accounting record. After converting, we can tell that 80% of loans are fully paid and 20% are default. I’m excluding samples with other types of loan status as fully paid and default will be the good and bad debt to be worked on credit risk machine learning prediction on my later study.

Machine Learning Prediction

As indicated above, for machine learning, I selected samples with loan status of fully paid and default. Then I converted categorical features to numerical. After calculating the variance inflation factor (VIF) of the numerical features, I removed features with multicolinearity (VIF > 10) for linear models.

For tree based models, I used impalance-learn package to under sampling the fully paid samples and made it double size of default samples.

After applying 5 machine learning models, I got below result. Random Forest, Gradient Boosting, and Logit Classification are having more accurate test scores and higher recall and ROC AUC scores. However, gradient boosting is taking too much time to fit the model that I would not recommend to use due to the timing it costs.

Conclusion

From my analysis, I think that business of LendingClub is growing in a healthy shape with big increase of loan amount and lower risk since most of the loans provided are having lower interest rate and shorter tenor. There was an impact on its business during the year of 2015 and 2017 with some negative news. However, business was picked up again after 2017 with steep increase. Among the closed transactions, 80% were having good credit with fully paid amount. To predict the credit risk on the outstanding loans, I would recommend to use random forest or logit classification models.

About Author

Cassandra Jones

Cassandra Jones is a certified data scientist with a focus on data science technologies and banking. Working at investment bank for 4 years on client services. Passionate about any data driven business insights going forward...
View all posts by Cassandra Jones >

Leave a Comment

No comments found.

View Posts by Categories


Our Recent Popular Posts


View Posts by Tags

#python #trainwithnycdsa 2019 airbnb Alex Baransky alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus API Application artist aws beautiful soup Best Bootcamp Best Data Science 2019 Best Data Science Bootcamp Best Data Science Bootcamp 2020 Best Ranked Big Data Book Launch Book-Signing bootcamp Bootcamp Alumni Bootcamp Prep Bundles California Cancer Research capstone Career Career Day citibike clustering Coding Course Demo Course Report D3.js data Data Analyst data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization Deep Learning Demo Day Discount dplyr employer networking feature engineering Finance Financial Data Science Flask gbm Get Hired ggplot2 googleVis Hadoop higgs boson Hiring hiring partner events Hiring Partners Industry Experts Instructor Blog Instructor Interview Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter lasso regression Lead Data Scienctist Lead Data Scientist leaflet linear regression Logistic Regression machine learning Maps matplotlib Medical Research Meet the team meetup Networking neural network Neural networks New Courses nlp NYC NYC Data Science nyc data science academy NYC Open Data NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time Portfolio Development prediction Prework Programming PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R language R Programming R Shiny r studio R Visualization R Workshop R-bloggers random forest Ranking recommendation recommendation system regression Remote remote data science bootcamp Scrapy scrapy visualization seaborn Selenium sentiment analysis Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau team TensorFlow Testimonial tf-idf Top Data Science Bootcamp twitter visualization web scraping Weekend Course What to expect word cloud word2vec XGBoost yelp