Open In Colab

Lesson 6: Create a Production Machine Learning Application

Watch Lesson 6: Create a Production Machine Learning Application Video

Pragmatic AI Labs

alt text

This notebook was produced by Pragmatic AI Labs. You can continue learning about these topics by:

Load AWS API Keys

Put keys in local or remote GDrive:

cp ~/.aws/credentials /Users/myname/Google\ Drive/awsml/

Mount GDrive

from google.colab import drive
drive.mount('/content/gdrive', force_remount=True)
Mounted at /content/gdrive

import os;os.listdir("/content/gdrive/My Drive/awsml")
['kaggle.json', 'credentials', 'config']

Install Boto

!pip -q install boto3

Create API Config

!mkdir -p ~/.aws &&\
  cp /content/gdrive/My\ Drive/awsml/credentials ~/.aws/credentials 

Test Comprehend API Call

import boto3
comprehend = boto3.client(service_name='comprehend', region_name="us-east-1")
text = "There is smoke in San Francisco"
comprehend.detect_sentiment(Text=text, LanguageCode='en')
{'ResponseMetadata': {'HTTPHeaders': {'connection': 'keep-alive',
   'content-length': '160',
   'content-type': 'application/x-amz-json-1.1',
   'date': 'Thu, 22 Nov 2018 00:21:54 GMT',
   'x-amzn-requestid': '9d69a0a9-edec-11e8-8560-532dc7aa62ea'},
  'HTTPStatusCode': 200,
  'RequestId': '9d69a0a9-edec-11e8-8560-532dc7aa62ea',
  'RetryAttempts': 0},
 'Sentiment': 'NEUTRAL',
 'SentimentScore': {'Mixed': 0.008628507144749165,
  'Negative': 0.1037612184882164,
  'Neutral': 0.8582549691200256,
  'Positive': 0.0293553676456213}}

6.1 Create Machine Learning Data Pipeline

Data Pipeline Patterns

data_engineers

[Anti-Pattern] Accidental Data Pipeline

  • Production SQL Server is center

[Pattern] Batch Data Lake

  • Batch ML Pipeline to and from Data Lake

[Pattern] Batch Infinite Resources on Production

  • Environment uses

6.2 EDA with Sagemaker

[Demo] County Census Clustering

6.3 Create Machine Model using AWS Sagemaker

[Demo] Sagemaker Pipeline

6.4 Deploy Machine Learning Model using AWS Sagemaker

[Demo] Sagemaker Pipeline