mit 6.148 smart web apps using machine...

105
MIT 6.148 Smart Web apps using Machine Learning

Upload: others

Post on 26-May-2020

2 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

MIT 6.148

Smart Web apps using Machine Learning

Page 2: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Hello!I am Carlos Aguayo

◎ ~13 years at Appian◎ Director, Software Development◎ Master's student

https://www.linkedin.com/in/carlosaguayo/

Page 4: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

What is Machine Learning?

Page 5: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

“Machine learning is the subfield of

computer science that "gives computers the ability to learn

without being explicitly programmed" - Arthur Samuel,

1959

What is Machine Learning

Page 6: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

“A computer program is said to learn from experience E with

respect to some class of tasks T and performance measure P, if its

performance at tasks in T, as measured by P, improves with

experience E. - Tom Mitchell

What is Machine Learning

Page 7: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Let's start with a demo!

Page 8: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Gender Recognition by Voice and Speech Analysis

Given an audio, tell if the voice in the audio is male or female.

Page 9: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

meanfreq mean frequency (in kHz)

sd standard deviation of frequency

median median frequency (in kHz)

Q25 first quantile (in kHz)

Q75 third quantile (in kHz)

IQR interquantile range (in kHz)

skew skewness

kurt kurtosis

sp.ent spectral entropy

sfm spectral flatness

mode mode frequency

Acoustic Properties Measured

centroid frequency centroid

peakf peak frequency

meanfun average of fundamental frequency

minfun minimum fundamental frequency

maxfun maximum fundamental frequency

meandom average of dominant frequency

mindom minimum of dominant frequency

maxdom maximum of dominant frequency

dfrange range of dominant frequency

modindx modulation index

Page 10: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 11: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 12: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 13: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

3,168 voice samples

What did we do?

Page 14: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

3,168 voice samples Machine Learning Algorithm

What did we do?

Page 15: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

f(x)3,168 voice samples Machine Learning

Algorithm

What did we do?

Page 16: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

f(x)

f(x)

3,168 voice samples Machine Learning Algorithm

What did we do?

Page 17: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 18: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 19: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Given an X and Y, is this point pink or blue?

Page 20: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Given an X and Y, is this point pink or blue?

Page 21: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Blue!

Page 22: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 23: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 24: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 25: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 26: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

One of the simplest, yet effective, machine

learning algorithms.

K-Nearest Neighbors

Page 27: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 28: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Hyperplane that represents the largest

separation between classes

Support Vector

Machine

Page 29: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 30: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Another simple, and effective, supervised

learning algorithm.

Decision Trees

Page 31: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

1. mode2. minfun3. maxdom4. Q255. median6. meanfun7. skew

Page 32: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Human vs. Machine

Up to 3 dimensions! High dimensional space!

Page 33: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Page 34: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Supervised learning is the machine learning task of inferring a function from labeled training data.

◎ The training data consist of a set of training examples.

◎ Each example is a pair consisting of an input object and an output value.

◎ A supervised learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples.

Supervised Learning

Page 35: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Supervised learning is the machine learning task of inferring a function from labeled training data.

◎ The training data consist of a set of training examples.

◎ Each example is a pair consisting of an input object and an output value.

◎ A supervised learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples.

Supervised Learning

3,168 voice samples

Page 36: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Supervised learning is the machine learning task of inferring a function from labeled training data.

◎ The training data consist of a set of training examples.

◎ Each example is a pair consisting of an input object and an output value.

◎ A supervised learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples.

Supervised Learning

Page 37: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Supervised learning is the machine learning task of inferring a function from labeled training data.

◎ The training data consist of a set of training examples.

◎ Each example is a pair consisting of an input object and an output value.

◎ A supervised learning algorithm analyzes the training data and produces an inferred function, which can be used for mapping new examples.

Supervised Learning

Page 38: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Neural Networks

Supervised Learning

Page 39: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Will you go out to the party tonight?

