Skip to content

This repository is dedicated to the development and exploration of artificial intelligence applications in the financial sector. It aims to provide tools, models, and methodologies to enhance decision-making processes in finance through data-driven insights.

Notifications You must be signed in to change notification settings

Chirumamilla1522/Financial-AI-FAI-

Repository files navigation

Loan Underwriting System

Overview

The Loan Underwriting System is an AI-powered application designed to automate and improve the loan approval process. It combines machine learning models and advanced natural language processing (NLP) using large language models (LLMs) to predict loan defaults, assess borrower risk, and ensure fairness and transparency in loan decisions.

Features

  • Predicts borrower risk using structured data like income, credit score, and loan amount.
  • Leverages LLMs to analyze unstructured data (e.g., borrower descriptions) and assign a risk score.
  • Implements Explainable AI (XAI) techniques to ensure transparent loan decisions.
  • User-friendly web application for inputting borrower details and viewing predictions.

Tech Stack

  • Backend: Flask
  • Frontend: React.js
  • Machine Learning: Scikit-learn, OpenAI API (for LLM integration)
  • Deployment: Localhost (ready for cloud deployment using Docker, AWS, or Heroku)

Installation

Prerequisites

  • Python 3.7 or later
  • Node.js and npm
  • Flask
  • Scikit-learn
  • OpenAI API key

Backend Setup

  1. Clone this repository:

    git clone https://github.com/yourusername/loan-underwriting-system.git
    cd loan-underwriting-system
  2. Create a virtual environment and install dependencies:

    python -m venv venv
    source venv/bin/activate  # On Windows: venv\Scripts\activate
    pip install -r requirements.txt
  3. Train or load the machine learning model:

    • If using a pre-trained model, place loan_underwriting_model.pkl in the project directory.
    • If training your own model, use the dataset and training script provided in train_model.ipynb.
  4. Add your OpenAI API key:

    • Replace your_openai_api_key in app.py with your OpenAI key.
  5. Start the Flask server:

    python app.py

    The backend will run on http://localhost:5000.

Frontend Setup

  1. Navigate to the frontend directory:

    cd frontend
  2. Install dependencies:

    npm install
  3. Start the React development server:

    npm start

    The frontend will run on http://localhost:3000.


Usage

  1. Open the web application in your browser: http://localhost:3000.
  2. Enter borrower details:
    • Income
    • Credit Score
    • Loan Amount
    • Borrower Description (optional unstructured data)
  3. Submit the form to get:
    • Loan risk prediction (Default Risk or Low Risk).
    • Risk score (1-5) generated by the LLM for the description.

File Structure

loan-underwriting-system/
│
├── app.py                     # Backend Flask application
├── loan_underwriting_model.pkl # Pre-trained ML model
├── requirements.txt           # Python dependencies
├── train_model.ipynb          # Notebook for training ML model
│
├── frontend/                  # React frontend
│   ├── src/
│   │   ├── App.js             # Main React app file
│   │   ├── index.js           # React DOM renderer
│   │   └── ...                # Other React components
│   └── package.json           # Frontend dependencies
│
└── README.md                  # Project documentation

Dataset

This system uses the Lending Club Loan Data, available on Kaggle. The dataset includes structured data like income, credit scores, and loan amounts, along with optional unstructured text fields for borrower descriptions.


Future Enhancements

  • Deploy the application on cloud platforms (AWS, Heroku, or GCP).
  • Add a database (PostgreSQL or MongoDB) to store loan applications and predictions.
  • Improve borrower description analysis with fine-tuned LLMs for domain-specific language.
  • Add multi-language support for borrower descriptions.
  • Enhance the UI with Material-UI or Bootstrap.

License

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


Contributing

Contributions are welcome! If you’d like to contribute, please fork the repository and submit a pull request.


Let me know if you need further assistance, like adding deployment steps or badges for the README!

About

This repository is dedicated to the development and exploration of artificial intelligence applications in the financial sector. It aims to provide tools, models, and methodologies to enhance decision-making processes in finance through data-driven insights.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages