Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

AutoML Pipeline 🚀

An automated machine learning pipeline for model training, evaluation, and deployment with 75% cloud cost reduction through spot instance orchestration.

Features

Feature Details
Automated HPO Optuna TPE sampler + Hyperband pruning, 50 trials, parallel
Multi-Model Random Forest, XGBoost, LightGBM, Logistic Regression
Spot Instances Dynamic bid pricing, interruption handling, checkpointing
Cost Reduction ~75% savings vs on-demand through spot orchestration
Model Registry SQLite-backed versioning + auto-promotion to production
Blue/Green Deploy Health checks, automatic rollback on degradation
REST + WebSocket API FastAPI with real-time pipeline updates
Premium Dashboard Glassmorphism dark UI with live Chart.js visualizations

Project Structure

ML-pipeline/
├── config/
│   └── pipeline_config.yaml      # Master configuration
├── src/
│   ├── pipeline/
│   │   ├── orchestrator.py       # Main pipeline coordinator (async)
│   │   ├── data_ingestion.py     # Load, preprocess, split data
│   │   ├── hyperparameter_tuner.py # Optuna HPO engine
│   │   ├── trainer.py            # Multi-model trainer
│   │   ├── evaluator.py          # Metrics & reporting
│   │   └── model_registry.py     # SQLite registry
│   ├── resources/
│   │   ├── spot_orchestrator.py  # Spot instance lifecycle
│   │   ├── cost_monitor.py       # Real-time cost tracking
│   │   └── resource_allocator.py # Bin-packing scheduler
│   ├── deployment/
│   │   ├── deployer.py           # Blue/green deployment
│   │   └── model_server.py       # FastAPI inference layer
│   └── api/
│       ├── main.py               # FastAPI app (REST + WS)
│       └── websocket_manager.py  # Live broadcast manager
├── dashboard/
│   ├── index.html                # Single-page dashboard
│   ├── style.css                 # Glassmorphism dark theme
│   └── app.js                   # Chart.js + WebSocket client
├── scripts/
│   ├── run_pipeline.py           # CLI entry point
│   └── demo_dataset.py           # Synthetic dataset generator
├── tests/
│   └── test_pipeline.py          # Pytest suite
├── requirements.txt
├── Dockerfile
└── docker-compose.yml

Quick Start

1. Install Dependencies

cd "c:\Users\Bennerdo\OneDrive\Documents\PROJECTS\ML-pipeline"
pip install -r requirements.txt

2. Run Pipeline (CLI)

# Built-in datasets (iris, wine, breast_cancer, diabetes)
python scripts/run_pipeline.py --dataset iris

# Synthetic classification dataset
python scripts/run_pipeline.py --dataset synthetic_classification

# Skip HPO (faster)
python scripts/run_pipeline.py --dataset iris --no-tune

# Custom CSV file
python scripts/run_pipeline.py --dataset data/mydata.csv --target price --task-type regression

3. Start API Server

set PYTHONPATH=.
uvicorn src.api.main:app --reload --port 8000

Then open the dashboard: dashboard/index.html in your browser, or visit http://localhost:8000/docs for the Swagger API.

4. Docker (Full Stack)

docker compose up --build
# API:       http://localhost:8000
# Dashboard: http://localhost:3000

API Endpoints

Method Endpoint Description
GET /health Health check
POST /pipeline/run Trigger pipeline run
GET /pipeline/status Current run status
GET /registry/models List registered models
POST /registry/promote Promote model to stage
POST /models/{name}/predict Single prediction
POST /models/{name}/batch_predict Batch predictions
GET /cost/summary Cost savings report
WS /ws Real-time updates

Cost Savings

The pipeline achieves ~75% cost reduction by:

  1. Using spot instances for HPO (most expensive stage) at 25-35% of on-demand price
  2. Using spot instances for training and evaluation
  3. Only using on-demand for ingestion and deployment (reliability-critical)
  4. Checkpointing every 60s to survive spot interruptions
  5. Fallback to on-demand automatically after max retries
Stage Spot? Savings
Data Ingestion 0%
HPO Tuning 70-75%
Model Training 70-75%
Evaluation 70-75%
Deployment 0%
Overall ~75%

Configuration

Edit config/pipeline_config.yaml to tune:

  • hyperparameter_tuning.n_trials — number of Optuna trials
  • resources.profiles.*.spot_max_price_ratio — spot bid as fraction of on-demand
  • models.enabled — which model families to train
  • registry.promotion.min_improvement — score delta required to auto-promote

Running Tests

python -m pytest tests/ -v --tb=short

About

An automated machine learning pipeline that helps forge high perfomance models using industrial and cost effective infrastructure.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages