How kachiann/project-mlops works
Project Type and Purpose
• This is an end-to-end MLOps pipeline for bike-sharing demand prediction. It combines data ingestion, ML experiment tracking, workflow orchestration, model deployment, and monitoring.
• Key goals: train regression models on historical data, track experiments in MLflow, orchestrate tasks with Prefect, deploy a Flask API, and monitor data/model drift with Evidently and Grafana.
File Structure Analysis
• Top-level folders:
• data & production/reference CSVs
• notebooks for EDA and prototype training
• src: Python modules for experiment tracking, model registry, Prefect pipeline, monitoring dataset preparation
• web_service: Flask API, Docker/Kubernetes deployment manifests, tests
• monitoring: Evidently notebooks, Docker Compose, Grafana configs, metrics calculators
• monitoring_reports: drift reports
• Configuration files: Dockerfile, docker-compose.yml, Kubernetes YAMLs, Makefile, CI/CD workflows, lint/test configs
README Highlights
• MLflow for experiment tracking & model registry
• Prefect for workflow orchestration (data prep → training → registration → deployment)
• Flask + MLflow for REST API model serving
• Evidently + Grafana for production monitoring
a. Main Components (nodes)
• Data Storage – raw CSVs, reference & production data
• Prefect Orchestrator – executes pipeline flow in src/ml_pipeline.py
• MLflow Server – backend store (SQLite) + artifact store (mlruns), UI at port 5000
• Training & Registry – src/experiment_tracking.py, src/model_registry.py
• Model Artifacts – persisted in MLflow artifact store
• Web Service – Flask app in web_service/deploy.py, containerized via Dockerfile
• Kubernetes Cluster – deployment.yaml and service.yaml under web_service/kubernetes
• Monitoring Stack
– Evidently AI (data/model drift checks)
– Grafana + Prometheus (dashboards, metrics ingestion)
– Docker Compose orchestrating monitoring services
1. Raw data → Prefect → data ingestion & preprocessing tasks
2. Prefect → MLflow (logs parameters, metrics, artifacts)
3. Prefect → calls experiment_tracking → trains models → registers best model in MLflow Registry
4. Web Service → loads latest “Production” model from MLflow → serves REST predictions
5. In production: Web Service logs requests & outputs → monitoring datasets generated → Evidently calculates drift metrics → Grafana dashboards display alerts
6. CI/CD pipelines (GitHub Actions) push code → Docker images → Kubernetes cluster → auto-deploy new versions
c. Architectural Patterns & Principles
• Pipeline Orchestration (Prefect flow with tasks)
• Experiment Tracking & Reproducibility (MLflow + versioned dependencies)
• Microservice for model serving (Flask + Docker + K8s)
• Infrastructure as Code (Docker Compose, Kubernetes YAML)
• Observability (Evidently + Grafana dashboards)
d. Key Technologies & Frameworks
• Python, scikit-learn, pandas
• Prefect, MLflow
• Flask for REST API
• Docker & Docker Compose
• Kubernetes (deployment.yaml, service.yaml)
• Evidently AI, Grafana (dashboards, datasources YAML)
• CI/CD: GitHub Actions, pylint, pytest