Predicting customer creditworthiness using Machine Learning and the German Credit Dataset.
Credit risk assessment is one of the most important tasks in the banking and financial industry. Financial institutions need to determine whether a customer is likely to repay a loan or become a credit risk.
This project builds a Machine Learning model to classify customers based on their financial and demographic information and predict whether they represent a good or bad credit risk.
The project includes:
- Data Cleaning and Preprocessing
- Exploratory Data Analysis (EDA)
- Feature Engineering
- Model Training
- Credit Risk Prediction
- Streamlit Web Application Deployment
Banks and lending institutions face significant financial losses due to loan defaults.
Manual credit assessment:
- Is time-consuming
- Can be subjective
- May overlook important patterns in customer data
The objective of this project is to develop a data-driven system that can:
- Predict customer credit risk
- Improve lending decisions
- Reduce loan default rates
- Support faster loan approvals
- Analyze customer credit data
- Build a predictive machine learning model
- Classify customers into credit risk categories
- Deploy the model using Streamlit
- Generate predictions in real time
Dataset Used:
German Credit Dataset
The dataset contains customer information such as:
- Age
- Sex
- Housing
- Saving Accounts
- Checking Account
- Credit Amount
- Duration
- Job Information
- Risk Category
Dataset File:
german_credit_data.csv
Update with actual values:
- Number of Records: 1000
- Number of Features: 11
| Technology | Purpose |
|---|---|
| Python | Programming Language |
| Pandas | Data Manipulation |
| NumPy | Numerical Computing |
| Matplotlib | Data Visualization |
| Seaborn | Data Visualization |
| Scikit-Learn | Machine Learning |
| Streamlit | Web Application |
| Pickle | Model Serialization |
| Jupyter Notebook | Development Environment |
Data Collection
↓
Data Cleaning
↓
Exploratory Data Analysis
↓
Feature Engineering
↓
Categorical Encoding
↓
Train-Test Split
↓
Model Training
↓
Credit Risk Prediction
↓
Streamlit Deployment
Performed analyses such as:
- Age Distribution
- Credit Amount Distribution
- Gender Analysis
- Risk Distribution
- Correlation Analysis
- Categorical Feature Analysis
Extra Trees Classifier
Why Extra Trees?
- Handles complex relationships well
- Reduces overfitting
- High predictive performance
- Fast training and prediction
- Data Cleaning
- Handling Missing Values
- Label Encoding
- Feature Selection
- Model Training
- Model Serialization using Pickle
- Streamlit Deployment
The model predicts:
- Good Credit Risk
- Bad Credit Risk
The prediction can assist banks in:
- Loan Approval Decisions
- Risk Management
- Customer Profiling
Credit-Risk-Modeling/
├── app.py
├── credit-risk.ipynb
├── german_credit_data.csv
├── extra_trees_credit_model.pkl
├── Checking account_encoder.pkl
├── Saving accounts_encoder.pkl
├── Housing_encoder.pkl
├── Sex_encoder.pkl
├── target_encoder.pkl
├── README.md
numpy
pandas
matplotlib
seaborn
scikit-learn
streamlit
jupyter
This project can help financial institutions:
- Improve loan approval decisions
- Reduce financial losses
- Automate risk assessment
- Improve customer screening efficiency
- Deploy on Streamlit Cloud
- Add probability scores
- Explain predictions using SHAP
- Hyperparameter tuning
- Compare multiple classification models
- Add model monitoring dashboard
Through this project, I learned:
- Classification Algorithms
- Feature Engineering
- Handling Categorical Variables
- Model Deployment with Streamlit
- Pickle Serialization
- Financial Risk Analytics
- End-to-End Machine Learning Workflow
Aditya Singh
GitHub: https://github.com/AdityaDev-17
LinkedIn: https://www.linkedin.com/in/YOUR-LINKEDIN/