π οΈ MLflow Hands-On Projects: From Experiment Tracking to Cloud Deployment

I am Bittu Sharma, a DevOps & AI Engineer with a keen interest in building intelligent, automated systems. My goal is to bridge the gap between software engineering and data science, ensuring scalable deployments and efficient model operations in production.! ππ²π'π ππΌπ»π»π²π°π I would love the opportunity to connect and contribute. Feel free to DM me on LinkedIn itself or reach out to me at bittush9534@gmail.com. I look forward to connecting and networking with people in this exciting Tech World.
Learning MLflow theory is great, but the real magic happens when you apply it in projects. Hands-on work helps you understand how MLflow fits into the end-to-end MLOps pipeline β from experiment tracking to deployment in production.
In this guide, weβll walk through 4 practical projects that will solidify your MLflow skills:
Experiment Tracking β Compare multiple ML models in MLflow UI.
Model Registry + Serving β Register best model, deploy as API with Docker.
CI/CD Pipeline β Automate ML lifecycle with MLflow + GitHub Actions + Kubernetes.
Cloud Deployment β Deploy model on AWS SageMaker or GCP Vertex AI.
πΉ Project 1: Experiment Tracking
π Goal: Train multiple ML models (RandomForest, XGBoost, Neural Net) and compare results in the MLflow Tracking UI.
Steps:
- Install dependencies:
pip install mlflow scikit-learn xgboost tensorflow
- Train & log models:
import mlflow
import mlflow.sklearn
import mlflow.xgboost
import mlflow.tensorflow
from sklearn.ensemble import RandomForestClassifier
from xgboost import XGBClassifier
from tensorflow.keras.models import Sequential
from tensorflow.keras.layers import Dense
# Start MLflow experiment
mlflow.set_experiment("model_comparison")
def train_random_forest(X_train, y_train, X_test, y_test):
with mlflow.start_run(run_name="RandomForest"):
model = RandomForestClassifier(n_estimators=100)
model.fit(X_train, y_train)
acc = model.score(X_test, y_test)
mlflow.log_param("n_estimators", 100)
mlflow.log_metric("accuracy", acc)
mlflow.sklearn.log_model(model, "model")
def train_xgboost(X_train, y_train, X_test, y_test):
with mlflow.start_run(run_name="XGBoost"):
model = XGBClassifier(n_estimators=100, max_depth=5)
model.fit(X_train, y_train)
acc = model.score(X_test, y_test)
mlflow.log_params({"n_estimators": 100, "max_depth": 5})
mlflow.log_metric("accuracy", acc)
mlflow.xgboost.log_model(model, "model")
- Compare runs in the MLflow UI:
mlflow ui
π Youβll see side-by-side metrics & artifacts to pick the best model.
πΉ Project 2: Model Registry + Serving with Docker
π Goal: Register your best model in MLflow Model Registry and deploy it as a REST API using Docker.
Steps:
- Register best model in Registry:
result = mlflow.register_model(
"runs:/<RUN_ID>/model", "fraud_detection_model"
)
- Serve model locally:
mlflow models serve -m "models:/fraud_detection_model/1" -p 5000
- Build Docker image:
mlflow models build-docker -m "models:/fraud_detection_model/1" -n fraud-model-api
docker run -p 5000:8080 fraud-model-api
- Test API endpoint:
curl -X POST http://127.0.0.1:5000/invocations \
-H "Content-Type: application/json" \
-d '{"columns":["feature1","feature2"],"data":[[1.2,3.4]]}'
β You now have a production-ready API served with MLflow + Docker.
πΉ Project 3: CI/CD Pipeline with GitHub Actions + Kubernetes
π Goal: Automate model training, registry, and deployment using MLflow, GitHub Actions, and Kubernetes.
Workflow:
- GitHub Actions YAML (
.github/workflows/mlops.yml):
name: MLflow CI/CD
on:
push:
branches: [ main ]
jobs:
train-and-deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install dependencies
run: pip install -r requirements.txt
- name: Train & Log Model
run: python train.py
- name: Deploy to Kubernetes
run: kubectl apply -f k8s/deployment.yaml
- Kubernetes Deployment YAML (
k8s/deployment.yaml):
apiVersion: apps/v1
kind: Deployment
metadata:
name: fraud-model
spec:
replicas: 2
selector:
matchLabels:
app: fraud-model
template:
metadata:
labels:
app: fraud-model
spec:
containers:
- name: fraud-model
image: fraud-model-api:latest
ports:
- containerPort: 8080
β Every time you push code β GitHub Actions retrains model β Deploys new version on Kubernetes.
πΉ Project 4: Cloud Deployment (AWS SageMaker / GCP Vertex AI)
a) AWS SageMaker Deployment
import mlflow.sagemaker as mfs
mfs.deploy(
app_name="fraud-detector",
model_uri="models:/fraud_detection_model/Production",
region_name="us-east-1",
mode="create"
)
Creates a SageMaker Endpoint.
Supports scaling & IAM-based access.
b) GCP Vertex AI Deployment
import mlflow.models
mlflow.models.deploy(
name="fraud-detector-gcp",
model_uri="models:/fraud_detection_model/Production",
platform="gcp-vertex-ai",
region="us-central1"
)
Deploys to a managed Vertex AI endpoint.
Supports autoscaling and A/B testing.
β Both clouds provide enterprise-ready, scalable model serving.
πΉ Summary
With these hands-on projects, youβve taken MLflow from concept β production-ready workflows:
Experiment Tracking β Compare models in MLflow UI.
Model Registry + Serving β Deploy as REST API with Docker.
CI/CD Pipeline β Automate ML lifecycle with GitHub Actions + Kubernetes.
Cloud Deployment β Push to AWS SageMaker or GCP Vertex AI.
π These projects will make your MLflow journey resume-ready and prove your end-to-end MLOps capability.
Follow me on LinkedIn
Follow me on GitHub




