Predicts whether a customer will purchase vehicle insurance — end-to-end, production-ready.
Full MLOps pipeline from raw data to a Dockerized Flask app deployed on AWS EC2.
Insurance companies need to identify which existing health insurance customers are likely to also purchase vehicle insurance. This reduces cold outreach, improves conversion rates, and optimises premium pricing strategy.
This application takes customer profile inputs and predicts the likelihood of insurance purchase using a trained classification model.
Raw Data
│
▼
Data Ingestion ──▶ Data Validation ──▶ Data Transformation
│
▼
Model Training
│
▼
Model Evaluation
│
▼
Flask Web Application
│
┌────────────────┴────────────────┐
▼ ▼
Docker Image CI/CD Pipeline
│ (GitHub Actions)
▼ │
AWS ECR Registry ◀────────────────────-─┘
│
▼
AWS EC2 Server
- Binary Classification — Predicts Yes/No insurance purchase likelihood
- Full MLOps Pipeline — Automated data ingestion → validation → transformation → training → evaluation
- Modular Codebase — Clean
src/structure with separate components for each pipeline stage - Flask Web App — Simple, responsive UI for real-time predictions
- Dockerized — Fully containerized for consistent deployment anywhere
- CI/CD via GitHub Actions — Auto-builds Docker image and deploys to AWS EC2 on every push
- Configurable — All parameters managed via
config/— no hardcoding
vehicle-insurance-prediction/
│
├── src/
│ ├── components/ # Pipeline stages: ingestion, validation, transformation, training
│ ├── pipeline/ # Training & prediction pipeline orchestration
│ ├── entity/ # Data classes for config and artifact entities
│ └── utils/ # Common utilities
│
├── config/ # YAML config files for all pipeline parameters
├── notebook/ # EDA and model experimentation notebooks
├── templates/ # Flask HTML templates
├── static/css/ # Frontend styling
│
├── .github/workflows/ # CI/CD pipeline (GitHub Actions → AWS EC2)
│
├── app.py # Flask application entry point
├── Dockerfile # Container definition
├── setup.py # Package setup
├── pyproject.toml # Build config
├── requirements.txt # Dependencies
└── README.md
1. Clone the repo
git clone https://github.com/Siddharth9o9/Vehicle-Insurance-Prediction-End-To-End-Application.git
cd Vehicle-Insurance-Prediction-End-To-End-Application2. Create virtual environment
python -m venv venv
source venv/bin/activate # macOS / Linux
venv\Scripts\activate # Windows3. Install dependencies
pip install -r requirements.txt4. Run the training pipeline
python demo.py5. Launch the Flask app
python app.pyOpen http://localhost:5000 in your browser.
# Build the image
docker build -t vehicle-insurance-prediction .
# Run the container
docker run -p 5000:5000 vehicle-insurance-prediction| Layer | Technology |
|---|---|
| ML & Data | Python, scikit-learn, pandas, NumPy |
| Experimentation | Jupyter Notebook |
| Web App | Flask, HTML/CSS |
| Containerization | Docker |
| CI/CD | GitHub Actions |
| Cloud | AWS EC2, AWS ECR |
| Config Management | YAML-based config system |
1. Data Ingestion — Loads raw dataset, splits into train/test sets, stores artifacts
2. Data Validation — Schema checks, null detection, distribution validation against expected schema
3. Data Transformation — Feature engineering, encoding, scaling — outputs a transformation artifact
4. Model Training — Trains classifier, tunes hyperparameters, saves model artifact
5. Model Evaluation — Compares new model against production baseline, promotes only if improved
6. Prediction Pipeline — Loads saved model + transformer, runs inference on new inputs from the Flask UI
git push ──▶ GitHub Actions triggered
│
▼
Run tests & lint
│
▼
docker build & push ──▶ AWS ECR
│
▼
Pull & run on AWS EC2
Every push to main automatically builds a fresh Docker image, pushes it to ECR, and redeploys on the EC2 instance — zero manual steps.
| Attribute | Detail |
|---|---|
| Task | Binary Classification |
| Target | Will customer buy vehicle insurance? (Yes / No) |
| Key Features | Age, Gender, Vehicle Age, Prior Damage, Prior Insurance, Premium, Sales Channel |
| Evaluation Metric | ROC-AUC, F1-Score |
MIT — free to use, modify, and distribute.