Skip to content

githubaravind/loan-approval-prediction-using-AI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Loan Prediction with AI and Streamlit

Streamlit

image image image

This project demonstrates how AI and Machine Learning can be applied to loan prediction in the financial industry. By leveraging Streamlit, we've deployed a Gaussian Naïve Bayes (GNB) model that predicts loan approval based on user inputs. The aim is to create a seamless, automated process for loan applications, improving efficiency and accuracy.

Demo

Try the loan prediction app here: Loan Checker AI


Features

  • Automated Loan Predictions: Instantly predicts whether a loan will be approved or rejected based on user input.
  • Streamlit Deployment: The app is deployed using Streamlit, offering an interactive and user-friendly experience.
  • Gaussian Naïve Bayes Model: A machine learning model trained on a loan prediction dataset.
  • Real-Time Predictions: The app processes user inputs in real-time to predict loan approval status.

Dataset

The dataset used in this project contains 13 variables, including:

  • Loan_ID: Unique loan reference number
  • ApplicantIncome: The income of the applicant
  • LoanAmount: The loan amount requested
  • Credit_History: Key variable indicating the applicant's credit history
  • Property_Area: The area of the applicant's residence (Urban, Semi-Urban, or Rural)

Link to Dataset

Model Overview

The loan prediction model is built using Gaussian Naïve Bayes (GNB). Key performance metrics:

  • Training Accuracy: 85.2%
  • Test Accuracy: 81.82%

The model is trained to predict whether a loan will be approved based on various factors like credit history, income, and property area.

Installation

To run this project locally, follow these steps:

1. Clone the repository

git clone [https://github.com/githubaravind/loan-approval-prediction-using-AI]```

### 2. Install the required packages
Ensure you have Python 3.6+ and the following packages installed:
```bash
pip install streamlit pandas scikit-learn joblib

3. Run the application

Navigate to the project directory and run the app:

streamlit run main.py

The app will be available at http://localhost:8501.

Model Training

The model was trained on Kaggle using the loan prediction dataset. You can find the Kaggle notebook here:

For training, we used the following features:

  • Applicant Income
  • Loan Amount
  • Credit History
  • Property Area
  • Dependents

Exporting the Model

The trained model was exported using Pickle and Joblib for integration with the Streamlit app:

from joblib import dump
dump(GNB, 'gnb_model.joblib')

App Deployment

The app is deployed using Streamlit Community Cloud. To deploy the app yourself:

  1. Push the repository to GitHub.
  2. Log in to Streamlit.
  3. Select your GitHub repository and deploy your app.

File Structure

Loan-Prediction/
│
├── .streamlit/
│   └── config.toml      # Streamlit configuration
├── dataset/
│   └── processed_dataset.csv  # Cleaned dataset used for prediction
├── models/
│   └── gnb_model.pkl    # Trained model
├── web/
│   ├── main.py          # Main application script
│   ├── predict.py       # Prediction logic
│   ├── dialogs.py       # Dialogs and UI elements
│   └── hooks.py         # Utility functions
└── README.md            # Project documentation

Contributing

Feel free to fork this repository, submit issues, or open pull requests. Contributions are welcome!

License

This project is licensed under the MIT License - see the LICENSE file for details.


Acknowledgments

  • Kaggle Community for the loan prediction dataset and analysis tools.
  • Streamlit for providing an easy-to-use deployment framework.
  • Special thanks to Hassan for the insightful Exploratory Data Analysis (EDA) on the dataset.

If you found this project helpful or have any questions, feel free to reach out! reddyaravind2201@gmail.com

About

Deploying Machine Learning Models with Streamlit and Python on Loan Predictions for Business

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published