Credit Default Prediction is a web application that predicts whether a customer will default on their credit based on various financial factors. The application uses an XGBoost model to make predictions and presents the results in an easy-to-use web interface.
- Predicts credit default using multiple financial features
- Displays the prediction (Default or No Default) without showing the probability
- Provides an explanation of the key factors influencing the prediction
- Visualizes input feature values and the relationship between age and debt ratio
- Backend: Python, Flask, Gunicorn
- Frontend: HTML, CSS, JavaScript, Chart.js
- Machine Learning: Scikit-learn (XGBoost)
- Deployment: Docker, Google App Engine
Ensure you have the following installed on your machine:
- Python 3.9
- Docker
- Google Cloud SDK (for deployment)
Follow these steps to set up the application locally:
-
Clone the Repository
git clone https://github.com/Tar-ive/credit-risk.git cd credit-default-prediction
-
Create and Activate Virtual Environment
python -m venv venv source venv/bin/activate # On Windows use `venv\Scripts\activate`
-
Install Dependencies
pip install -r requirements.txt
-
Run the Flask Application
gunicorn --bind :8080 model:app
Access the application at http://localhost:8080.
-
Docker Setup
Build Docker Image:
docker build -t credit-prediction-app .
Run Docker Container:
docker run -p 8080:8080 credit-prediction-app
Access the application at http://localhost:8080.
-
Authenticate with GCP
gcloud auth login
-
Set Your GCP Project
gcloud config set project YOUR_PROJECT_ID
-
Deploy the Application
gcloud app deploy
-
Access the Deployed Application Navigate to
https://YOUR_PROJECT_ID.uc.r.appspot.com
.
- Navigate to the Web Application
- Input Financial Data
- Get Prediction
- View Explanation and Charts
app.yaml
: Configuration file for Google App EngineDockerfile
: Docker configuration filerequirements.txt
: Python dependenciesmodel.py
: Main application codeindex.html
: Frontend code
Feel free to open issues or submit pull requests for improvements and bug fixes.
This project is licensed under the MIT License.
Inspired by various credit risk prediction projects and tutorials from LEARNERA.