Back to Research Journal
Machine Learning8 min read

How I Built a US Visa Prediction ML Pipeline

A complete walkthrough of building an end-to-end Machine Learning pipeline with modular architecture, Docker deployment, and CI/CD.

Golam Monayem

Golam Monayem

2026-08-15 • Dhaka, Bangladesh

How I Built a US Visa Prediction ML Pipeline - Cover

The Problem

Predicting US Visa approval is a classic classification problem with real-world impact. When applicants submit their petitions, dozens of variables—from education levels and prevailing wage rates to employer history and job codes—determine the outcome.

I wanted to build not just an isolated machine learning model in a Jupyter Notebook, but a production-grade ML pipeline that follows modern software engineering best practices.

A machine learning model in a notebook is only an experiment. True engineering begins when that model can reliably ingest data, retrain, and serve predictions in production.

Architecture Overview

The project adheres to a modular design pattern where each lifecycle stage is decoupled and reproducible:

  • Data Ingestion — Fetching raw records from MongoDB, validating schema types, and creating train/test splits.
  • Data Transformation — Handling numerical imputation, categorical encoding with target encoding, and standardizing features.
  • Model Training — Comparing Random Forest, XGBoost, CatBoost, and Gradient Boosting with automated hyperparameter tuning.
  • Model Evaluation — Evaluating F1-score, precision-recall AUC, and verifying model drift thresholds.
  • Model Deployment — Serving inference via a Flask REST API containerized with Docker.
python
# Pipeline runner snippet
from src.pipeline.training_pipeline import TrainPipeline

if __name__ == '__main__':
    pipeline = TrainPipeline()
    pipeline.run_pipeline()
    print("Pipeline executed successfully with optimized artifact generation.")

Key Learnings & Takeaways

  1. Modular Code Over Monoliths: Splitting components into separate entity, configuration, and execution layers makes debugging effortless.
  2. Custom Logging & Exception Handling: Tracking custom exception hooks with line numbers and file contexts saved hours of troubleshooting.
  3. Docker Reproducibility: Containerizing the environment ensures identical runtime behavior across local development and AWS ECS.
  4. CI/CD Automation: GitHub Actions running automated unit tests and Docker image builds ensures no broken code enters production.

The Tech Stack

  • Language & Libraries: Python 3.10, Scikit-learn, Pandas, NumPy, XGBoost
  • Backend & Serving: Flask, Gunicorn
  • DevOps & Cloud: Docker, GitHub Actions, AWS ECR, AWS EC2, MongoDB Atlas
Building an end-to-end pipeline taught me more about production software engineering than any standalone course ever could.
Golam Monayem
About the Author

Golam Monayem

Machine Learning Engineer & Visual Designer based in Dhaka, Bangladesh. Studying CSE at Presidency University, team member at Wice BD, and building production-grade AI systems.