A production-ready Machine Learning Engineering & MLOps portfolio project. This repository demonstrates how to transition from local Jupyter Notebooks to a fully automated, containerized, and deployable Machine Learning system.
This project implements a continuous integration and continuous deployment (CI/CD) pipeline for a Machine Learning model (Breast Cancer Classification using LightGBM). Instead of a traditional UI, the model is served via a highly scalable REST API using FastAPI and packaged inside a Docker container.
Whenever new code or data is pushed to this repository, GitHub Actions automatically:
- Installs dependencies.
- Runs unit tests via
pytest. - Retrains the Machine Learning model.
- Generates a performance report (Accuracy, F1-Score) and a Confusion Matrix.
- Posts the results directly to the GitHub Actions Job Summary.
- Model Training:
LightGBM,Scikit-Learn,Pandas,NumPy - Model Evaluation:
Matplotlib,Seaborn - API & Deployment:
FastAPI,Uvicorn - Containerization:
Docker - CI/CD & Automation:
GitHub Actions,Pytest
MLOps-Core/
├── .github/workflows/
│ └── ml_pipeline.yml # CI/CD Automation Pipeline
├── api/
│ └── main.py # FastAPI REST endpoint
├── src/
│ └── train.py # Model training and report generation script
├── tests/
│ ├── test_api.py # Pytest for FastAPI endpoints
│ └── test_model.py # Pytest for model training logic
├── models/ # Saved model (.pkl) (Generated automatically)
├── reports/ # Performance metrics and plots (Generated automatically)
├── Dockerfile # Instructions to containerize the API
└── requirements.txt # Python dependencies
If you have Docker installed, you can run the entire API in an isolated container without installing Python libraries on your machine.
# 1. Build the Docker Image
docker build -t mlops-core-api .
# 2. Run the Docker Container
docker run -d -p 8000:8000 mlops-core-apiOnce running, visit http://localhost:8000/docs to interact with the API via the automated Swagger UI.
# 1. Clone the repository
git clone https://github.com/DtScntst1/MLOps-Core.git
cd MLOps-Core
# 2. Install Dependencies
pip install -r requirements.txt
# 3. Train the model (generates models/model.pkl)
python src/train.py
# 4. Start the FastAPI server
uvicorn api.main:app --reloadCheck out the Actions tab in this repository! You will see the automated workflow. If any test fails, the pipeline stops, preventing bad code or poor models from reaching production. If it passes, the latest model metrics are automatically generated and displayed.