Skip to content

The Credit Card Default Prediction project leverages an Artificial Neural Network (ANN) to predict the likelihood of credit card defaults based on user input. It combines machine learning with a user-friendly interface to provide a robust solution for financial risk assessment.

Notifications You must be signed in to change notification settings

Algorithmia-SE/credit-default-prediction

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

2 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Credit Card Default Prediction

🌟 Project Overview

The Credit Card Default Prediction project leverages an Artificial Neural Network (ANN) to predict the likelihood of credit card defaults based on user input. It combines machine learning with a user-friendly interface to provide a robust solution for financial risk assessment. The project includes:

  • A trained ANN model
  • A FastAPI backend for API access
  • A sleek, interactive Gradio web interface for predictions

✨ Features

  • Machine Learning Model: Predict default risk using key financial and demographic data.
  • Interactive Gradio Web Interface: An intuitive tool for making predictions in real-time.
  • FastAPI Backend: Offers RESTful API endpoints for seamless integration.
  • Comprehensive Input Features:
    • Credit Limit
    • Demographics (sex, education, marriage status, age)
    • Past repayment status (6 months)
    • Bill amounts (6 months)
    • Payment amounts (6 months)

πŸ› οΈ Tech Stack

  • Python: The backbone of this project
  • TensorFlow/Keras: For building and training the ANN model
  • FastAPI: RESTful API for backend services
  • Gradio: Interactive web interface for predictions
  • scikit-learn: Data preprocessing and performance metrics
  • imbalanced-learn: Handling class imbalance
  • NumPy & Pandas: Data manipulation and analysis

πŸš€ Installation

Prerequisites

  • Python 3.8+
  • Conda package manager

Setup

1. Clone the Repository

git clone https://github.com/austinLorenzMccoy/credit-default-prediction.git  
cd credit-default-prediction  

2. Create and Activate a Conda Environment

conda create -n credit-default python=3.11 -y  
conda activate credit-default  

3. Install Dependencies

pip install -r requirements.txt  

🧠 Model Training

Workflow

  1. Data Cleaning & Preprocessing: Ensure quality inputs.
  2. Class Imbalance Handling: Applied RandomOverSampling for balanced training.
  3. Feature Scaling: Standardized inputs using StandardScaler.
  4. ANN Architecture:
    • Input Layer: 64 neurons for input features
    • Hidden Layers:
      • Two dense layers with 32 neurons each
      • Dropout layers for regularization
    • Output Layer: Single neuron with Sigmoid activation for binary classification
  5. Training Optimization:
    • Early Stopping to prevent overfitting
    • TensorBoard Logging for tracking performance

πŸƒβ€β™€οΈ Running the Application

1. Start the Application

uvicorn app:app --reload  

2. Access the Services

3. Prediction Options

  • Gradio Interface: Use sliders and fields to input values and view predictions instantly.
  • API Endpoint: Send a POST request to /predict with JSON payload for predictions.

πŸ›‘οΈ Example Prediction Request

JSON Payload:

{  
    "LIMIT_BAL": 200000,  
    "SEX": 1,  
    "EDUCATION": 2,  
    "MARRIAGE": 1,  
    "AGE": 30,  
    "PAY_0": 0,  
    "PAY_2": 0,  
    "PAY_3": -1,  
    "PAY_4": -1,  
    "PAY_5": 0,  
    "PAY_6": 0,  
    "BILL_AMT1": 50000,  
    "BILL_AMT2": 48000,  
    "BILL_AMT3": 47000,  
    "BILL_AMT4": 46000,  
    "BILL_AMT5": 45000,  
    "BILL_AMT6": 44000,  
    "PAY_AMT1": 5000,  
    "PAY_AMT2": 6000,  
    "PAY_AMT3": 7000,  
    "PAY_AMT4": 8000,  
    "PAY_AMT5": 9000,  
    "PAY_AMT6": 10000  
}  

πŸ“Š Model Performance

  • Trained with early stopping for optimal performance
  • Metrics visualized using TensorBoard and Matplotlib

🌟 Visualization

  • Training Logs: Access TensorBoard for real-time insights.
  • Performance Metrics: Analyze accuracy and loss plots generated by Matplotlib.

🀝 Contributing

  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.

πŸ“œ License

Distributed under the MIT License. See LICENSE for more information.


πŸ“ž Contact

About

The Credit Card Default Prediction project leverages an Artificial Neural Network (ANN) to predict the likelihood of credit card defaults based on user input. It combines machine learning with a user-friendly interface to provide a robust solution for financial risk assessment.

Resources

Code of conduct

Contributing

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Jupyter Notebook 96.3%
  • Python 3.7%