how can you get started with machine learning?€¦ · how can you get started with machine...

54
Copyright 2017 Arbormoon Software, Inc. All rights reserved. How Can You Get Started with Machine Learning? Harry Wang

Upload: others

Post on 21-May-2020

7 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

How Can You Get Started with Machine Learning?

Harry Wang

Page 2: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Presentation.introduceSpeaker()

Page 3: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

-Subset of Artificial Intelligence

-Algorithms that can adjust themselves based on data

-Statistical and Predictive Analytics

-”Gives computers the ability to learn without being explicitly programmed”

-More flexible and less-static in behavior

What is Machine Learning?

Page 4: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Supervised Learning

InputInput

Page 5: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Unsupervised Learning

Page 6: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Semi-Supervised Learning

Page 7: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Classifier - object in program that learns from the data you give it

Training Data - used to train classifier

Testing Data - used to evaluate the accuracy and performance of classifier

Basic Machine Learning concepts

Page 8: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Example of a Simple ML Modely = m’x+b’y = mx+b

Initial State

Final State

Page 9: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Examples of Machine Learning

Page 10: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

spotted salamander fire salamander retriever

Recognizing images with Inception

https://research.googleblog.com/2016/03/train-your-own-image-classifier-with.html

Page 11: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Page 12: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Page 13: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Smart reply in Inbox by Gmail

10%of all responses sent on mobile

Page 14: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

[glacier]

Google Photos

Page 15: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Page 16: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

How Can You Get Started with Machine Learning?

More flexible, but more

effort required

Three ways, with varying complexity:

(1) Use a Cloud-based or Mobile API (Vision, Natural Language, etc.)

(2) Use an existing model architecture, and retrain it or fine tune on your dataset

(3) Develop your own machine learning models for new problems

Page 17: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Cloud Machine Learning APIs See, Hear and Understand the world

Page 18: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Cloud Natural Language

Cloud Speech

Cloud Translate

Cloud Vision

Page 19: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.19

Vision API Demo

Page 20: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

FacesFaces, facial landmarks, emotions

OCRRead and extract text, with support for > 10 languages

LabelDetect entities from furniture to transportation

LogosIdentify product logos

Landmarks & Image PropertiesDetect landmarks & dominant color of image

Safe SearchDetect explicit content - adult, violent, medical and spoof

Cloud Vision API

Page 21: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

API Usage: Detect Objects in an Image

Image DetectedItems

Vision API

Create JSON request with the image or pointer to an image

Process the JSON response

Call the REST API1 2 3

Page 22: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Cloud Natural Language API

Extract sentence, identify parts of speech and create dependency parse trees for each sentence.

Identify entities and label by types such as person, organization, location, events, products and media.

Understand the overall sentiment of a block of text.

Syntax Analysis Entity Recognition

Sentiment Analysis

Page 23: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Cloud Speech API

Automatic Speech Recognition (ASR) powered by deep learning neural networking to power your applications like voice search or speech transcription.

Recognizes over 80 languages and variants with an extensive vocabulary.

Returns partial recognition results immediately, as they become available.

Filter inappropriate content in text results.

Audio input can be captured by an application’s microphone or sent from a pre-recorded audio file. Multiple audio file formats are supported, including FLAC, AMR, PCMU and linear-16.

Handles noisy audio from many environments without requiring additional noise cancellation.

Audio files can be uploaded in the request and, in future releases, integrated with Google Cloud Storage.

Automatic Speech Recognition Global Vocabulary Inappropriate Content Filtering

Streaming Recognition

Real-time or Buffered Audio Support Noisy Audio Handling Integrated API

Page 24: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

What’s Next?

Codelabscodelabs.developers.google.com/codelabs/cloud-vision-intro/index.htmlcodelabs.developers.google.com/codelabs/cloud-speech-intro/index.htmlcodelabs.developers.google.com/codelabs/cloud-nl-intro/index.html

For Developerscloud.google.com/vision/cloud.google.com/speech/cloud.google.com/natural-language/cloud.google.com/translate/

Stack Overflow

Page 25: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Mobile Vision APIProviding on-device vision for applications

Page 26: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Face APIfaces, facial landmarks, eyes open, smiling

Barcode API1D and 2D barcodes

Text APILatin-based text / structure

Common Mobile Vision APISupport for fast image and video on-device detection and tracking.

Page 27: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Googly Eyes Android App

Video credit Google

1. Create a face detector for facial landmarks (e.g., eyes)

3. For each face, draw the eyes

