This project predicts loan approval outcomes (Approved/Rejected) using a neural network built with PyTorch.
- 🧠 Neural Network with multiple hidden layers using LeakyReLU activation function and Dropout
- ⚖️ Binary Cross-Entropy (BCEWithLogitsLoss) for training
- 🚀 Adam optimizer for gradient updates
- 🔀 Mini-batch training with
DataLoader
- 📊 Train/Validation/Test split for robust evaluation
- 📈 Live training & validation loss monitoring
- ✅ Sigmoid activation on the output to produce probabilities, with a threshold for Approved/Rejected decision
- 🎨 Interactive Gradio Interface for real-time prediction
Below is a preview of the Gradio Interface used for real-time classification:
- PyTorch – model, training, and inference
- pandas – data handling
- matplotlib – loss visualization
- pickle – saving/loading normalization params and trained model
- Gradio — interactive web interface for real-time model demos
- Python 3.13+
- Recommended editor: VS Code
- Clone the repository
git clone https://github.com/hurkanugur/Loan-Approval-Classifier.git
- Navigate to the
Loan-Approval-Classifier
directory
cd Loan-Approval-Classifier
- Install dependencies
pip install -r requirements.txt
View → Command Palette → Python: Create Environment
- Choose Venv and your Python version
- Select requirements.txt to install dependencies
- Click OK
assets/
└── app_screenshot.png # Screenshot of the application
data/
└── loan_data.csv # Raw dataset
model/
├── loan_approval_classifier.pth # Trained model (after training)
├── feature_transformer.pkl # Fitted preprocessing transformer
└── statistics.pkl # Preprocessing stats
src/
├── config.py # Paths, hyperparameters, split ratios
├── dataset.py # Data loading & preprocessing
├── device_manager.py # Selects and manages compute device
├── train.py # Training pipeline
├── inference.py # Inference pipeline
├── model.py # Neural network definition
└── visualize.py # Training/validation plots
main/
├── main_train.py # Entry point for training
└── main_inference.py # Entry point for inference
requirements.txt # Python dependencies
Input → Linear(128) → LeakyReLU(0.01) → Dropout(0.2)
→ Linear(64) → LeakyReLU(0.01) → Dropout(0.1)
→ Linear(32) → LeakyReLU(0.01)
→ Linear(8) → LeakyReLU(0.01)
→ Linear(1) → Sigmoid(Output)
Navigate to the project directory:
cd Loan-Approval-Classifier
Run the training script:
python -m main.main_train
or
python3 -m main.main_train
Navigate to the project directory:
cd Loan-Approval-Classifier
Run the app:
python -m main.main_inference
or
python3 -m main.main_inference