Skip to content

Navigation Menu

Sign in
Sign up

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

AltStyle γ«γ‚ˆγ£γ¦ε€‰ζ›γ•γ‚ŒγŸγƒšγƒΌγ‚Έ (->γ‚ͺγƒͺγ‚ΈγƒŠγƒ«) /