amazon: a playground for machine learning€¦ · fashion & style. amazon art (archambeau and...

56
Amazon: a Playground for Machine Learning Cedric Archambeau Principal Applied Scientist, Amazon, Berlin [email protected] Data Science Summer School, École Polytechnique, 2017

Upload: others

Post on 02-Aug-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Amazon: a Playgroundfor Machine Learning

Cedric ArchambeauPrincipal Applied Scientist, Amazon, Berlin

[email protected]

Data Science Summer School, École Polytechnique, 2017

Page 2: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

LeNet 5

Page 3: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery
Page 4: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Today, machine learning is creating a paradigm shift.

Jeff Bezos in Geekwire (May 6, 2017): “It is a golden age. Machine learning and AI is a horizontal enabling layer. It will empower and improve every business, every government organization, every philanthropy.”

Page 5: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

More than 2 million active seller accounts

(>40% from 3P)

Authors andcontent creators

Over a millionactive AWS accounts

Over 244 million active consumers

Our Customers

Page 6: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

The Maturity of Deep Learning

Data

GPUs &Acceleration

Software

Algorithms

Page 7: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Machine learning has a long history at Amazon.

Page 8: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Recommendations& Search

Page 9: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

UnderstandingFashion & Style

Page 10: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Amazon Art

Page 11: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

(Archambeau and Bach, NIPS 2008)

Shallow LatentVariable Models

Page 12: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at Amazon

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Thousands of Employees across the Company Focused on Machnine Learning & AI

Page 13: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at AmazonThousands of Employees across the Company Focused on Machnine Learning & AI

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Page 14: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Machine Translated Detail Pages

Page 15: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Neural Machine Translation (NMT) with Sockeye

• Open-sourced toolkit for sequence-to-sequence modeling in MXNet

• Implements encoder-decoder models with attention (Bahdanau, et al., 2014)

• Supports different attention models(Luong, et al., 2015)

• Applicable to Named Entity Recognition, Semantic Parsing, …

(Image credit: Washington Department of Fish & Wildlife.)

github.com/awslabs/sockeye

Page 16: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Language model without Markov assumption:

Embedding layer:𝒚" = 𝑾𝐸𝑣"

Recurrent hidden layer (e.g., RNN, LSTM, GRU):𝒔" = tanh 𝑼𝒔"-. +𝑾𝒚"

Output layer:P house    <BOS>, the, white = softmax 𝑾1𝑠3 + 𝒃𝑶

Recurrent Neural Network Language Model

𝒚.

<BOS>

𝒚6

the

𝒚3

white

𝒚7

house

𝒔. 𝒔6 𝒔3 𝒔7𝒔8

the white house <EOS>

𝑃 𝒗 =;𝑃(𝑣"|𝒗.:"-.)@

"A.

Page 17: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Language model conditionedon the source sentence:

𝑃 𝒗|𝒙 =;𝑃(𝑣"|𝒗.:"-., 𝒙)@

"A.

Encoded source sentenceinitializes decoder RNN:

𝒔8 =  tanh 𝑾𝐼𝒉𝑚 + 𝒃𝐼

Sequence-to-Sequence Model (Sutskever, et al., 2014)

𝒚.

<BOS>

𝒚6

the

𝒚3

white

𝒚7

house

𝒔. 𝒔6 𝒔3 𝒔7𝒔8

the white house <EOS>

𝒙.

la

𝒙6

casa

𝒙3

blanca

𝒉𝟎 𝒉𝟏 𝒉𝟐 𝒉𝟑

encoder RNN 𝑓𝑒𝑛𝑐

decoder RNN 𝑓𝑑𝑒𝑐

Page 18: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Decoder consumes an attention vector:𝒔" = tanh 𝑼𝒔"-. +𝑾[𝒚", 𝒔Q"-. ]

The attention vector consumes a context vector:𝒔Q" = tanh(𝑾S[𝒔", 𝒄"])

The context vector is a linear combination source states:

𝒄" =  ∑ 𝛼"WXWA. 𝒉W  

where 𝛼"W = 𝑠𝑜𝑓𝑡𝑚𝑎𝑥(𝑠𝑐𝑜𝑟𝑒(𝒔", 𝒉W)).

Sequence Decoding with Attention (Bahdanau et al., 2014)

𝒚3

white

house

𝒔3𝒔6

𝒔Q6 𝒔Q3𝒄3 𝜶3

𝒉𝟏 𝒉𝟐 𝒉𝟑 …

Page 19: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Attention Models in Sockeye

Name Available in Sockeyemlp (Bahdanau, et al., 2014) ✓

concat (Luong, et al., 2015)

dot (Luong, et al., 2015) ✓

location (Luong, et al., 2015) ✓

bilinear (Luong, et al., 2015) ✓

coverage (Tu, et al., 2015) ✓v>a tanh(Wu s+Wv h+Wc C)

Page 20: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at Amazon

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Thousands of Employees across the Company Focused on Machnine Learning & AI

Page 21: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Amazon Fresh

Same Day and Early MorningHome Delivery of Grocery.

Page 22: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Strawberry Inspection by a Produce Specialist

Page 23: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Computer Vision-based Grocery Inspection

Illumination Clutter/occlusions Viewpoint Size Variability

Page 24: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Predicting Longevity

Age

Stra

wbe

rryID

Page 25: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Demand Forecasting

Scale 20M+ products fulfilled by Amazon alone!Sparsity Many product sell very infrequentlyRegionalised 100+ FCs worldwideNew products No past demand

Page 26: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Seasonality and External Events

Training RangeNon-fashion items have long(er) training ranges.

SeasonalityThis item has Christmas seasonality

with higher growth over time.

Missing Features/InputsUnexplained spikes

in the demand.

Page 27: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Effect of Out-of-stock

