Skip to content

Repository files navigation

💳 Credit Score Classification System

A machine learning-powered web application that predicts customer credit scores using advanced classification algorithms. Built with Python, Streamlit, and Random Forest.

Python Streamlit Random Forest Hugging Face License


📋 Table of Contents


🎯 Overview

This project implements a complete credit score classification pipeline that:

  • Analyzes customer financial data to predict credit worthiness
  • Classifies customers into three categories: Good, Standard, and Poor
  • Provides an interactive web interface for real-time predictions
  • Offers actionable recommendations based on predictions

✨ Features

  • 🤖 Machine Learning Model: Random Forest classifier trained on comprehensive credit data
  • 🌐 Interactive Web App: Modern, responsive Streamlit interface with dark theme
  • 📊 Real-time Predictions: Instant credit score classification with probability scores
  • 💡 Smart Recommendations: Tailored suggestions based on prediction outcomes
  • 📈 Visual Analytics: Interactive probability charts using Plotly

🤗 Hugging Face Resources

Resource Link
Model Card AdityaaXD/credit-score-classifier
Dataset Card AdityaaXD/Credit-Score-Classification

🖥️ Demo

Main Prediction Interface

The application features a premium dark-themed UI with:

  • Easy-to-use input forms for customer data
  • Real-time prediction results with confidence scores
  • Probability distribution visualization

🚀 Installation

Prerequisites

  • Python 3.8 or higher
  • pip package manager

Setup Steps

  1. Clone the repository

    git clone https://github.com/yourusername/credit-score-classification.git
    cd credit-score-classification
  2. Create a virtual environment (optional but recommended)

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
  3. Install dependencies

    pip install -r requirements.txt
  4. Run the application

    streamlit run app.py
  5. Open your browser and navigate to http://localhost:8501


📖 Usage

Making Predictions

  1. Navigate to the Predict tab in the application
  2. Enter customer information:
    • Numerical Features: Age, Annual Income, Number of Bank Accounts, etc.
    • Categorical Features: Occupation, Credit Mix, Payment Behavior, etc.
  3. Click "Predict Credit Score"
  4. Review results: View the prediction, confidence scores, and recommendations

Input Features

Feature Type Description
Age Numerical Customer's age
Annual_Income Numerical Yearly income in currency
Monthly_Inhand_Salary Numerical Monthly take-home salary
Num_Bank_Accounts Numerical Total bank accounts owned
Num_Credit_Card Numerical Number of credit cards
Interest_Rate Numerical Average interest rate on credit
Num_of_Loan Numerical Number of active loans
Delay_from_due_date Numerical Average delay in payments (days)
Outstanding_Debt Numerical Total outstanding debt
Credit_Utilization_Ratio Numerical Credit utilization percentage
Credit_History_Age_Months Numerical Credit history length in months
Occupation Categorical Employment type
Credit_Mix Categorical Types of credit accounts
Payment_Behaviour Categorical Spending patterns
Payment_of_Min_Amount Categorical Minimum payment behavior

📁 Project Structure

Credit Score Classification/
├── 📄 app.py                    # Streamlit web application
├── 📓 Credit_Score_Classification.ipynb  # Jupyter notebook with EDA & training
├── 📄 requirements.txt          # Python dependencies
├── 📄 README.md                 # This file
├── 📊 train.csv                 # Training dataset
├── 📊 test.csv                  # Test dataset
└── 📊 submission.csv            # Model predictions

🤗 Model Artifacts (Hosted on Hugging Face)

The trained model artifacts are hosted on Hugging Face Hub and are automatically downloaded when you run the application:

File Description
models/final_model.pkl Random Forest classifier
models/scaler.pkl Feature scaler
models/label_encoder.pkl Target label encoder
models/feature_info.pkl Feature metadata
models/onehot_encoder.pkl Categorical encoder

🧠 Model Information

Algorithm

  • Model: Random Forest Classifier (n_estimators=100)
  • Target Classes: Good, Standard, Poor

Feature Engineering

  • Numerical Features: 17 scaled features including financial metrics
  • Categorical Features: 5 one-hot encoded features
  • Preprocessing: StandardScaler for numerical, OneHotEncoder for categorical

Performance

The model was trained on a comprehensive credit dataset with features covering:

  • Payment history
  • Credit utilization
  • Account composition
  • Financial behavior patterns

🛠️ Tech Stack

Category Technology
Language Python 3.8+
ML Framework Scikit-learn
Web Framework Streamlit
Model Hosting Hugging Face Hub
Data Processing Pandas, NumPy
Visualization Plotly, Matplotlib, Seaborn
Development Jupyter Notebook

🤝 Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Commit your changes (git commit -m 'Add some AmazingFeature')
  4. Push to the branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages