EngrSamad's picture
Create README.md
82a331b verified
|
raw
history blame
1.47 kB
metadata
license: mit
pipeline_tag: text-classification

Nexus Bank Loan Default Prediction Model

This is a machine learning model to predict loan defaulters for Nexus Bank.

Usage

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.

Dependencies

  • pandas
  • numpy
  • seaborn
  • matplotlib
  • scikit-learn
  • gradio

Data Source

The data used for training this model was obtained from Nexus Bank.

import pandas as pd import numpy as np import seaborn as sns import matplotlib.pyplot as plt %matplotlib inline nexus_bank = pd.read_csv('nexus_bank_dataa.csv') nexus_bank.head() from sklearn.model_selection import train_test_split X_train, X_test, y_train, y_test = train_test_split( X, y, test_size=0.15, random_state=90) from sklearn.neighbors import KNeighborsClassifier knn_classifier =KNeighborsClassifier() knn_classifier.fit(X_train,y_train) knn_predict = knn_classifier.predict(X_test) knn_predict import gradio as gr

Prediction function

def predict_defaulter(salary, dependents): input_data = [[salary, dependents]] knn_predict = knn_classifier.predict(input_data) return "Yes! its Defaulter" if knn_predict[0] == 1 else "No! its not Defaulter"

Interface

interface = gr.Interface( fn=predict_defaulter, inputs=["number", "number"], outputs="text", title="Defaulter Prediction" )

Launch the interface

interface.launch()