Convert Figma logo to code with AI

Azure logoazureml-examples

Official community-driven Azure Machine Learning examples, tested with GitHub Actions.

1,948
1,604
1,948
623

Top Related Projects

2,037

MLOps examples

15,271

Machine Learning Toolkit for Kubernetes

22,880

The open source developer platform to build AI/LLM applications and models with confidence. Enhance your AI applications with end-to-end tracking, observability, and evaluations, all in one integrated platform.

2,169

TFX is an end-to-end platform for deploying production ML pipelines

96,480

Tensors and Dynamic neural networks in Python with strong GPU acceleration

A library for training and deploying machine learning models on Amazon SageMaker

Quick Overview

Azure/azureml-examples is a GitHub repository containing official examples for Azure Machine Learning. It provides a comprehensive collection of notebooks, scripts, and workflows demonstrating various features and capabilities of Azure ML, including model training, deployment, and MLOps practices.

Pros

  • Extensive collection of up-to-date examples covering a wide range of Azure ML scenarios
  • Well-organized structure with separate directories for different types of examples (notebooks, CLI, SDK)
  • Regularly maintained and updated by Microsoft Azure team
  • Includes examples for both beginners and advanced users

Cons

  • Large repository size may be overwhelming for new users
  • Some examples may require specific Azure resources or configurations
  • Documentation could be more detailed for certain complex scenarios
  • Limited coverage of some niche or specialized use cases

Code Examples

Here are a few short code examples from the repository:

  1. Creating an Azure ML workspace using the Python SDK v2:
from azure.ai.ml import MLClient
from azure.identity import DefaultAzureCredential

ml_client = MLClient(
    DefaultAzureCredential(),
    subscription_id="<SUBSCRIPTION_ID>",
    resource_group_name="<RESOURCE_GROUP>",
    workspace_name="<AML_WORKSPACE_NAME>",
)
  1. Submitting a job using the CLI v2:
az ml job create --file job.yml
  1. Registering a model using the Python SDK v2:
from azure.ai.ml.entities import Model

model = Model(
    path="model.pkl",
    type="custom_model",
    name="sklearn-iris",
    description="A simple scikit-learn model trained on the iris dataset.",
)
ml_client.models.create_or_update(model)

Getting Started

To get started with Azure/azureml-examples:

  1. Clone the repository:

    git clone https://github.com/Azure/azureml-examples.git
    cd azureml-examples
    
  2. Set up your Azure ML workspace and configure your credentials.

  3. Install the required dependencies:

    pip install -r requirements.txt
    
  4. Navigate to the desired example directory and follow the instructions in the README or notebook.

Competitor Comparisons

2,037

MLOps examples

Pros of MLOps

  • Broader scope covering MLOps practices beyond just Azure ML
  • More comprehensive documentation and guides for enterprise-scale ML workflows
  • Includes templates for various cloud platforms and ML frameworks

Cons of MLOps

  • Less focused on Azure-specific implementations
  • Fewer ready-to-run examples compared to azureml-examples
  • May require more setup and configuration for Azure-specific use cases

Code Comparison

MLOps (infrastructure as code example):

resources:
  - type: Microsoft.MachineLearningServices/workspaces
    name: mlworkspace
    location: eastus
    properties:
      friendlyName: ML Workspace

azureml-examples (Azure ML SDK usage):

from azureml.core import Workspace

ws = Workspace.create(name='myworkspace',
                      subscription_id='<azure-subscription-id>',
                      resource_group='myresourcegroup',
                      create_resource_group=True,
                      location='eastus')

Both repositories provide valuable resources for ML practitioners, with MLOps offering a broader MLOps perspective and azureml-examples focusing more on Azure-specific implementations and examples.

15,271

Machine Learning Toolkit for Kubernetes

Pros of Kubeflow

  • Open-source and cloud-agnostic, allowing deployment on any Kubernetes cluster
  • Comprehensive ML platform with integrated tools for the entire ML lifecycle
  • Large community and ecosystem with extensive documentation and support

Cons of Kubeflow

  • Steeper learning curve, requiring Kubernetes expertise
  • More complex setup and maintenance compared to managed solutions
  • May require additional configuration for enterprise-grade security features

Code Comparison

azureml-examples:

from azureml.core import Workspace, Experiment, ScriptRunConfig

ws = Workspace.from_config()
experiment = Experiment(workspace=ws, name="my-experiment")
src = ScriptRunConfig(source_directory=".", script="train.py")
run = experiment.submit(src)

Kubeflow:

apiVersion: "kubeflow.org/v1"
kind: TFJob
metadata:
  name: tfjob-example
spec:
  tfReplicaSpecs:
    Worker:
      replicas: 1
      template:
        spec:
          containers:
            - name: tensorflow
              image: tensorflow/tensorflow:2.3.0

The azureml-examples code shows Python SDK usage for Azure ML, while Kubeflow uses YAML for defining ML jobs on Kubernetes.

22,880

The open source developer platform to build AI/LLM applications and models with confidence. Enhance your AI applications with end-to-end tracking, observability, and evaluations, all in one integrated platform.

Pros of MLflow

  • Platform-agnostic, can be used with various cloud providers or on-premises
  • Extensive support for different ML frameworks and libraries
  • Open-source with a large community and ecosystem

Cons of MLflow

  • Requires more setup and configuration compared to Azure ML's integrated environment
  • Less native integration with Azure services and infrastructure
  • May require additional tools for advanced enterprise features

Code Comparison

MLflow tracking example:

import mlflow

mlflow.start_run()
mlflow.log_param("param1", 5)
mlflow.log_metric("accuracy", 0.85)
mlflow.end_run()

Azure ML SDK example:

from azureml.core import Experiment, Run

run = Run.get_context()
run.log("param1", 5)
run.log("accuracy", 0.85)

Both examples demonstrate logging parameters and metrics, but Azure ML's approach is more tightly integrated with its ecosystem, while MLflow offers a more generic solution that can be used across different platforms.

2,169

TFX is an end-to-end platform for deploying production ML pipelines

Pros of TFX

  • Comprehensive end-to-end ML pipeline framework specifically designed for TensorFlow
  • Robust production-ready components for data validation, model analysis, and serving
  • Seamless integration with TensorFlow ecosystem and Google Cloud Platform

Cons of TFX

  • Steeper learning curve due to its complexity and TensorFlow-specific design
  • Less flexibility for non-TensorFlow models or custom ML workflows
  • More limited cloud platform support compared to Azure ML's multi-cloud approach

Code Comparison

azureml-examples:

from azureml.core import Workspace, Experiment, Environment, ScriptRunConfig

ws = Workspace.from_config()
experiment = Experiment(workspace=ws, name="my-experiment")
env = Environment.from_conda_specification("myenv", "environment.yml")
src = ScriptRunConfig(source_directory=".", script="train.py", environment=env)
run = experiment.submit(src)

TFX:

import tfx.v1 as tfx
from tfx.orchestration.beam.beam_dag_runner import BeamDagRunner

pipeline = tfx.dsl.Pipeline(
    pipeline_name="my_pipeline",
    pipeline_root="/tmp/tfx_pipeline_output",
    components=[
        example_gen, statistics_gen, schema_gen, validator, trainer, model_analyzer, pusher
    ],
    enable_cache=True
)

BeamDagRunner().run(pipeline)
96,480

Tensors and Dynamic neural networks in Python with strong GPU acceleration

Pros of pytorch

  • Broader scope and functionality for deep learning and AI
  • Larger community and more extensive documentation
  • More flexible and customizable for advanced research

Cons of pytorch

  • Steeper learning curve for beginners
  • Less integrated with cloud services and MLOps workflows
  • Requires more setup and configuration for deployment

Code Comparison

pytorch:

import torch

# Define a simple neural network
class Net(torch.nn.Module):
    def __init__(self):
        super(Net, self).__init__()
        self.fc = torch.nn.Linear(10, 5)

    def forward(self, x):
        return self.fc(x)

azureml-examples:

from azureml.core import Workspace, Experiment, ScriptRunConfig

# Set up Azure ML workspace and experiment
ws = Workspace.from_config()
exp = Experiment(workspace=ws, name="my-experiment")

# Configure and submit a run
src = ScriptRunConfig(source_directory=".", script="train.py")
run = exp.submit(src)

The pytorch example showcases defining a neural network, while the azureml-examples code demonstrates setting up and running an experiment in Azure ML. This highlights the different focus areas of the two repositories, with pytorch centered on deep learning model creation and azureml-examples emphasizing cloud-based machine learning workflows.

A library for training and deploying machine learning models on Amazon SageMaker

Pros of sagemaker-python-sdk

  • More comprehensive documentation and examples
  • Tighter integration with AWS ecosystem
  • Broader range of pre-built algorithms and model types

Cons of sagemaker-python-sdk

  • Steeper learning curve for beginners
  • Less flexibility in customizing training environments
  • More complex setup process for local development

Code Comparison

azureml-examples:

from azureml.core import Workspace, Experiment, ScriptRunConfig

ws = Workspace.from_config()
experiment = Experiment(workspace=ws, name="my-experiment")
src = ScriptRunConfig(source_directory=".", script="train.py")
run = experiment.submit(src)

sagemaker-python-sdk:

import sagemaker
from sagemaker.estimator import Estimator

sagemaker_session = sagemaker.Session()
estimator = Estimator(entry_point="train.py", role="SageMakerRole",
                      instance_count=1, instance_type="ml.m5.xlarge")
estimator.fit()

Both examples demonstrate setting up and running a machine learning experiment, but sagemaker-python-sdk requires more AWS-specific configuration, while azureml-examples focuses on a more generalized approach within the Azure ecosystem.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Azure Machine Learning examples

license: MIT

Welcome to the Azure Machine Learning examples repository!

About This Repository

The azureml-examples repository contains examples and tutorials to help you learn how to use Azure Machine Learning (Azure ML) services and features.

Getting Started

If you're getting started with Azure ML, consider working through our tutorials for the v2 Python SDK. You may also want to read through our documentation.

SDKs

The sdk/ folder houses the examples for the Azure ML SDKs across several languages.

We have an extensive collection of examples for the Azure ML Python SDK v2 in sdk/python.

We also offer some examples for our SDKs in other languages:

Azure Machine Learning extension for Azure CLI

The cli/ folder hosts our examples to use the Azure Machine Learning extension for Azure CLI.

Note: If you're looking for examples that submit Azure ML jobs that run non-Python code, see:

Supplementary Documentation

Contributing

We welcome contributions and suggestions! Please see the contributing guidelines for details.

Code of Conduct

This project has adopted the Microsoft Open Source Code of Conduct. Please see the code of conduct for details.