Cloud Machine Learning — SageMaker, Azure ML & Vertex AI Guide
In this tutorial, you'll learn about Cloud Machine Learning. We cover key concepts, practical examples, and best practices to help you understand and apply this topic effectively.
Cloud Machine Learning platforms provide end-to-end MLOps — managing data labeling, model training, hyperparameter tuning, deployment, and monitoring without building infrastructure from scratch.
What You'll Learn
You'll learn how to train and deploy ML models using SageMaker, Azure ML, and Vertex AI, including automated ML, managed training, and Serverless inference endpoints.
Why It Matters
Building and training ML models on your own servers is slow and expensive. Cloud ML platforms provide GPU clusters, distributed training, and managed serving — letting data scientists focus on model quality, not infrastructure. Durga Antivirus Pro uses SageMaker for malware detection models.
Real-World Use
A fraud detection company retrains its model daily on 50GB of Transaction data. SageMaker's managed training with 8 GPUs finishes in 20 minutes. The trained model deploys to a real-time endpoint that scores 10,000 transactions per second.
ML Platform Architecture
flowchart LR A[Raw Data] --> B[Data Labeling] B --> C[Feature Store] C --> D[Model Training] D --> E[Hyperparameter Tuning] E --> F[Model Registry] F --> G[Deployment] G --> H[Real-time Endpoint] G --> I[Batch Transform] H --> J[Monitoring & Drift Detection] style D fill:#48f,color:#fff style F fill:#f90,color:#fff
AWS SageMaker
SageMaker provides notebooks, training, tuning, and inference in one platform.
import sagemaker
from sagemaker import get_execution_role
from sagemaker.estimator import Estimator
role = get_execution_role()
estimator = Estimator(
image_uri="683313688378.dkr.ecr.us-east-1.amazonaws.com/sagemaker-xgboost:1.5-1",
role=role,
instance_count=1,
instance_type="ml.m5.2xlarge",
output_path="s3://my-model-artifacts/",
sagemaker_session=sagemaker.Session()
)
estimator.set_hyperparameters(
objective="binary:logistic",
num_round=100,
max_depth=5
)
estimator.fit({"train": "s3://my-training-data/train.csv"})
# Deploy trained model as endpoint
aws sagemaker create-endpoint-config \
--endpoint-config-name fraud-detection-config \
--production-variants \
VariantName=default,ModelName=fraud-model,InitialInstanceCount=1,InstanceType=ml.m5.large
aws sagemaker create-endpoint \
--endpoint-name fraud-detection \
--endpoint-config-name fraud-detection-config
Azure Machine Learning
Azure ML offers automated ML, designer, and responsible AI tools.
# Create Azure ML workspace
az ml workspace create \
--name dodatech-ml \
--resource-group my-rg \
--location eastus
# Submit a training job
az ml job create \
--file train.yml \
--resource-group my-rg \
--workspace-name dodatech-ml
# Azure ML training script
from azureml.core import Workspace, Experiment, ScriptRunConfig
ws = Workspace.from_config()
experiment = Experiment(workspace=ws, name="fraud-detection")
config = ScriptRunConfig(
source_directory="./src",
script="train.py",
compute_target="gpu-cluster",
arguments=["--data-path", "azureml://datastores/raw/data/"]
)
run = experiment.submit(config)
run.wait_for_completion(show_output=True)
GCP Vertex AI
Vertex AI unifies AutoML, custom training, and model deployment.
# Upload a dataset
gcloud ai datasets create \
--display-name="fraud-dataset" \
--metadata-schema-uri=schema/1.0/tabular.json \
--region=us-central1
# Submit a custom training job
gcloud ai custom-jobs create \
--region=us-central1 \
--display-name="fraud-training" \
--worker-pool-spec=machine-type=n1-standard-8,replica-count=1,container-image-uri="gcr.io/my-project/fraud-trainer"
# Deploy a model endpoint
gcloud ai endpoints create \
--display-name="fraud-endpoint" \
--region=us-central1
gcloud ai endpoints deploy-model \
--endpoint=fraud-endpoint \
--region=us-central1 \
--model=fraud-model \
--machine-type=n1-standard-4
Automated ML
# SageMaker Autopilot
from sagemaker import AutoML
automl = AutoML(
role=role,
target_attribute_name="fraud",
output_path="s3://my-automl-output/",
max_candidates=5,
max_runtime_per_training_job_in_seconds=3600
)
automl.fit(["s3://my-training-data/train.csv"])
Common Errors
- Not using spot instances for training — Training jobs can use spot instances at 60-90% discount. Use checkpointing so interrupted jobs resume from the last save.
- Overfitting to training data — ML models trained on imbalanced data fail in production. Use StratifiedSplit in SageMaker and monitor precision-recall.
- Ignoring data drift — Models degrade as real-world data changes. Set up monitoring to detect drift and trigger retraining automatically.
- Deploying oversized models — A 5GB model on a small instance causes high latency. Use SageMaker Neo or Azure ONNX Runtime for optimization.
- No A/B testing for model updates — Deploying a new model without validation risks regression. Use SageMaker production variants for canary deployments.
Practice Questions
- What is the difference between AutoML and custom training? AutoML automatically selects algorithms and tunes hyperparameters. Custom training gives full control over model architecture and training code.
- How do you manage ML model versions? Use the model registry (SageMaker Model Registry, Azure ML Registry, Vertex AI Model Registry) to track versions, stage models, and promote from staging to production.
- What is a batch transform vs real-time endpoint? Batch transforms process large datasets asynchronously. Real-time endpoints serve individual predictions with low latency.
- How do you handle GPU scarcity in training? Use multi-region training, spot instances, and prioritize jobs with a scheduling queue.
- Challenge: Design an MLOps pipeline that trains a model daily on 100GB of user activity data, evaluates against a holdout set, and rolls back if accuracy drops more than 2%.
Mini Project
Build a fraud detection ML pipeline:
- Upload labeled Transaction data to SageMaker
- Train an XGBoost model with Autopilot
- Deploy to a real-time endpoint
- Create a Lambda function that calls the endpoint per Transaction
- Monitor prediction quality with CloudWatch dashboards
FAQ
Built by the developers of Doda Browser, DodaZIP, and Durga Antivirus Pro.
Built by the developers of DodaTech
Doda Browser, DodaZIP & Durga Antivirus Pro