DEV Community

PythicCoder for Microsoft Azure

Posted on • Originally published at Medium on

10 Azure ML Code Examples Every Cloud AI Developer Should Know

TLDR; 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 Azure

#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). AKSis 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

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

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

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

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

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 Branches

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.

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.

Top comments (0)