10 Azure ML Code Examples Every Cloud AI Developer Should Know

The Azure ML Python SDK enables Data scientists, AI engineers,and MLOps developers to be productive in the cloud. This post highlights 10 examples every cloud AI developer should know, to be successful with Azure ML.

If you are new to Azure you can get a free subscription using the link below.Create your Azure free account today | Microsoft AzureGet started with 12 months of free services and USD200 in credit. Create your free account today with Microsoft Azure.azure.microsoft.com

#10 Build Scikit-Learn models at scale with Azure Machine Learning

The scripts in this example are used to classify iris flower images to build a machine learning model based on scikit-learn’s iris dataset the code can easily be adapted to any scikit-learn estimator.


Train scikit-learn machine learning models – Azure Machine Learning

#9 Build a TensorFlow Deep Learning Model at Scale with Azure Machine Learning

This example shows you how to run your TensorFlow training scripts at scale using Azure Machine Learning’s TensorFlow estimator class. This example trains and registers a TensorFlow model to classify handwritten digits using a deep neural network (DNN) and MNIST but can be scaled to other more complex models.


Train and deploy a TensorFlow model – Azure Machine Learning

#8 Train PyTorch Deep Learning Models at Scale with Azure Machine Learning

PyTorch the example scripts in this article are used to classify chicken and turkey images to build a deep learning neural network based on PyTorch’s transfer learning tutorial and can be adapted to more complex projects.


Train deep learning PyTorch models – Azure Machine Learning

#7 How to Deploy a Model to an Azure Kubernetes Service Cluster

This example demonstrates how to deploy a production model on Azure Kubernetes Service (AKS)AKS is good for high-scale production deployments. Use AKS if you need one or more of the following capabilities:

  • Fast response time.
  • Autoscaling of the deployed service.
  • Hardware acceleration options such as GPU and field-programmable gate arrays (FPGA).


How to deploy models to Azure Kubernetes Service – Azure Machine Learning

#6 Detect Model Data Drift with AML and Azure Kubernetes Service (AKS)

Data in the wild is dynamic, this example walks through how to monitor changes in you data distribution and model performance over it’s production lifespan so that you can be alerted and update it more readily. ‘


Detect data drift on AKS deployments – Azure Machine Learning

#5 Fine Tune and BERT QA System With Distributed Training

Img Source https://pixabay.com/photos/bert-and-ernie-sesamstrasse-382270/

This code example walks through using BERT model for question and answering in an end to end pipeline on the AzureML platform. From how to fine tune it from scratch using the distributed training with Horovod and how to optimize model performance with Azure ML Hyper Drive.



#4 Distributed Training For Extractive Text Summarization

10 Azure ML Code

This example shows how to use Azure Machine Learning to run distributed training using Distributed Data Parallel in Pytorch for extractive summarization.



#3 Video Anomaly Detection Pipeline With Azure ML

10 Azure ML Code

The automation of detecting anomalous events in videos is a challenging problem that currently attracts a lot of attention by researchers, but also has broad applications across industry verticals. This code example provides an an end to end template for creating Video Anomaly Detection service with Azure ML and AML Pipelines.



#2 Interpretability for Local and Remote machine learning models

10 Azure ML Code

At its best, AI advances society through critical high-impact applications such as Heathcare, Security and Self Driving Cars. However at its worst AI can amplify existing societal biases with unintended consequences, such as ethnic, gender or racial discrimination. Model interpretability is a critical component of the Machine Learning Engineering process. This code example shows how to use the interpretability package of the Azure Machine Learning Python SDK to better understand why your model made its predictions.

Model interpretability for local and remote runs – Azure Machine Learning

For more information about Shapley Values one of the key interpretability measures check out my previous post on the topic.

How Coalitions Can Help Detect Bias In AI

#1 Aspect Based Sentiment Analysis with Intel NLP Architect

10 Azure ML Code

This End To End Notebook demonstrates how to train a custom estimator in Azure ML using the Intel NLP Architect Open Source Aspect Based Sentiment model. This model enables more granular insight into sentiment analysis as well contains best practices for configuring custom estimators from remote GitHub branches and custom environmental variable settings.


See also:Installing Azure ML Estimator Dependencies from Remote GitHub BranchesTLDR; The Azure ML (AML) Service Estimators make it easy to train distributed machine learning models at scale. This…medium.com

Next Steps

Now that you have all the code you need to get started for your own production Azure ML project check out my previous posts on 9 Advanced Tips for Production Machine Learning and how Setting up AML Notebook VM.Getting Started With AzureML Notebook VMsTLDR; Azure Machine Learning (AML), a cloud-based environment you can use to train, deploy, automate, manage, and track…medium.com9 Advanced Tips for Production Machine LearningTLDR; Incorporating a new state of the art machine learning model into a production application is a rewarding yet…medium.com

About the Author

Aaron (Ari) Bornstein is an avid AI enthusiast with a passion for history, engaging with new technologies and computational medicine. As an Open Source Engineer at Microsoft’s Cloud Developer Advocacy team, he collaborates with Israeli Hi-Tech Community, to solve real world problems with game changing technologies that are then documented, open sourced, and shared with the rest of the world.


Bornstein. A. (2020). 10 Azure ML Code Examples Every Cloud AI Developer Should Know. Available at: https://medium.com/microsoftazure/10-azure-ml-code-examples-every-cloud-ai-developer-should-know-a2899bf2f8bd [Accessed: 18th May 2020].

Check out more great Azure content here

Share this on...

Rate this Post: