More Related Content Similar to AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow (20) More from Amazon Web Services (20) AWS Machine Learning Week SF: Amazon SageMaker & TensorFlow1. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
Workshop: Amazon SageMaker and Tensorflow
2. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Agenda
• About
• Concepts & Tools
• Setup
• Notebooks
• Teardown
3. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
The AWS Machine Learning Stack
AI SERVICES
ML PLATFORMS
ML FRAMEWORKS
VISION
Rekognition
Video
Rekognition
SPEECH
TranscribePolly
LANGUAGE
ComprehendTranslate
CHATBOTS
Lex
AWS DeepLensAmazon SageMaker
TensorFlow MXNet PyTorch Caffe2 Chainer Horvod Gluon Keras
Mechanical Turk
4. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
About
Everything you need to know about this workshop
5. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Workshop Details
• Timeframe:
– Two hour hands-on workshop
• Scope:
– Easily building models
and operating TensorFlow
using Amazon SageMaker
• Outcome:
– You will have built five neural
networks within Amazon SageMaker
https://github.com/tensorflow/tensorflow
6. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Prerequisites
Required
• AWS Account
• Root account / privileged IAM user
– sufficient permission to run
Amazon SageMaker, access
Amazon S3
Not Required
• TensorFlow experience
• Amazon SageMaker experience
• Machine Learning experience
• Python experience
7. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Concepts and Tools
Everything you need to know for this workshop
8. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Artificial Neural Networks (ANN)
Artificial neural networks (ANNs) or connectionist systems are
computing systems vaguely inspired by the biological neural
networks that constitute animal brains. Such systems "learn" (i.e.
progressively improve performance on) tasks by considering examples,
generally without task-specific programming. For example, in image
recognition, they might learn to identify images that contain cats by
analyzing example images that have been manually labeled as "cat" or
"no cat" and using the results to identify cats in other images. They do
this without any a priori knowledge about cats, e.g., that they have fur,
tails, whiskers and cat-like faces. Instead, they evolve their own set of
relevant characteristics from the learning material that they process.
From https://en.wikipedia.org/wiki/Artificial_neural_network
9. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Artificial Neural Networks (ANN)
Artificial neural networks (ANNs) or connectionist systems are
computing systems vaguely inspired by the biological neural
networks that constitute animal brains. Such systems "learn" (i.e.
progressively improve performance on) tasks by considering examples,
generally without task-specific programming. For example, in image
recognition, they might learn to identify images that contain cats by
analyzing example images that have been manually labeled as "cat" or
"no cat" and using the results to identify cats in other images. They do
this without any a priori knowledge about cats, e.g., that they have fur,
tails, whiskers and cat-like faces. Instead, they evolve their own set of
relevant characteristics from the learning material that they process.
From https://en.wikipedia.org/wiki/Artificial_neural_network
TL;DR: transforms input to output
in a complex manner
10. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
TensorFlow
“TensorFlow is an open source software library for numerical
computation using data flow graphs. The graph nodes represent
mathematical operations, while the graph edges represent the
multidimensional data arrays (tensors) that flow between them. This
flexible architecture lets you deploy computation to one or more CPUs or
GPUs in a desktop, server, or mobile device without rewriting code.
TensorFlow also includes TensorBoard, a data visualization toolkit.”
- From official Tensorflow repo: https://github.com/tensorflow/tensorflow
11. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
TensorFlow
“TensorFlow is an open source software library for numerical
computation using data flow graphs. The graph nodes represent
mathematical operations, while the graph edges represent the
multidimensional data arrays (tensors) that flow between them. This
flexible architecture lets you deploy computation to one or more CPUs or
GPUs in a desktop, server, or mobile device without rewriting code.
TensorFlow also includes TensorBoard, a data visualization toolkit.”
- From official Tensorflow repo: https://github.com/tensorflow/tensorflow
TL;DR: a framework for creating
artificial neural networks
12. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon SageMaker
Amazon SageMaker is a fully-managed platform that enables developers
and data scientists to quickly and easily build, train, and deploy machine
learning models at any scale.
Amazon SageMaker removes all the barriers that typically slow down
developers who want to use machine learning.
13. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
https://jupyter.org/
Amazon SageMaker Notebooks
• Programming environments for
ad-hoc data analysis
• Support for many languages
– Python2/3 most common
• Persistent artifact
– .ipynb format
• Can be run:
– managed Notebook Instance in
Amazon SageMaker
– self-hosted (Amazon EC2
instances, laptop, etc)
14. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon SageMaker Jobs
• Tasks that train your neural networks with data
• Created via one line of code
– In Python SDK: instantiate TensorFlow object
• Executes training job
• Under the covers:
– AWS Batch
– Amazon EC2 instances
• Training outputs a model
– Amazon S3 output location
– model.tar.gz
.fi
15. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Amazon SageMaker Endpoints
• Deploys your model for inference as an API endpoint
– Requires previously trained model.tar.gz
• Created via one line of code
– In Python: sagemaker.deploy() method
• Under the covers:
– Amazon EC2 instances
.fi
16. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Setup
Start your engines (ie. your Amazon SageMaker Notebook Instances)
17. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Creating the Notebook Instance
• Login to AWS Console
• Region: US East (N. Virginia)
• Service: Amazon SageMaker
• Select: Notebook Instances
• Click: Create Notebook Instance
– Name: sf-loft-2018
– Instance type: ml.t2.medium
– Instance role: <select existing role> or <Create New Role>
– VPC: none
• Wait a few minutes, then Open the new notebook instance
18. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
From Notebook Instance
• Launch a Terminal session
• In the terminal, run the following (can copy from
https://amzn.to/2GelxDj)
$ git clone https://github.com/awslabs/amazon-sagemaker-examples/
$ mv ./amazon-sagemaker-examples/sagemaker-python-sdk/tensorflow* ./SageMaker
19. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Notebooks
The workshop exercises via prepared Jupyter Notebooks
20. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Sample TensorFlow Notebooks
1. tensorflow_iris_dnn_classifier_using_estimators
2. tensorflow_abalone_age_predictor_using_keras
3. tensorflow_abalone_age_predictor_using_layers
4. tensorflow_distributed_mnist
5. tensorflow_resnet_cifar10_with_tensorboard
21. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Example 1: Iris Dataset
22. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Example 2 & 3: Abalone Dataset
Feature Description
Length Length of abalone (in longest direction; in mm)
Diameter
Diameter of abalone (measurement perpendicular to
length; in mm)
Height Height of abalone (with its meat inside shell; in mm)
Whole Weight Weight of entire abalone (in grams)
Shucked Weight Weight of abalone meat only (in grams)
Viscera Weight Gut weight of abalone (in grams), after bleeding
Shell Weight Weight of dried abalone shell (in grams)
https://en.wikipedia.org/wiki/Abalone
23. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Example 4: MNIST dataset
• Dataset commonly used for
machine learning of character
recognition
• “Hello World” of NN frameworks
https://en.wikipedia.org/wiki/MNIST_database
24. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Example 5: CIFAR-10 dataset
• Dataset commonly used for
demonstrating machine learning in
image classification
• 60,000 32x32 color images in 10
different classes
• Classes represent airplanes, cars,
birds, cats, deer, dogs, frogs,
horses, ships, and trucks
https://en.wikipedia.org/wiki/CIFAR-10
25. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Teardown
Clean up your workshop resources
26. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Delete Me
• Delete all Amazon SageMaker resources, such as:
– Notebook Instances
– Models
– Endpoint Configurations
– Endpoints
• Delete all Amazon S3 buckets and files
27. © 2018, Amazon Web Services, Inc. or its Affiliates. All rights reserved
Pop-up Loft
aws.amazon.com/activate
Everything and Anything Startups
Need to Get Started on AWS