FaceDetector detector = new FaceDetector.Builder().setLandmarkType(FaceDetector.ALL_LANDMARKS).build();

SparseArray<Face> faces = detector.detect(image);

for (int i = 0; i < faces.size(); ++i) {Face face = faces.valueAt(i);for (Landmark landmark : face.getLandmarks()) {// Draw eyes

2. Detect faces in the image

Page 28: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Face APIPhoto credit developers.google.com/vision

Page 29: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Text Structure

Blocks

Lines

Words

Lines

Words Words Words

Page 30: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Barcode Detection1D barcodes

EAN-13/8UPC-A/ECode-39/93/128

ITFCodabar

2D barcodes QR CodeData MatrixPDF-417AZTEC

UPC

DataMatrix

QR Code

PDF 417

Video and image credit Google

Page 31: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Combined Vision & Translation

Page 32: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Mobile Vision: Codelabs and Samples

Googly Eyes Code Samplegithub.com/googlesamples/android-vision/tree/master/visionSamples/googly-eyes

Codelabscodelabs.developers.google.com/codelabs/face-detection/codelabs.developers.google.com/codelabs/mobile-vision-ocr/

Mobile Vision Developersdevelopers.google.com/vision/

GitHub Code Samplesgithub.com/googlesamples/android-vision

Stack OverflowFind and ask questions under the android-vision tag.

Page 33: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Open source Machine Learning library

Especially useful forDeep Learning

For research and production

Apache 2.0 license

Page 34: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Page 35: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Hello World

Image from https://github.com/mnielsen/neural-networks-and-deep-learning

?

Page 36: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

What we see What the computer “sees”

Page 37: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Page 38: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Complete code

import numpy as np

import tensorflow as tf

mnist = tf.contrib.learn.datasets.load_dataset('mnist')

data = mnist.train.images

labels = np.asarray(mnist.train.labels, dtype=np.int32)

data = data[:10000]

labels = labels[:10000]

feature_columns = tf.contrib.learn.infer_real_valued_columns_from_input(data)

classifier = tf.contrib.learn.LinearClassifier(feature_columns=feature_columns, n_classes=10)

classifier.fit(data, labels, batch_size=100, steps=1000)

print("accuracy: ", classifier.evaluate(mnist.test.images, np.asarray(mnist.test.labels, dtype=np.int32))["accuracy"])

Page 39: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Computer Vision Principles

Filled in Center:Positive Weight for digit being a one

Filled in Center:Negative Weight for digit being a zero

Page 40: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Computer Vision Principles

Page 41: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Getting Started Exercises

Page 42: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Lots of tutorials at tensorflow.org

Page 43: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Codelab - goo.gl/xGsB9d Video - goo.gl/B2zYWN

TensorFlow for Poets

Page 44: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Mobile TensorFlow

Page 45: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.Claude Monet - Bouquet of SunflowersImages from the Metropolitan Museum of Art (with permission) Image by @random_forests

Page 46: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

A little more TensorFlow

Page 47: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

A multidimensional array.

A graph of operations.

Page 48: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Data Flow Graphs

Computation is defined as a directed acyclic graph (DAG) to optimize an objective functionGraph is defined in high-level language (Python)Graph is compiled and optimizedGraph is executed (in parts or fully) on available low level devices (CPU, GPU)Data (tensors) flow through the graphTensorFlow can compute gradients automatically

Page 49: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

ArchitectureCore in C++

Different front ends

- Python and C++ today, community may add more

...

Core TensorFlow Execution System

CPU GPU Android iOS ...

C++ front end Python front end

Page 50: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Raspberry PiDatacentersYour laptop Android iOS

Portable & Scalable

Page 51: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

/Serving

Open-source solution for serving trained models

Page 52: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

tensorflow.orggithub.com/tensorflow

Want to learn more?Udacity class on Deep Learning, goo.gl/iHssII

Guides, codelabs, videosMNIST for Beginners, goo.gl/tx8R2bTF Learn Quickstart, goo.gl/uiefRnTensorFlow for Poets, goo.gl/bVjFILML Recipes, goo.gl/KewA03TensorFlow and Deep Learning without a PhD, goo.gl/pHeXe7

What's Next

Page 53: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Questions?

Page 54: How Can You Get Started with Machine Learning?€¦ · How Can You Get Started with Machine Learning? More flexible, but more effort required Three ways, with varying complexity:

Copyright 2017 Arbormoon Software, Inc. All rights reserved.

Thanks and have fun!

Harry Wang