Supervised Learning

Page 40: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Will you go out to the party tonight?

◎ Can I wake up late tomorrow?

Supervised Learning

Page 41: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Can I wake up late tomorrow?◎ Will the person that I like be there?

Will you go out to the party tonight?

Supervised Learning

Page 42: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Can I wake up late tomorrow?◎ Will the person that I like be there?◎ Will my friends be there?

Will you go out to the party tonight?

Supervised Learning

Page 43: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

◎ Can I wake up late tomorrow?◎ Will the person that I like be there?◎ Will my friends be there?◎ Do I have any other plans tonight?◎ Have I gone to that party before?

Will you go out to the party tonight?

Supervised Learning

Page 44: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Crush?

Friend?

Late?

No Plans?

New?

10

7

3

5

5

It's just a weighted decision. If the output is

equal or larger than 10, I'll be there!

Page 45: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Crush?

Friend?

Late?

No Plans?

New?

10Yes

No

No

No

No

= 10 Yes! I'll be at the party!

It's just a weighted decision. If the output is

equal or larger than 10, I'll be there!

Page 46: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Crush?

Friend?

Late?

No Plans?

New?

10

5

No

No

Yes

No

No

= 5 No, raincheck.

It's just a weighted decision. If the output is

equal or larger than 10, I'll be there!

Page 47: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Crush?

Friend?

Late?

No Plans?

New?

10

7

3

5

5

No

Yes

Yes

No

No

7 + 5 = 12 Yes! I'll be at the party!

It's just a weighted decision. If the output is

equal or larger than 10, I'll be there!

Page 48: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Crush?

Friend?

Late?

No Plans?

New?

10

7

3

5

5

Page 49: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Page 50: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Other

New

Plan

Late

Friend

Crush

Sum

Page 51: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Other

New

Plan

Late

Friend

Crush

Sum

Sum

Sum

Sum

Page 52: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Sum

Other

New

Plan

Late

Friend

Crush

Sum

Sum

Sum

Sum

Sum

Sum

Page 53: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Deep Learning

Supervised Learning

Page 54: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Supervised Learning

Convolutional Neural Networks (CNNs)

Page 55: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

High Level Summary

Supervised Learning

Page 56: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Labeled DataYou get a set of samples, each of them with an answer.

High Level Summary

Supervised Learning

Page 57: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Labeled DataYou get a set of samples, each of them with an answer.

ModelLearn a model that can successfully predict the seen and unseen samples.

High Level Summary

Supervised Learning

Page 58: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Labeled DataYou get a set of samples, each of them with an answer.

PredictA number, face, voice, price of a house, stock, etc.

ModelLearn a model that can successfully predict the seen and unseen samples.

High Level Summary

Supervised Learning

Page 59: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Labeled DataYou get a set of samples, each of them with an answer.

PredictA number, face, voice, price of a house, stock, etc.

ModelLearn a model that can successfully predict the seen and unseen samples.

High Level Summary

Supervised Learning

Page 60: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

The Future ...

Page 61: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Deep Blue (1996)

◎ The system derived its playing strength mainly from brute force computing power.

◎ Chess knowledge was fine tuned by grandmasters.

◎ Studied thousands of games.

Page 62: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Deep Blue (1996)

◎ The system derived its playing strength mainly from brute force computing power.

◎ Chess knowledge was fine tuned by grandmasters.

◎ Studied thousands of games.

Page 64: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or
Page 65: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or
Page 66: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or
Page 67: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or
Page 68: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or
Page 72: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 73: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 74: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 75: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

How?

Page 76: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

Page 77: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

StatesThe agent is in a given state at all times.

Elements of Reinforcement Learning

Reinforcement Learning

Page 78: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

ActionsThe agent can perform a finite number of actions that will take it into a new state.

StatesThe agent is in a given state at all times.

Elements of Reinforcement Learning

Reinforcement Learning

Page 79: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

RewardsThe agent is awarded a reward for each state that it is in. Typically an integer number.

ActionsThe agent can perform a finite number of actions that will take it into a new state.

StatesThe agent is in a given state at all times.

Elements of Reinforcement Learning

Reinforcement Learning

Page 80: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Eat

RewardsThe agent is awarded a reward for each state that it is in. Typically an integer number.

ActionsThe agent can perform a finite number of actions that will take it into a new state.

StatesThe agent is in a given state at all times.

Elements of Reinforcement Learning

Reinforcement Learning

Hungry Not Hungry

Page 81: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

RewardsThe agent is awarded a reward for each state that it is in. Typically an integer number.

ActionsThe agent can perform a finite number of actions that will take it into a new state.

StatesThe agent is in a given state at all times.

Elements of Reinforcement Learning

Reinforcement Learning

Hungry-10

Not Hungry+10

Eat

Page 82: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

ObjectiveThe agent goal is to maximize the reward.

Elements of Reinforcement Learning

Reinforcement Learning

Page 83: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

ObjectiveThe agent goal is to maximize the reward.

PolicyA policy states the action to take at each possible state.

Elements of Reinforcement Learning

Reinforcement Learning

Page 84: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

ObjectiveThe agent goal is to maximize the reward.

Optimal PolicyMaximizes the long time expected reward

PolicyA policy states the action to take at each possible state.

Elements of Reinforcement Learning

Reinforcement Learning

Page 85: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 3 by 3 gridActions - Up, Down, Left, RightRewards - All states have a -1 with the exception of top right

-1 -1 +100

-1 -1 -1

-1 -1 -1

Page 86: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

-1 -1 +100

-1 -1 -1

-1 -1 -1

What action should we take if we are in this state?

World - 3 by 3 gridActions - Up, Down, Left, RightRewards - All states have a -1 with the exception of top right

Page 87: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Can we teach a Taxi to pick up a passenger and drive to destination?

Reinforcement Learning

Page 88: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

Page 89: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

Taxi is on this square with the passenger, dropoff location is "G". Which action should it take?

Page 90: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

Taxi is on this square with the passenger, dropoff location is "G". Which action should it take?

dropoff

Page 91: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

Taxi is on this square with the passenger, dropoff location is "G". Which action should it take?

Page 92: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

Taxi is on this square with the passenger, dropoff location is "G". Which action should it take?

right

Page 93: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

How many states can we possibly have?

Page 94: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

How many states can we have?

5x5 grid = 25Passenger can be at either of 4 locations or on board = 5Destination = 4

25 * 5 * 4 = 500 states

Page 95: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

What if we create a table and learn what action to take at each state?

Page 96: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Reinforcement Learning

World - 5 by 5 grid, 4 designated locationsActions - Up, Down, Left, Right, Pickup, DropoffRewards - All states have a -1 with the exception of being at the destination and dropping passenger which has +20

What if we create a table and learn what action to take at each state?

Page 97: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

What if the state space is really big (continuous) ?

Reinforcement Learning

Page 98: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

What if the state space is really big (continuous) ?

Reinforcement Learning

Page 99: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Balance a pole

Keep a pole standing for as long as possible

Reinforcement Learning

Page 100: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Land in the moon!

Fire the spaceship engines to land in the moon!

Reinforcement Learning

Page 101: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

MIT 6.148

Smart Web apps using Machine Learning

Page 102: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Sentiment & Text Analysis

Extract Information about Text and understand Sentiment

Page 103: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Image classification

Detect object within image

Page 104: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Chatbots

Page 105: MIT 6.148 Smart Web apps using Machine Learningwebdevelopment.mit.edu/2018/pages/lectures/WEBday7_appian.pdf · 10 7 3 5 5 It's just a weighted decision. If the output is equal or

Thank you!Questions?Carlos Aguayo

[email protected]

https://www.linkedin.com/in/carlosaguayo/