Without accounting for out-of-stock. When accounting for out-of-stock.

Seeger, et al.: Bayesian Intermittent Demand Forecasting for Large Inventories. NIPS 2016.

Page 28: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Deep Autoregressive Recurrent Networks

Salinas, et al. (2017): DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks.arXiv:1704.04110.

Page 29: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Deep Autoregressive Recurrent Networks

Salinas, et al. (2017). DeepAR: Probabilistic Forecasting with Autoregressive Recurrent Networks.arXiv:1704.04110.

Page 30: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at Amazon

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Thousands of Employees across the Company Focused on Machnine Learning & AI

Page 31: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

High atop the steps of the Pyramid of Giza a young woman laughed and called down to him. "Robert, hurry up! I knew I should have married a younger man!" Her smile was magic. ….

Named Entity Extraction

High atop the steps of the Pyramid of Giza a young woman laughed and called down to him. "Robert, hurry up! I knew I should have married a younger man!" Hersmile was magic. ….

if (word is capitalized) and(word before is ‘in’) then

PLACEelse if (word = ‘her’) or (word = ‘his’)

or (word = ‘he’) or (word = ‘she’) thenPERSON

...

Data (input) Annotation (output)

Program

Page 32: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

X-Ray : Enrich Every Piece of Digital Content

Page 33: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

X-Ray for Videos

Page 34: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at Amazon

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Thousands of Employees across the Company Focused on Machnine Learning & AI

Page 35: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Use your voice to• listen to music,• control smart home devices,• set timers when busy in the kitchen,• ask for news, weather report, …

Page 36: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Amazon Polly

Converts textto life-like speech

47 voices 24 languages Low latency,real time

PowersAlexa

Page 37: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Let’s take a listen…

Page 38: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

“Today in Seattle, WA, it’s 11°F”

“We live for the music live from the Madison Square Garden.”

1. Automatic, Accurate Text Processing

A Focus On Voice Quality & Pronunciation

Page 39: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

A Focus On Voice Quality & Pronunciation

2. Intelligible and Easy to Understand

1. Automatic, Accurate Text Processing

Page 40: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

2. Intelligible and Easy to Understand

3. Add Semantic Meaning to Text

“Richard’s number is 2122341237“

“Richard’s number is 2122341237“Telephone Number

A Focus On Voice Quality & Pronunciation

1. Automatic, Accurate Text Processing

Page 41: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

2. Intelligible and Easy to Understand

3. Add Semantic Meaning to Text

4. Customized Pronunciation

“My daughter’s name is Kaja.”

“My daughter’s name is Kaja.”

A Focus On Voice Quality & Pronunciation

1. Automatic, Accurate Text Processing

Page 42: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Artificial Intelligence at Amazon

Discovery &Search

Fulfilment &Logistics

EnhanceExisting Products

Define NewCategories of

Products

Bring MachineLearning to All

Thousands of Employees across the Company Focused on Machnine Learning & AI

Page 43: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Introducing Amazon AI

PollyText-to-Speech

Apache MXNetDeep learning engine

RekognitionImage Analysis

LexASR & NLU

Amazon MLML Applications

Page 44: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Introducing Amazon AI

PollyText-to-Speech

Apache MXNetDeep learning engine

RekognitionImage Analysis

LexASR & NLU

Amazon MLML Applications

Apache MXNet is the deep learning frameworkof choice for Amazon

Page 45: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Why MXNet?

Flexible programing model:• Symbolic API (computation graphs)• Imperative API (NumPy on GPUs)

Bindings for Python, C++, Scala, R, Julia, Perl.Fast & scalable:• Almost linear speed-up with

multiple GPUs• High efficiency on single machine too

(C++ backend) Google Inception v3 (image recognition)

Page 46: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Introducing Amazon AI

PollyText-to-Speech

Apache MXNetDeep learning engine

RekognitionImage Analysis

LexASR & NLU

Amazon MLML Applications

Page 47: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Amazon Rekognition

Real-time &batch image

analysis

Object & SceneDetection

Face Detection Face SearchFace Analysis

Page 48: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Object & Scene Detection

BayBeachCoastOutdoorsSeaWaterPalm_treePlantTreeSummerLandscapeNatureHotel

99.18%

99.18%

99.18%

99.18%

99.18%

99.18%

99.21%

99.21%

99.21%

58.3%

51.84%

51.84%

51.24%

Category Confidence

Page 49: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Face Detection

Page 50: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Face Analysis

Emotion:  calm:  73%Sunglasses:  false  (value:  0)Mouth  open  wide:  0%  (value:  0)Eye  closed:  open  (value:  0)Glasses:  no  glass  (value:  0)Mustache:  false  (value:  0)Beard:  no  (value:  0)  

Page 51: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

• Focus on the problem at hand• Abstract away learning algorithms• Abstract away feature engineering

Requires to automate hyperparameter tuning!

Democratising Machine Learning

Page 52: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Handwritten Digit Recognition

http://yann.lecun.com/exdb/mnist

Given an image of a digit, canwe predict which digit it is?

Page 53: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Simplified Handwritten Digit Recognition

Page 54: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

Applying Logistic Regression in Practice

Page 55: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

The performance of machine learning models depends on meta-parameters that need to be tuned with care

• Regularisation• (Hyper)priors • Model complexity• Optimisation• Markov Chain Monte Carlo • Feature extraction• Model validation• Decision rule

Can we automate this process?

Page 56: Amazon: a Playground for Machine Learning€¦ · Fashion & Style. Amazon Art (Archambeau and Bach, NIPS 2008) Shallow Latent Variable Models. Artificial Intelligence at Amazon Discovery

[email protected]

github.com/awslabs/sockeyeaws.amazon.com/amazon-­‐aiaws.amazon.com/blogs/ai