Create README.md
Browse files
README.md
CHANGED
|
@@ -1,3 +1,57 @@
|
|
| 1 |
---
|
| 2 |
license: mit
|
|
|
|
| 3 |
---
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
---
|
| 2 |
license: mit
|
| 3 |
+
pipeline_tag: text-classification
|
| 4 |
---
|
| 5 |
+
# Nexus Bank Loan Default Prediction Model
|
| 6 |
+
|
| 7 |
+
This is a machine learning model to predict loan defaulters for Nexus Bank.
|
| 8 |
+
|
| 9 |
+
## Usage
|
| 10 |
+
|
| 11 |
+
To use the model, you can input the salary and number of dependents of a customer, and it will predict whether they are likely to default on their loan.
|
| 12 |
+
|
| 13 |
+
## Dependencies
|
| 14 |
+
|
| 15 |
+
- pandas
|
| 16 |
+
- numpy
|
| 17 |
+
- seaborn
|
| 18 |
+
- matplotlib
|
| 19 |
+
- scikit-learn
|
| 20 |
+
- gradio
|
| 21 |
+
|
| 22 |
+
## Data Source
|
| 23 |
+
|
| 24 |
+
The data used for training this model was obtained from Nexus Bank.
|
| 25 |
+
|
| 26 |
+
import pandas as pd
|
| 27 |
+
import numpy as np
|
| 28 |
+
import seaborn as sns
|
| 29 |
+
import matplotlib.pyplot as plt
|
| 30 |
+
%matplotlib inline
|
| 31 |
+
nexus_bank = pd.read_csv('nexus_bank_dataa.csv')
|
| 32 |
+
nexus_bank.head()
|
| 33 |
+
from sklearn.model_selection import train_test_split
|
| 34 |
+
X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.15, random_state=90)
|
| 35 |
+
from sklearn.neighbors import KNeighborsClassifier
|
| 36 |
+
knn_classifier =KNeighborsClassifier()
|
| 37 |
+
knn_classifier.fit(X_train,y_train)
|
| 38 |
+
knn_predict = knn_classifier.predict(X_test)
|
| 39 |
+
knn_predict
|
| 40 |
+
import gradio as gr
|
| 41 |
+
|
| 42 |
+
# Prediction function
|
| 43 |
+
def predict_defaulter(salary, dependents):
|
| 44 |
+
input_data = [[salary, dependents]]
|
| 45 |
+
knn_predict = knn_classifier.predict(input_data)
|
| 46 |
+
return "Yes! its Defaulter" if knn_predict[0] == 1 else "No! its not Defaulter"
|
| 47 |
+
|
| 48 |
+
# Interface
|
| 49 |
+
interface = gr.Interface(
|
| 50 |
+
fn=predict_defaulter,
|
| 51 |
+
inputs=["number", "number"],
|
| 52 |
+
outputs="text",
|
| 53 |
+
title="Defaulter Prediction"
|
| 54 |
+
)
|
| 55 |
+
|
| 56 |
+
# Launch the interface
|
| 57 |
+
interface.launch()
|