COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University...

68
COMP 150: Developmental Robotics Instructor: Jivko Sinapov www.cs.tufts.edu/~jsinapov

Transcript of COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University...

Page 1: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

COMP 150: Developmental Robotics

Instructor: Jivko Sinapovwww.cs.tufts.edu/~jsinapov

Page 2: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Northeast Robotics Colloquium

● Held at Northeastern University on Saturday October 21st

● https://nerc2017.ccis.northeastern.edu/● Deadline for registration: October 15● $50 dollars for graduate students, $10 for

undergrads

Page 3: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Project Related Deadlines

● Team-up by the end of class, Thursday Oct 5● “Preliminary” project ideas presentations:

Tuesday Oct 10 and Thursday October 12● Project Proposal is due October 26 (midnight )

Page 4: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Written Project Proposal

● 5 pages + 1 for references● Template: default google doc or default LaTeX

(e.g., using overleaf.com)– Do not change margins, font sizes, spacing, etc.

Page 5: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Proposal Sections

● Abstract (1 paragraph)● Introduction● Related Work● Problem Formulation and Technical Approach● Expected Results / Experimental Validation

– What is your criteria for success?

● Timeline / Schedule

Page 6: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Overview of Machine Learning

Page 7: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Topics

● Unsupervised Learning

● Classification / Recognition / Prediction

● Reinforcement Learning

Page 8: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Unsupervised Learning

● “Learns” from the features of data alone – no direct feedback or label for each data point

● Main goal: transform the data into some other form that is useful for tasks further on or easily interpretable by a human

Page 9: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Clustering

[ https://home.deib.polimi.it/matteucc/Clustering/tutorial_html/images/clustering.gif ]

Page 10: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

K-Means Clustering

Page 11: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

[http://cs.nyu.edu/~dsontag/courses/ml12/slides/lecture14.pdf]

Page 12: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

[http://cs.nyu.edu/~dsontag/courses/ml12/slides/lecture14.pdf]

Page 13: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

[http://cs.nyu.edu/~dsontag/courses/ml12/slides/lecture14.pdf]

Page 14: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

[http://cs.nyu.edu/~dsontag/courses/ml12/slides/lecture14.pdf]

Page 15: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

[http://cs.nyu.edu/~dsontag/courses/ml12/slides/lecture14.pdf]

Page 16: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

What are some of the limitations of k-means clustering?

Page 17: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Graph-based Clustering Algorithms

Page 18: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Spectral Clustering

How can we split the graph into two graphs as to minimize the weights of the edges being cut and maximize those of the rest?

Page 19: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Spectral Clustering

How can we split the graph into two graphs as to minimize the weights of the edges being cut and maximize those of the rest?

Page 20: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Hierarchical Clustering

[http://blog.hackerearth.com/wp-content/uploads/2017/01/flow-01.jpg]

Page 21: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

What are some of the practical issues related to using clustering?

● Choice of distance / similarity function● Choice of number of clusters● ...

Page 22: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate
Page 23: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Dimensionality Reduction

[ http://jntsai.blogspot.com/2015/04/ammai-nonlinear-dimensionality.html ]

Page 24: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

What are some situations where a robot would need to use unsupervised learning (e.g.,clustering?

(discussion)

Page 25: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Machine Learning Frameworks

supervised unsupervised

disc

rete

cont

inuo

us

classification or categorization

clustering

dimensionality reduction and manifold

learning regression

Page 26: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Classification

Page 27: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Non-linear Classification

Page 28: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Notation

Inputs: Outputs:

set of classes:where

Page 29: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Problem Formulation

y = f(x)

• Training: given a training set of labeled examples {(x1,y1), …, (xN,yN)}, estimate the function f by minimizing the error on the training set

• Testing: apply f to a never before seen test example x and output the predicted value y = f(x)

output classification function

data point

Slide credit: L. Lazebnik

Page 30: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Example Problem

Input data:

[1 0 0 1 1 1 0 1 0]

[0 1 0 1 1 1 0 0 1]

[1 0 1 1 0 0 1 0 1]

[0 1 0 1 0 0 0 1 1]

Class Labels:

+1

-1

+1

-1

Page 31: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

1-Nearest Neighbor

x x

xx

x

x

x

xo

oo

o

o

o

o

x2

x1

+

+

Page 32: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

3-Nearest Neighbor

x x

xx

x

x

x

xo

oo

o

o

o

o

x2

x1

+

+

Page 33: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Linear Classifier

• Finds a linear function to separate the classes:

f(x) = sgn(w x + b)

Slide credit: L. Lazebnik

x x

xx

x

x

x

x

oo

o

o

o

x2

x1

Page 34: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Training a Linear Classifier

Page 35: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Random Initialization

x2

x1

Page 36: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

First data point….

x

x2

x1

Page 37: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Second data point...

x

ox2

x1

Page 38: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

3rd data point: Error!

x

ox2

x1

o

Page 39: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Update: change w and b in the direction that minimizes the error

x

ox2

x1

o

Page 40: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

And so on...

x

ox2

x1

o

x

x

Page 41: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

And so on...

x

ox2

x1

o

x

x

Page 42: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

And so on...

x

ox2

x1

o

x

x

Page 43: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

And so on...

x

ox2

x1

o

x

x

x

x

x

oo

o

Page 44: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

The Algorithm

[https://i.stack.imgur.com/SCfew.png]

Page 45: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Linear Classifier

• How do we decide which line is the best?

Slide credit: L. Lazebnik

x x

xx

x

x

x

x

oo

o

o

o

x2

x1

Page 46: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Answer: maximize the margin

x x

xx

x

x

x

x

oo

o

o

o

x2

x1

This is called the margin

Page 47: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Answer: maximize the margin

x x

xx

x

x

x

x

oo

o

o

o

x2

x1

What happens when the data is not linearly separable?

o

Page 48: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Answer: map the data into a higher dimensional space

[http://www.imtech.res.in/raghava/rbpred/svm.jpg]

Page 49: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Nonlinear Support Vector Machine

0 x

0 x

Linearly separable:

Not linearly separable:

Page 50: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Can we construct a mapping function from 1D to 2D such that the data in the 2D space is linearly

separable?

0 x

Input space Feature space

φ(x) → <x1,x

2>

In other words, both x1 and x

2 need to be function of x

Page 51: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Can we construct a mapping function from 1D to 2D such that the data in the 2D space is linearly

separable?

0 x

Input space Feature space

φ(x) → <x,x>

Page 52: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Can we construct a mapping function from 1D to 2D such that the data in the 2D space is linearly

separable?

0 x

Input space Feature space

φ(x) → <x,|x|>

x2

Page 53: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Can we construct a mapping function from 1D to 2D such that the data in the 2D space is linearly

separable?

0 x

Input space Feature space

φ(x) → <x,x2>

x1

x2

Page 54: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Nonlinear Support Vector Machine

• The kernel trick: instead of explicitly computing the lifting transformation φ(x), define a kernel function K such that

K(xi , xj) = φ(xi ) · φ(xj)

(to be valid, the kernel function must satisfy Mercer’s condition)

• Intuitively, the kernel function should encode a measure of similarity between xi and xj

Page 55: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Nonlinear Support Vector Machine

Consider the mapping ),()( 2xxx

22

2222

),(

),(),()()(

yxxyyxK

yxxyyyxxyx

x2

Page 56: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

There are many other classifiers out there...

Page 57: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Decision Trees

[http://cdn2.hubspot.net/hub/64283/file-15380323-png/images/rapidminer-decision-tree-personal-loan-accept.png]

Page 58: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Feed-Forward Neural Networks

[http://cs231n.github.io/assets/nn1/neural_net2.jpeg]

Page 59: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Deep Learning Methods

Page 60: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Deep Learning Methods

http://www.kdnuggets.com/wp-content/uploads/deep-learning.png

Page 61: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

There are many ways to combine classifiers...

Page 62: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Classifier Ensembles

Page 63: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Boosting

Sequences of classifiers that grows in complexity of classifier

http://www.svcl.ucsd.edu/~ehsan/web/Img/cascadeflow.jpg

Page 64: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

http://www.chioka.in/wp-content/uploads/2013/09/stacking.png

Page 65: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Project Breakout (10 – 15 min)

What are some ways you can use unsupervised and/or supervised machine learning methods in your project?

What are the “data points” going to be? What will they encode?

Where are the labels going to come from?

Page 66: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Take-home message

“The decision to use machine learning is more important than the choice of a particular learning method.”

- James Hays, Brown University

Page 67: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate

Resources

● Introduction to Machine Learning textbook: http://alex.smola.org/drafts/thebook.pdf

● WEKA Machine Learning Library (in Java): http://www.cs.waikato.ac.nz/ml/weka/

● Support Vector Machine example using OpenCV: http://docs.opencv.org/2.4/doc/tutorials/ml/introduction_to_svm/introduction_to_svm.html

● ML library in Python: http://scikit-learn.org/stable/

Page 68: COMP 150: Developmental Robotics · Northeast Robotics Colloquium Held at Northeastern University on Saturday October 21st Deadline for registration: October 15 $50 dollars for graduate