Skip to content

Latest commit

 

History

History
147 lines (73 loc) · 7.33 KB

File metadata and controls

147 lines (73 loc) · 7.33 KB

Credit Card Defaulters Prediction

Introduction

To build a classification methodology to determine whether a person defaults the credit card payment for the next month.

Recently, the state vigorously promotes the economic construction of large- and medium-sized cities, which not only improves people’s living standards but also changes people’s consumption concept and consumption mode. People are more and more inclined to spend ahead of time and mortgage their “credit” to the bank to enjoy certain things in advance. However, when consuming, people often lack rational thinking and overestimate their ability to repay loans to banks in time. On the one hand, it increases the loan risk of banks; on the other hand, it increases the credit crisis of consumers themselves . With a large number of banks selling credit cards, the phenomenon of credit card default emerges one after another. It is very important for banks to effectively identify high-risk credit card default users.

In this project,On multiple parameters we predict Whether a person shall default in the credit card payment or not.

Project Architecture :

architecture

Data Description

The client will send data in multiple sets of files in batches at a given location. The data has been extracted from the census bureau.

Labels:

  • 1.]LIMIT_BAL: continuous.Credit Limit of the person.
  • 2.]SEX: Categorical: 1 = male; 2 = female
  • 3.]EDUCATION: Categorical: 1 = graduate school; 2 = university; 3 = high school; 4 = others
  • 4.]MARRIAGE: 1 = married; 2 = single; 3 = others
  • 5.]AGE-num: continuous.
  • 6.]PAY_0 to PAY_6: History of past payment. We tracked the past monthly payment records (from April to September, 2005)
  • 7.]BILL_AMT1 to BILL_AMT6: Amount of bill statements.
  • 8.]PAY_AMT1 to PAY_AMT6: Amount of previous payments.

Target Label:

Whether a person shall default in the credit card payment or not.

  • default payment next month: Yes = 1, No = 0.

Demo

  • Now first see the project folder structure: folder_structure

  • main.py is the entry point of our application, where the flask server starts main

  • This is the predictionFromModel.py file where the predictions take place based on the data we are giving input to the model predFromModel

  • Now run the main.py file which is entry point of application, The web app link is created by flask,Open the link in browser. host_link

-Open this link in browser, The Home Page of web app will open: HomePage


  • Now enter the folder directory where batch files are stored And click on predict. batchfilespredictpath

  • predictions: prediction

    1. All the files from batch directory are extracted and the data is saved on sql server.

    2. Data Export from Db - The data in the stored database is exported as a CSV file to be used for prediction.

    3. Clustering - KMeans model created during training is loaded, and clusters for the preprocessed prediction data is predicted.

    4. Prediction - Based on the cluster number, the respective model is loaded and is used to predict the data for that cluster.

    5. Once the prediction is made for all the clusters, the predictions along with the original names before label encoder are saved in a CSV file at a given location and the location is returned to the client.

prediction_output

Installation

  • The Code is written in Python 3.6.10. If you don't have Python installed you can find it here. If you are using a lower version of Python you can upgrade using the pip package, ensuring you have the latest version of pip.
  • The all code written through Moduler approach.I suggest to use PyCharm IDE as it is well designed for python.
  • Modular programming is a software design technique that emphasizes separating the functionality of a program into independent, interchangeable modules, such that each contains everything necessary to execute only one aspect of the desired functionality.
  • Therefore in this project for each funtion different module is made and we just have to import required modules where it is required
  • To install the required packages and libraries, run this command in the project directory after cloning the repository.
pip install -r requirements.txt

Deployement on Heroku

Login or signup in order to create virtual app. You can either connect your github profile or download ctl to manually deploy this project.

Our next step would be to follow the instruction given on Heroku Documentation to deploy a web app.

Technologies Used

Heroku

Python

Pandas logo

PyCharm Icon

Bug / Feature Request

If you find a bug (the website couldn't handle the query and / or gave undesired results), kindly open an issue here by including your search query and the expected result

Future Scope

  • Optimize Flask app.py
  • Front-End

Deployed Heroku app link

App link : https://credit-card-defaulters646.herokuapp.com/