lecture 17 ml supp - github pages · lecture 17: linear classifiers and support vector machines...

26
CS639: Data Management for Data Science Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by Ankur Goswami many slides from David Sontag) 1

Upload: others

Post on 14-Aug-2020

5 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

CS639:DataManagementfor

DataScienceLecture17:LinearClassifiersandSupportVectorMachines

TheodorosRekatsinas(lecturebyAnkur Goswami manyslidesfromDavidSontag)

1

Page 2: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Today’sLecture

1. Linearclassifiers

2. ThePerceptronAlgorithm

3. SupportVectorMachines

2

Page 3: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Linearclassifier• Let’ssimplifylifebyassuming:

• Everyinstanceisavectorofrealnumbers,x=(x1,…,xn).(Notation:boldfacexisavector.)

• Thereareonlytwoclasses,y=(+1) andy=(-1)

• Alinearclassifier isvectorw ofthesamedimensionasx thatisusedtomakethisprediction:

)(sign)...sign(ˆ 2211 xw ×=+++= nnxwxwxwy

þýü

îíì

<-³+

=0if10 if1

)(signx

x

Page 4: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Example:Linearclassifier

Page 5: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

ThePerceptronAlgorithmtolearnaLinearClassifier

Page 6: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Definition:Linearlyseparabledata

Page 7: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Doestheperceptronalgorithmwork?

Page 8: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Propertiesoftheperceptronalgorithm

Page 9: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Problemswiththeperceptronalgorithm

[Wewillseenextweek]

Page 10: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Linearseparators

Page 11: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

SupportVectorMachines

Page 12: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Normaltoaplane

Page 13: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Scaleinvariance

Page 14: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Scaleinvariance

Page 15: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Whatisγasafunctionofw?

Page 16: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

SupportVectorMachines(SVMs)

Page 17: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Whatifthedataisnotseparable?

Page 18: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Allowingforslack:“Softmargin”SVM

Page 19: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Allowingforslack:“Softmargin”SVM

Page 20: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

EquivalentHingeLossFormulation

Page 21: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

HingeLossvs0-1Loss

Page 22: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

MulticlassSVM

Page 23: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Oneversusallclassification

Page 24: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

MulticlassSVM

Page 25: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

MulticlassSVM

Page 26: Lecture 17 ML supp - GitHub Pages · Lecture 17: Linear Classifiers and Support Vector Machines Theodoros Rekatsinas (lecture by AnkurGoswamimany slides from David Sontag) 1. Today’s

Whatyouneedtoknow