Data Based Credit Risk of LendingClub

Posted on Aug 2, 2021

Github Repository

The skills the author demoed here can be learned through taking Data Science with Machine Learning bootcamp with NYC Data Science Academy.

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 - Pt. 1

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%.

Data Based Credit Risk of LendingClub - Capstone Project

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.

Data Based Credit Risk of LendingClub - Capstone Project

Data Analysis - Pt. 2

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.

Data Based Credit Risk of LendingClub - Capstone Project

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.

Data Analysis - Pt. 3

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.


Data Analysis - Pt. 4

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.

Data Analysis - Pt. 5

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.


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 2020 Revenue 3-points agriculture air quality airbnb airline alcohol Alex Baransky algorithm alumni Alumni Interview Alumni Reviews Alumni Spotlight alumni story Alumnus ames dataset ames housing dataset apartment rent API Application artist aws bank loans 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 boston safety Bundles cake recipe California Cancer Research capstone car price Career Career Day citibike classic cars classpass clustering Coding Course Demo Course Report covid 19 credit credit card crime frequency crops D3.js data data analysis Data Analyst data analytics data for tripadvisor reviews data science Data Science Academy Data Science Bootcamp Data science jobs Data Science Reviews Data Scientist Data Scientist Jobs data visualization database Deep Learning Demo Day Discount disney dplyr drug data e-commerce economy employee employee burnout employer networking environment feature engineering Finance Financial Data Science fitness studio Flask flight delay gbm Get Hired ggplot2 googleVis H20 Hadoop hallmark holiday movie happiness healthcare frauds higgs boson Hiring hiring partner events Hiring Partners hotels housing housing data housing predictions housing price hy-vee Income Industry Experts Injuries Instructor Blog Instructor Interview insurance italki Job Job Placement Jobs Jon Krohn JP Morgan Chase Kaggle Kickstarter las vegas airport lasso regression Lead Data Scienctist Lead Data Scientist leaflet league linear regression Logistic Regression machine learning Maps market matplotlib Medical Research Meet the team meetup methal health miami beach movie music Napoli NBA netflix Networking neural network Neural networks New Courses NHL nlp NYC NYC Data Science nyc data science academy NYC Open Data nyc property NYCDSA NYCDSA Alumni Online Online Bootcamp Online Training Open Data painter pandas Part-time performance phoenix pollutants Portfolio Development precision measurement prediction Prework Programming public safety PwC python Python Data Analysis python machine learning python scrapy python web scraping python webscraping Python Workshop R R Data Analysis 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 seafood type Selenium sentiment analysis sentiment classification Shiny Shiny Dashboard Spark Special Special Summer Sports statistics streaming Student Interview Student Showcase SVM Switchup Tableau teachers team team performance TensorFlow Testimonial tf-idf Top Data Science Bootcamp Top manufacturing companies Transfers tweets twitter videos visualization wallstreet wallstreetbets web scraping Weekend Course What to expect whiskey whiskeyadvocate wildfire word cloud word2vec XGBoost yelp youtube trending ZORI