Skip to main content

Train Models with Azure Machine Learning

Azure Machine Learning provides multiple ways to train machine learning models at scale, from interactive development to distributed training on powerful compute clusters.
Azure ML supports training with popular frameworks including PyTorch, TensorFlow, Scikit-learn, XGBoost, and more.

Training Methods

Python SDK

Programmatic job submission with full control

Azure CLI

Command-line training for automation and CI/CD

Studio UI

Visual interface for no-code training

Prerequisites

Before training models, ensure you have:
1

Azure Subscription

Active Azure subscription (create free account)
2

ML Workspace

Azure Machine Learning workspace (create workspace)
3

Development Tools

  • Python SDK v2: pip install azure-ai-ml
  • Azure CLI with ML extension: az extension add -n ml
4

Training Data

Data stored in Azure Storage or registered as data assets

Training Workflow

The typical training workflow in Azure Machine Learning:
1

Connect to Workspace

Authenticate and connect to your ML workspace
2

Prepare Data

Load and register training data as assets
3

Create Environment

Define software dependencies for training
4

Configure Compute

Select compute target for training job
5

Define Training Job

Specify training script, parameters, and resources
6

Submit Job

Execute training and monitor progress
7

Register Model

Save trained model to model registry

Connect to Workspace

Example: Train Scikit-learn Model

Complete example training an iris classification model:

1. Training Script

Create train.py:

2. Submit Training Job

Training on Different Compute

Use managed compute clusters for scalable training:
When to use:
  • Large datasets requiring multiple nodes
  • Long-running training jobs
  • Distributed training
  • Hyperparameter tuning

Using Curated Environments

Azure ML provides pre-built environments for common frameworks:

Hyperparameter Tuning

Optimize model hyperparameters with sweep jobs:

Tracking Experiments

Organize training runs into experiments:

Logging Metrics and Artifacts

Track training progress with MLflow:

Distributed Training

For large models and datasets, see:

Distributed Training Guide

Learn about PyTorch DDP, DeepSpeed, and TensorFlow distributed strategies

Best Practices

Register datasets for versioning and reproducibility:
Pin dependencies for reproducible training:
Avoid storing credentials in code:
Track spending with tags:

Training Examples by Framework

PyTorch

Deep learning with PyTorch on GPU clusters

TensorFlow

Neural networks with TensorFlow distributed

Scikit-learn

Traditional ML algorithms at scale

XGBoost

Gradient boosting for structured data

Next Steps

Distributed Training

Scale training across multiple GPUs

Deploy Models

Deploy trained models to endpoints

MLOps

Automate training pipelines

AutoML

Automated machine learning