Skip to content

Latest commit

 

History

History
143 lines (106 loc) · 2.62 KB

File metadata and controls

143 lines (106 loc) · 2.62 KB

Quick Start Guide

Get started with ML Service Framework in 5 minutes!

Installation

pip install ml-service-framework

Note: The GitHub repo is MLOps-Boilerplate, but install via ml-service-framework.

Create Your First Project

# Create a new project
ml-create-project my-first-ml-project

# Navigate to project
cd my-first-ml-project

# Set up environment
python -m venv venv
source venv/bin/activate  # Windows: venv\Scripts\activate

# Install dependencies
pip install -r requirements.txt

Configure Your Project

# Copy environment template
cp .env.example .env

# Edit configuration
nano .env  # or use your favorite editor

Train Your First Model

1. Prepare Your Data

Place your CSV data in data/raw/train.csv with a target column.

2. Update Configuration

Edit config/training_config.json:

{
  "data_source": {
    "type": "file",
    "path": "data/raw/train.csv"
  },
  "target_column": "your_target_column",
  "model": {
    "type": "random_forest",
    "n_estimators": 100
  }
}

3. Train the Model

ml-train --config config/training_config.json

4. Run Inference

ml-inference --model-path models/model.joblib \
             --input-path data/raw/test.csv \
             --output-path predictions.csv

5. Serve via API

ml-serve --model-path models/model.joblib --port 8000

Test the API:

curl -X POST http://localhost:8000/predict \
  -H "Content-Type: application/json" \
  -d '{"features": {"feature1": 1.0, "feature2": 2.0}}'

Next Steps

Common Use Cases

Train with Different Models

# XGBoost
{
  "model": {
    "type": "xgboost",
    "n_estimators": 200,
    "learning_rate": 0.1
  }
}

Use Database as Data Source

{
  "data_source": {
    "type": "database",
    "connector_type": "postgresql",
    "connection_config": {
      "host": "localhost",
      "database": "mydb"
    },
    "query": "SELECT * FROM training_data"
  }
}

Enable Experiment Tracking

from ml_service.machine_learning.experiment_tracking import MLflowTracker

tracker = MLflowTracker()
tracker.log_training_run(config, metrics, model)

Need Help?