Skip to content

Repository files navigation

🔄 Project Workflow

This project follows a complete end-to-end Data Analytics and Machine Learning pipeline.

Raw LendingClub Dataset (133 Features)
                │
                ▼
      Data Understanding (Python)
                │
                ▼
      Data Cleaning & Preprocessing
                │
                ▼
     Cleaned Dataset (36 Features)
                │
        ┌───────┴────────┐
        ▼                ▼
   SQL Analysis      Power BI Dashboard
        │                │
        └───────┬────────┘
                ▼
     Business Insights & KPI Analysis
                │
                ▼
    Machine Learning Model Development
                │
                ▼
 Loan Default Prediction & Model Evaluation

📂 Project Structure

LENDINGCLUB
│
├── 1_Dataset
├── 2_Cleaned_real_Data
├── 3_SQL
├── 4_PowerBI
├── 5_Python
├── 6_Machine_Learning
├── 7_Images
├── 8_Documentation
└── README.md

🛠️ Tech Stack

Category Technologies Used
Programming Language Python
Data Analysis Pandas, NumPy
Data Visualization Matplotlib, Seaborn
Database MySQL
Dashboard Power BI
Machine Learning Scikit-learn
Development Environment Jupyter Notebook, VS Code
Version Control Git & GitHub

📂 Dataset Information

Dataset Name

LendingClub Loan Dataset

Dataset Source

The dataset is based on historical LendingClub loan records containing borrower information, loan characteristics, repayment status, and financial attributes.

Dataset Summary

Description Value
Original Features 133
Selected Features 36
Records 119,119
Target Variable loan_status

Selected Features Include

  • Loan Amount
  • Interest Rate
  • Annual Income
  • Loan Grade
  • Sub Grade
  • Home Ownership
  • Verification Status
  • Purpose
  • Debt-to-Income Ratio (DTI)
  • FICO Score
  • Loan Status
  • Issue Date
  • State
  • Term
  • Installment
  • Total Payment
  • Recoveries

🗄️ SQL Business Analysis

The cleaned LendingClub dataset was imported into MySQL for business analysis.

More than 50 SQL queries were written to answer real-world business questions and extract meaningful insights.

SQL Concepts Covered

  • Aggregate Functions (COUNT, SUM, AVG, MIN, MAX)
  • GROUP BY & ORDER BY
  • WHERE, IN, BETWEEN, AND, OR
  • HAVING Clause
  • CASE Statements
  • Subqueries
  • Common Table Expressions (CTEs)
  • Window Functions
    • ROW_NUMBER()
    • RANK()
    • DENSE_RANK()
    • PARTITION BY
  • Business-Oriented SQL Queries

Business Questions Solved

✔ Total Number of Loans

✔ Total Loan Amount Issued

✔ Average Loan Amount

✔ Average Interest Rate

✔ Loan Status Distribution

✔ Loan Amount by Grade

✔ Loan Amount by State

✔ Top Loan Purposes

✔ Loan Trend by Year

✔ Monthly Loan Analysis

✔ Average FICO Score by Year

✔ Risk Category Classification

✔ Above Average Loan Analysis

✔ Top Loans within Each Grade

✔ Running Ranking using Window Functions


SQL File

The complete SQL script is available in:

3_SQL/LendingClub_SQL.sql

📊 Power BI Dashboard

Three interactive dashboards were developed to analyze LendingClub loan performance from different business perspectives.

Dashboard 1 – Executive Summary

Key KPIs:

  • Total Loans
  • Total Loan Amount
  • Average Loan Amount
  • Average Interest Rate
  • Average Annual Income
  • Total Interest Received
  • Total Principal Received
  • Total Recoveries

Visualizations:

  • Loan Status Distribution
  • Loan Amount Trend
  • Monthly Loan Trend
  • Loan Amount by Grade
  • Top States by Loan Amount
  • Loan Amount by Home Ownership
  • Top Loan Purposes

Dashboard 2 – Financial Performance & Business Insights

Visualizations:

  • Principal Recovery Trend
  • Interest Received Trend
  • Loan Status Trend
  • Recoveries by Year
  • Top 10 States
  • Top Loan Purposes

Dashboard 3 – Risk & Customer Analysis

Visualizations:

  • Loan Status by Grade
  • Average Interest Rate by Grade
  • Average FICO Score by Grade
  • Average Debt-to-Income Ratio
  • Home Ownership Distribution
  • Verification Status Distribution

Power BI File

