Skip to content

Repository files navigation

Credit Card Approval Prediction Project

Overview

This project presents a machine-learning-based web application for estimating whether a credit card application is likely to be approved. The application is built with Python and Streamlit, and it provides an interactive form for entering applicant information, generating a prediction from a pre-trained machine-learning pipeline, and exporting the result as a PDF report.

The goal of the project is to demonstrate how predictive modeling can be integrated into a user-friendly application for decision support. Although the solution is designed for demonstration and educational purposes, it reflects the typical workflow used in real-world credit risk assessment systems.

Demo Link : https://credit-card-approval-project-s499bdg5brngduypqc4gkq.streamlit.app

Project Objective

The application helps users:

  • enter applicant-related information through a simple web interface
  • receive a prediction probability for approval
  • view a clear decision outcome based on a predefined threshold
  • download a PDF summary of the submitted information and prediction result

Key Features

  • Interactive Streamlit web interface
  • Pre-trained scikit-learn pipeline loaded from a serialized model file
  • Automatic feature alignment to match the training schema
  • Approval probability scoring with a binary decision output
  • PDF report generation using ReportLab
  • Clean and user-friendly presentation for demonstration purposes

Technologies Used

  • Python 3.11
  • Streamlit for the frontend/web interface
  • pandas for structured data handling
  • scikit-learn for the trained machine-learning pipeline
  • joblib for loading the serialized model
  • ReportLab for PDF generation
  • xgboost as part of the trained model dependencies

Project Structure

The repository contains the following main files:

How the Application Works

  1. The user opens the app in a browser.
  2. The application loads a pre-trained pipeline from the model file.
  3. The user fills in the applicant form with fields such as gender, income, education, housing, occupation, and employment details.
  4. The entered values are transformed into the feature structure expected by the trained pipeline.
  5. The model returns a probability score representing the likelihood of approval.
  6. A decision is assigned based on a threshold of 60% probability.
  7. The result is displayed in the interface and can be exported as a PDF document.

Model Details

The prediction logic relies on a pre-trained machine-learning pipeline stored in credit_card_pipeline.pkl. The pipeline includes preprocessing and the final classifier, allowing the application to handle the required input fields consistently.

Some values entered by the user are converted into the representation expected by the model. For example:

  • age and years employed are converted into day-based values used during training
  • the number of family members is derived from the number of children
  • a binary occupation flag is created depending on whether the occupation is marked as unknown

Installation and Setup

Follow the steps below to run the project locally.

1. Clone the Repository

git clone <repository-url>
cd Credit-Card-Approval-Project

2. Create a Virtual Environment

python -m venv .venv

3. Activate the Virtual Environment

On Windows:

.venv\Scripts\activate

On macOS/Linux:

source .venv/bin/activate

4. Install Dependencies

pip install -r requirements.txt

5. Run the Application

streamlit run credit_card_app.py

Once the app is running, it will open in the browser and you can begin entering applicant details.

Usage Instructions

  1. Launch the application using Streamlit.
  2. Fill in the form fields with the applicant information.
  3. Click the prediction button.
  4. Review the approval probability and decision.
  5. Download the generated PDF report if needed.

PDF Report Feature

The app generates a downloadable PDF file summarizing:

  • the final decision
  • the approval probability
  • the applicant details submitted in the form

The report is produced using ReportLab and is formatted for easy reading and sharing.

Notes and Limitations

This project is intended as a demonstration of an ML-powered application and should not be treated as a real-world credit decision system without proper validation, compliance review, and domain-specific testing.

Some limitations include:

  • the model is pre-trained and fixed for the current demonstration
  • the decision threshold is manually set and may not represent real business policy
  • the app uses a simplified input schema and does not include all possible financial or regulatory variables
  • real-world lending systems require rigorous monitoring, fairness assessment, and risk governance

Future Enhancements

Possible improvements for future versions include:

  • adding explainability features such as SHAP or feature importance charts
  • improving the UI with a more polished dashboard experience
  • adding input validation and better error handling
  • storing previous predictions for review
  • adding automated tests for the prediction flow

Conclusion

This project combines machine learning, web development, and report generation into a single interactive application. It demonstrates how a trained classification model can be wrapped in a user-friendly interface and used to support preliminary decision-making in a practical and understandable way.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages