Serverless Machine Learning

JeffConf - Hamburg - 2018

Oliver Zeigermann / @DJCordhose / floreysoft

http://bit.ly/ml-jeffconf

Part 1

Using an existing Machine Learning service

How to use a sentiment analysis API to find out which of your emails should be answered first

Cloud Natural Language: Google's ML API for Speech

https://cloud.google.com/natural-language/

Using Ultradox Serverless Workflows

Handles all authentication and API issues

Using the generated app

Calling the API from Ultradox Serverless Workflow

More APIs: E.g. Face Detection

https://aws.amazon.com/rekognition/

Part 2

Train and Deploy a TensorFlow model

Predict the category of a new customer running on Google Cloud ML

Customer Data - Car Insurance

How would you rank me (47) for a car with 160 km/h top speed?

Create TensorFlow / Keras model by applying alchemy


inputs = Input(name='input', shape=(2, ))

x = Dense(100, name='hidden1', activation='relu')(inputs)
x = Dense(100, name='hidden2', activation='relu')(x)
x = Dense(100, name='hidden3', activation='relu')(x)
predictions = Dense(3, name='softmax', activation='softmax')(x)

Buzzword alarm: Deep Learning

Training Results

77% accuracy on test data (pretty good)

Deployment


# https://cloud.google.com/ml-engine/docs/deploying-models

# Copy model to bucket
gsutil cp -R tf/1 gs://booster_bucket

# https://console.cloud.google.com/mlengine: create model and version

Usage


{"inputs": [ 160,  47,  10]}

gcloud ml-engine predict --model=booster --version=v1 
    --json-instances=./sample_insurance.json
            

# SCORES, likelihood of category  red, green, yellow
# [0.003163766348734498, 0.9321494698524475, 0.06468681246042252]

Try it yourself in an Azure Notebook

https://notebooks.azure.com/djcordhose/libraries/scipy2018-viz/html/5-keras-tensorflow-nn.ipynb

Wrapup

  • Prebuilt ML Services are at your finger tips
  • If standard services are not sufficient, train your custom model with free software (e.g. TensorFlow)
  • Models can be deployed to managed clouds (Google Cloud ML, Microsoft Azure, AWS) with ease

Ping me for questions / help / comments: http://zeigermann.eu / @DJCordhose / floreysoft

http://bit.ly/ml-jeffconf