Skip to content

Repository files navigation

Text Classification MLOps Pipeline

Overview

This project builds an end-to-end text classification pipeline that turns raw review text into model-ready features, trains classification models, and packages the workflow for repeatable deployment. The goal is to demonstrate a practical MLOps workflow for NLP classification, including data versioning, pipeline configuration, model evaluation, containerization, and deployment-ready structure.

Business Problem

Organizations often need to classify large volumes of text such as customer feedback, support tickets, reviews, or documents. Manual review does not scale, and inconsistent classification can slow down decision-making. This project shows how an NLP model can automate text classification while keeping the workflow reproducible, testable, and easier to deploy.

Dataset

Dataset: IMDb Review Dataset
Records Used: Subset of the 50,000-review IMDb dataset
Target: Sentiment label

The dataset contains movie reviews labeled by sentiment. This project uses a subset of the full IMDb dataset to train and evaluate a supervised NLP classification pipeline.

Methodology

  • Ingested raw text data and prepared it for supervised classification
  • Cleaned and transformed text using NLP preprocessing techniques
  • Configured a modular machine learning pipeline with reusable components
  • Trained and evaluated classification models using standard classification metrics
  • Versioned data and pipeline stages with DVC for reproducibility
  • Packaged the application for deployment using Docker
  • Structured the project with source code, tests, configuration files, and CI/CD workflow support

Model Evaluation

Metric Result
Accuracy 79.0%
Precision 81.1%
Recall 79.6%
F1-score 80.4%
Mean CV Score 74.7%
CV Std. Dev. 4.8%

The model achieved an F1-score of 80.4%, with balanced precision and recall. MLflow was used during experimentation to track metrics and compare model performance across runs.

MLOps Workflow

This project is structured to support a repeatable machine learning workflow:

  • Data versioning: DVC tracks dataset and pipeline artifacts
  • Pipeline configuration: params.yaml manages pipeline parameters
  • Experiment tracking: MLflow tracks model metrics and experiment results
  • Experiment structure: notebooks and reports support model development and evaluation
  • Application packaging: Flask app provides a deployment-ready prediction interface
  • Containerization: Dockerfile supports reproducible runtime setup
  • Automation: GitHub Actions workflow structure supports testing and CI/CD steps

Tech Stack

Python, Pandas, Scikit-learn, NLP preprocessing, DVC, MLflow, Docker, Flask, GitHub Actions, CI/CD

Project Structure

text-classification-mlops-pipeline/
├── .dvc/
├── .github/workflows/
├── docs/
├── flask_app/
├── models/
├── notebooks/
├── references/
├── reports/
├── scripts/
├── src/
├── tests/
├── Dockerfile
├── dvc.yaml
├── Makefile
├── params.yaml
├── requirements.txt
├── setup.py
└── README.md

How to Run

git clone https://github.com/amit4009/text-classification-mlops-pipeline.git
cd text-classification-mlops-pipeline
pip install -r requirements.txt
cd flask_app
python app.py

Run the DVC Pipeline

cd text-classification-mlops-pipeline
dvc repro

Future Improvements

  • Add class distribution and preprocessing details
  • Add confusion matrix and model comparison table
  • Add model drift checks for changing review language patterns
  • Add API endpoint examples for prediction requests
  • Add screenshots of the Flask interface or deployment output

About

End-to-end NLP text classification pipeline with DVC, Docker, MLflow tracking, CI/CD workflow, and Flask deployment.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages