Increasing ROI for Investors Using LendingClub as an Example

Posted on Jan 15, 2022

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


There are many avenues to investing which can be research through data. Each type of investment vehicle comes with a different risk-return profile. For the most risk-averse,  higher interest savings accounts or CDs guarantee safety. Investors who seek a greater return and are willing to take on the risk of loss would likely invest in the stock market or mutual funds that invest in stocks, real estate, or REITs.

Those who seek alternative avenues to boost their investment returns or to diversify their portfolios beyond those standard investments, there’s also the option of capitalizing on the return of peer-to-peer loan investments which can yield a decent return while mitigating unnecessary risk. 

However, investing in loans may not be the easiest to navigate with so many aspects of the loan, and the borrower to consider that the investor must understand before making an educated judgment. This analysis utilizes past data from LendingClub, the most popular online peer-to-peer lending platform since 2006 as an example to study return on investments. 


Each loan is assigned a grade based on the borrower's FICO score, income, house ownership, and various other data the applicant fills out. We can see how many loans have a particular grade in Graph 1.

Graph 1: Growing Popularity with the Evolution of LendingClub
Graph 2: Violin Chart Showing Distribution of Interest Rates based on Their Grades and Terms

It can be observed that as the quality of the loan deteriorates, the chance of default increases. The investors would, therefore, require a higher interest rate to compensate for the possible loss of their capital. From the above graphs, we can predict that each loan’s return on investment can greatly differ depending on its grade.

Graph 3: Count of Loan Applications by Selected Purposes from 2013-2018

Sometimes even the purpose of the loans can have an impact on returns due to different risk levels. For example, LendingClub rates are usually lower than normal credit card interest rates, making it easier for the borrowers to pay off their debt. On the other hand, rates are most likely higher at LendingClub than a typical mortgage or small business loan from traditional banks, hence chances of default would increase.

The underlying reasons for these patterns could have different impacts on the loan outcomes, but a simple analysis of the data may not show a complete picture. If an investor is able to get their hands on a credit report, there will be many features for them to take into consideration. In the current dataset, there are more than 150 features, including the grades, purposes, terms. We aim to reduce the complexity of selecting more profitable loan investments for new (and even experienced) investors.


Our aim is to increase the ROI for investors who decide to invest in LendingClub loans by using machine learning models. Thus we will be able to save investors time, money, and stress while helping them make better decisions for their future.

The dataset we are using contains information for over 2 million loans and the 151 features that affect the outcome of the loan. Based on these numbers alone, it is apparent that classifying these loans can be a tricky and time-consuming task for a less-experienced investor. There are loans that look like they would do well and provide a decent ROI but end up defaulting. There are also loans that are paid off too early and do not provide a decent ROI.

Consequently, it is no simple matter to predict which loans will pay off the most even based on unique features. Our models predict which loans will end up being paid off and are more likely to provide a decent return. In order to reduce work, we used classification and confusion matrices to give a sense of direction. 



First, we split data evenly into train and predict sets using only completed loans (loans with a definitive outcome of having been fully paid off or defaulted). Training data was used for the entire process, but the prediction dataset was only used to confirm our results. 


After splitting the dataset, we balanced each dataset since labels were not split evenly. We ran our models after converting some features to numeric type to ease the load on RAM usage. Then we extensively engineered some features (for example ratios of income to monthly payment or income to loan amount) and realized that there was not much improvement in the ROC-AUC scores, which we used to measure accuracy. 

Next, we reduced the features to create a minimal dataset to see if there were any glaring differences in the ROC-AUC scores. The reduced dataset performed similarly in terms of accuracy to the larger datasets with extensive feature engineering, scoring only about 1% less than the original dataset and the dataset with extensive feature engineering. The train and test scores for the 3 datasets are shown in Table 1.

Table 1: ROC-AUC Scores of Original Data, Feature Engineered Data, and Reduced Data Using SKLearn’s Gradient Boosting Regressor Model 


We were able to simplify the final dataset to include only 8 features. Those features are as follows: annual income, FICO Score, duration of the loan, the loan amount, homeownership status, the interest rate of the loan, the utilization rate of all credit lines, and debt-to-income ratio.


To compare the performance of different machine learning models and to find the best model, we tested and tuned 3 different machine learning models including random forest classification, gradient boosting classification, and XGBoost classification. 


We were able to achieve a ROC-AUC score in the range of 65-71% for our train sets. After checking the ROC-AUC scores, we used confusion matrices to see how possible outcomes were split.

Table 2 shows the confusion matrix of an un-tuned Gradient Boosting Classifier for our prediction dataset. Our labels were 0 to indicate paid off and 1 to indicate default. A total of 674,049 loans were analyzed, which is the sum of all quadrants. The top left quadrant of our confusion matrix is our true positive (TP), where we see 361,451 loans (53.6%) both actually paid off and predicted to be paid off by our models.

The top right quadrant of 177,918 loans (26.4%) is our false positive (FP), which was predicted to default but was actually paid off. Our true negative (TN) quadrant on the bottom right shows 85,225 loans (12.6%) that were defaulted and that our model predicted to default as well. The bottom left quadrant shows the false negative (FN) of 49,455 loans (7.3%) that our model predicted being paid off but the loan ended up actually defaulting. 

This results in 66% overall accuracy, 65% sensitivity, and 66% specificity, where the sensitivity of a classifier is defined as TP/(TP+FN) and specificity is defined as TN/(TN+FP).

Table 2: Confusion Matrix of Un-Tuned Gradient Boosting Classifier for Prediction Set


We simulated the behavior of an investor looking to invest in 4 loans at random. The simulated investor would have 6 portfolios ranging from $1 - 60,000 in increments of $9,999. We applied the 3 best ML models as well as naive random sampling where no models were used in selecting the loans. We ran 10,000 iterations in this simulation to get the weighted average ROI.


In Graph 4, we can see a clear increase of ROI with the investor's portfolio when using our models compared to the naive sampling using no model. An increase of 20 - 120% in profit between using our model vs naive sampling was observed. The higher the investment, the more critical the need for implementing the model to ensure ROI does not decrease. 

Graph 4: ROI Comparison Between Actual Outcome and Model-Predicted Outcomes

The decreasing trend of the ROI for naive sampling makes sense because higher investment ranges would require on average larger loans to be picked. As we can see from the boxplot in Graph 5, larger loans are often associated with lower grades, ie. grade F and G, which is correlated with a higher rate of default. Without any models to aid in the loan selection process, naive sampling would pick those loans with lower grades at random, increasing the rate of default. Overall, this would equate to decreasing the return on investment.

Graph 5: Boxplot of Loan Amount in Dollars Grouped by Grade


Until now, we only figured out a way to ensure that investors would be able to see an increase in returns. An easy-to-use app could be created to allow for user input of the investment range, the number of loans, the loan grades they are comfortable with, and the purposes of the loans.  We can also revisit feature engineering and focus more on the features that have a greater impact on model prediction to increase our models’ performance to provide even better results for investors.

About Authors


Theodore is a jack of many trades and an expert in overthinking. He has worked in healthcare, healthcare administration, and finance and has experience in medical research. Having volunteered with medical missions abroad, managed building a new primary...
View all posts by Theodore >

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