4_PowerBI/LendingClub_Analytics.pbix

🤖 Machine Learning

The objective of the Machine Learning phase is to predict whether a loan is likely to be Fully Paid or Charged Off based on borrower and loan characteristics.


Machine Learning Workflow

  • Data Understanding
  • Data Cleaning & Preprocessing
  • Feature Selection
  • Exploratory Data Analysis (EDA)
  • Encoding Categorical Variables
  • Train-Test Split
  • Model Building
  • Model Evaluation
  • Performance Comparison

Target Variable

loan_status

  • Fully Paid → 0
  • Charged Off → 1

Algorithms Implemented

  • Logistic Regression
  • Decision Tree Classifier
  • Random Forest Classifier

Evaluation Metrics

The models were evaluated using the following performance metrics:

  • Accuracy
  • Precision
  • Recall
  • F1-Score
  • ROC-AUC Score

Best Performing Model

Among the implemented models, the Random Forest Classifier achieved the best overall performance for this dataset.


Machine Learning Files

6_Machine_Learning/
│
├── Loan_Default_Prediction.ipynb

📈 Model Performance

Model Accuracy Precision Recall F1 Score ROC-AUC
Logistic Regression 79.96% 52.62% 3.99% 7.42% 51.54%
Decision Tree 72.86% 33.91% 36.77% 35.28% 59.36%
Random Forest 82.26% 75.89% 17.30% 28.18% 57.96%

Conclusion

  • Logistic Regression achieved good accuracy but poor recall.
  • Decision Tree captured more default cases but with lower overall accuracy.
  • Random Forest achieved the highest accuracy and precision among the evaluated models, making it the preferred model for this project.

📌 Key Business Insights

The analysis of the LendingClub dataset revealed several important business insights:

  • Grade B and Grade C loans accounted for a significant portion of the total loan amount.
  • Fully Paid loans were considerably higher than Charged Off loans.
  • Borrowers with higher interest rates generally exhibited a greater risk of default.
  • Loan issuance showed noticeable variation across different years and months.
  • Certain loan purposes, such as Debt Consolidation and Credit Card repayment, dominated the portfolio.
  • States like California, Texas, and New York contributed the highest loan volumes.
  • Annual income and FICO score showed a positive relationship with successful loan repayment.
  • Loan grade and interest rate were among the most influential factors affecting loan performance.

🚀 How to Run the Project

Clone the Repository

git clone https://github.com/<your-username>/LendingClub-Loan-Default-Prediction.git

Install Required Libraries

pip install -r requirements.txt

Project Execution Order

  1. Run the Python notebook for data preprocessing.
  2. Import the cleaned dataset into MySQL.
  3. Execute the SQL queries.
  4. Open the Power BI dashboard.
  5. Run the Machine Learning notebook.

📈 Future Improvements

The project can be further enhanced by:

  • Hyperparameter tuning for machine learning models.
  • Testing advanced ensemble algorithms such as XGBoost and LightGBM.
  • Deploying the prediction model using Streamlit or Flask.
  • Building a real-time loan default prediction dashboard.
  • Integrating the project with cloud platforms for deployment.

🙋 About Me

Rakshitha G

Artificial Intelligence & Machine Learning Undergraduate with a strong interest in Data Analytics, Business Intelligence, Machine Learning, and Data Science.

Skills

  • Python
  • SQL
  • Power BI
  • Excel
  • Pandas
  • NumPy
  • Matplotlib
  • Seaborn
  • Scikit-learn
  • MySQL

I enjoy building end-to-end data analytics projects that transform raw data into meaningful business insights.

⭐ Acknowledgement

This project was developed for learning and portfolio purposes using the LendingClub loan dataset.

The project demonstrates an end-to-end workflow including:

  • Data Understanding
  • Data Preprocessing
  • SQL Business Analysis
  • Interactive Power BI Dashboards
  • Machine Learning
  • Business Insights

📷 Dashboard Preview

1️⃣ Executive Summary

Executive Summary


2️⃣ Financial Performance & Business Insights

Financial Performance


3️⃣ Risk & Customer Analysis

Risk Analysis


🤖 Machine Learning Results

Confusion Matrix

Confusion Matrix


ROC Curve

ROC Curve


Feature Importance

Feature Importance


Correlation Heatmap

Correlation Heatmap

About

End-to-end LendingClub Loan Analytics project using SQL, Python, Power BI, and Machine Learning to analyze loan performance and predict loan default risk.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages