Subrat1920/Hotel-Reservation-Cancellation-Detection-MLOps
Predict which customers are likely to cancel their reservation or checkout before check-in using historical hotel booking data. This enables hotels to take proactive actions to reduce revenue loss.
Hotel Reservation Prediction
Project Goal:
Predict which customers are likely to cancel their reservation or checkout before check-in using historical hotel booking data. This enables hotels to take proactive actions to reduce revenue loss.
Table of Contents
- Project Overview
- Features
- Tech Stack
- Architecture & Pipeline
- Installation
- Usage
- Project Structure
- Contribution
Project Overview
The Hotel Reservation Prediction project is an end-to-end machine learning solution for predicting early checkouts or cancellations. The pipeline automates data ingestion, preprocessing, model training, and deployment using modern CI/CD practices. A Flask-based web app allows interactive prediction requests via Docker deployment.
Features
- Predict customer checkout behavior before check-in.
- ML model trained with LightGBM.
- Automated preprocessing and feature engineering.
- Experiment tracking with MLflow.
- Fully automated CI/CD pipeline using Jenkins, Docker, and Google Cloud Platform (GCP).
- Integration with GCP Buckets and Container Registry.
- Role-based access with IAMs and service accounts.
- Flask web app for serving predictions in real-time.
Tech Stack
- Programming: Python
- Data Processing & ML: Pandas, NumPy, LightGBM, Scikit-learn
- Web App: Flask
- CI/CD: Jenkins, Docker, GitHub
- Cloud: Google Cloud Platform (GCP) โ Storage Buckets, Container Registry
- Experiment Tracking: MLflow
- Version Control: Git & GitHub
Architecture & Pipeline
- Data Ingestion: Raw hotel booking data stored in GCP buckets is ingested via Python scripts.
- Data Processing: Cleaning, preprocessing, and feature engineering applied to prepare training datasets.
- Model Training: LightGBM model is trained, evaluated, and saved to
artifacts/models. - MLflow Tracking: All experiments, metrics, and models are tracked for reproducibility.
- Deployment:
- Flask app serves predictions.
- Docker image built and pushed to GCP Container Registry.
- Deployed with full CI/CD pipeline using Jenkins.
- Automation & Security:
- Jenkins pipelines handle automated builds, tests, and deployments.
- IAM roles and service accounts secure GCP resources.
Installation
- Clone the repository:
git clone https://github.com/Subrat1920/Hotel-Reservation-Cancellation-Detection-MLOps.git
cd Hotel-Reservation-Prediction- Install dependencies:
pip install -r requirements.txt- Set environment variables for GCP authentication (if using service accounts):
export GOOGLE_APPLICATION_CREDENTIALS="path/to/service-account.json"Usage
A. Local Execution (Training & Prediction)
- Start the Flask app:
python app.py- Access the app at http://localhost:5000 to make predictions.
B. Dockerized Deployment
- Build the Docker image:
docker build -t hotel-reservation-prediction .- Run the container:
docker run -p 8080:8080 hotel-reservation-prediction-
Access at http://localhost:8080.
-
CI/CD Pipeline
Jenkinsfile handles automated cloning, testing, building, pushing Docker image to GCP, and deploying.
Project Structure
โโโ ๐ artifacts/
โ โโโ ๐ models/
โ โ โโโ ๐ lgbm_model.pkl
โ โโโ ๐ processed/
โ โ โโโ ๐ process_test.csv
โ โ โโโ ๐ process_train.csv
โ โโโ ๐ raw/
โ โโโ ๐ raw.csv
โ โโโ ๐ test.csv
โ โโโ ๐ train.csv
โโโ ๐ config/
โ โโโ ๐ __init__.py
โ โโโ โ๏ธ config.yaml
โ โโโ ๐ model_params.py
โ โโโ ๐ path_config.py
โโโ ๐ custom_jenkins/
โ โโโ ๐ณ Dockerfile
โโโ ๐ pipeline/
โ โโโ ๐ __init__.py
โ โโโ ๐ training_pipeline.py
โโโ ๐ src/
โ โโโ ๐ __init__.py
โ โโโ ๐ data_ingestion.py
โ โโโ ๐ data_processing.py
โ โโโ ๐ exception.py
โ โโโ ๐ logger.py
โ โโโ ๐ model_training.py
โโโ ๐ static/
โ โโโ ๐จ style.css
โโโ ๐ templates/
โ โโโ ๐ index.html
โโโ ๐ utils/
โ โโโ ๐ __init__.py
โ โโโ ๐ common_functions.py
โโโ ๐ซ .gitignore
โโโ ๐ณ Dockerfile
โโโ ๐ Jenkinsfile
โโโ ๐ README.md
โโโ ๐ app.py
โโโ ๐ requirements.txt
โโโ ๐ setup.pyContributing
Fork the repository.
Create a feature branch: git checkout -b feature-name
Commit your changes: git commit -m "Add feature"
Push to branch: git push origin feature-name
Create a Pull Request.