Slide deck used to introduce machine learning with Azure Machine Learning Service. Focus on deployment of models with the machine learning SDK and consumption of the models with Python and Go.
8. Supervised learning
▪ Training data includes the desired solution (called labels) and features
▪ E.g. predict house prices based on features of the house and neighborhood; you have a
data set that contains the house prices
▪ Classification (e.g. spam filter), regression (e.g. house price prediction)
9
10. 2016: 96%
accuracy
RESNET vision
test (152 layer
neural network)
2017: 5.1%
switchboard
speech
recognition test
Jan 2018: 88.5%
SQuAD reading
comprehension
test
March 2018:
69.9% MT
research system
11
11. Challenges
▪ Not enough data: thousands or millions of examples
required depending on the problem
▪ Data is not representative
▪ Sampling noise
▪ Sampling bias
▪ Poor quality of data: importance of “data cleansing”
▪ Errors
▪ Outliers
▪ Noise
▪ Irrelevant features
▪ Overfitting and underfitting
12
12. How does it work?
The “Hello World” of machine learning
14. But how can we find the parameters b and w?
▪ Linear regression has a closed-form solution: the normal equation
▪ Calculates b and w directly
▪ Slow if there are many features
▪ Learn the parameters iteratively
▪ “Gradient Descent” algorithm
▪ Just select a random b and w and check
the cost
▪ Modify b and w to obtain a lower cost
and keep doing that for a number of times
15
15. Cost function
▪ Basically measures the difference between
the real values (blue) and predicted values
(red)
▪ There is a red line with the lowest cost
▪ The goal is to find that line by “cleverly”
trying new combinations of b and w
16
22. Wait a moment! What’s Machine Learning?
▪ We will talk about supervised learning only
▪ Learn from labeled data
e.g. you have images of numbers and you know the actual number the image represents
e.g. you have images of cats and you know they are cats
▪ Make predictions on new samples
Learn a model
predict “label = 4” (based on the model)
24. Python SDK
▪ Connect to your workspace
▪ Provision compute targets
▪ Upload data to storage
▪ Submit experiments
▪ Log training process
▪ Register models
▪ Deprovision compute targets
▪ Create container images
▪ Deploy as a web service
▪ ...
25.
26.
27. Training a model with train.py
▪ Load data from storage
▪ Fit ML model on the data
▪ use your framework of choice
▪ Save the model to storage
▪ Log metrics (e.g. accuracy) to Azure ML
29. Guided Exercise
▪ Log on to Azure Portal
▪ Create Azure ML service
▪ Log on to Azure Notebooks
▪ Perform the Getting Started exercise
(Monte Carlo simulation to calculate
Pi)
▪ uses local compute (of the
workbook)
30
32. Scoring with score.py
▪ To make predictions (inference) you provide a score.py script
▪ Azure ML uses score.py to build an API you can deploy to computer targets
▪ The API is packaged in a Docker container
def init():
load(model)
def run(input)
prediction =
model(input)
return prediction
37. Why use ONNX?
▪ Better interoperability
▪ Spend less time to put models into production
▪ Ecosystem of tools for visualization and acceleration
▪ Converters
▪ Visualizers
41. Deploying models
▪ A model is a function to execute
▪ A model is deployed as a REST API endpoint
that you call from your custom application
▪ Inference = making decisions about new data
e.g. is it a cat?
43. Deploy to Azure Container Instances (ACI)
▪ Simplest way to run
containers in Azure
▪ No need to think about
clusters
▪ Container groups with
multiple containers
44. Deploy to Azure Kubernetes Service (AKS)
▪ For high-scale production scenarios
▪ Use an existing AKS cluster or deploy from Azure ML
▪ More advanced capabilities
▪ Autoscaling
▪ Use of GPUs
▪ Monitoring and logging
45.
46. GPUs on Kubernetes
▪ Deploy on GPU instances
▪ Ensure GPU capabilities are advertised
▪ use device plugins
▪ You need to specifically enable GPU
support in the container used for inference
47. Guided Exercise
▪ Deploying the ResNet50 model to
Azure Container Instances
▪ Inference with Python
▪ Inference with Go
50
48. On your own
▪ Deploying the FER+ (emotion
recognition for faces) model to Azure
Container Instances
▪ Inference with Python
51
60. Deploy to IoT Edge
▪ IoT Edge provides the capability to
process telemetry at the network
edge
▪ Process data locally and forward to
the cloud when needed
▪ e.g. alert, run AI model, …
▪ IoT Edge uses modules and these
modules are containers
▪ Use IoT Hub to deploy an Azure
ML container to the edge device
63. Deploy to FPGAs
▪ Array of programmable logic blocks and reconfigurable interconnects
▪ Configurable post-manufacturing
▪ Mainly used for inference (not for training)
64. Project Brainwave on Azure
▪ Based on Intel FPGA devices
▪ Available in Azure for real-time AI
(inference)
▪ Configurable for different types of pre-
trained deep neural networks (DNN)
▪ Image classification and recognition
▪ ResNet 50, ResNet 152, VGG-16, …
▪ High performance
> 500 classifications / second
▪ Not for your custom models