Words & Pictures Tamara Berg Features Announcements - - PowerPoint PPT Presentation

words pictures
SMART_READER_LITE
LIVE PREVIEW

Words & Pictures Tamara Berg Features Announcements - - PowerPoint PPT Presentation

Words & Pictures Tamara Berg Features Announcements HW1 out on Tues Look over paper list and select a paper you want to present in


slide-1
SLIDE 1

Words ¡& ¡Pictures ¡

Tamara ¡Berg ¡ Features ¡

slide-2
SLIDE 2

Announcements ¡

  • HW1 ¡out ¡on ¡Tues ¡
  • Look ¡over ¡paper ¡list ¡and ¡select ¡a ¡paper ¡you ¡

want ¡to ¡present ¡in ¡class ¡(30 ¡minutes, ¡any ¡“?” ¡ is ¡up ¡for ¡grabs) ¡

  • Remember ¡paper ¡summaries ¡due ¡before ¡class ¡
  • n ¡paper ¡presentaJon ¡days ¡

(cse595@gmail.com) ¡

slide-3
SLIDE 3

Image ¡Features ¡ ¡ ¡Global ¡vs ¡Local ¡ ¡Common ¡features: ¡color ¡histograms ¡(color), ¡ texture ¡histograms ¡(texture), ¡SIFT ¡(shape) ¡ Text ¡Features ¡ ¡Vector ¡representaJons ¡ ¡WeighJng ¡– ¡X ¡x ¡idf ¡ ¡Sparsity ¡and ¡word ¡relaJonships ¡(LSA) ¡

Outline ¡

slide-4
SLIDE 4

Image ¡Features ¡

slide-5
SLIDE 5

Global ¡Features ¡

  • The ¡“gist” ¡of ¡a ¡scene: ¡Oliva ¡& ¡Torralba ¡(2001) ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-6
SLIDE 6

Example: ¡Scene ¡compleJon ¡using ¡ millions ¡of ¡photographs ¡

Input ¡image ¡ Scene ¡Descriptor ¡

Image ¡Collec4on ¡

200 ¡matches ¡ 20 ¡comple4ons ¡ Context ¡matching ¡ + ¡blending ¡

… ¡ … ¡

Hays ¡and ¡Efros, ¡SIGGRAPH ¡2007 ¡

slide-7
SLIDE 7

Scene ¡Descriptor ¡

Hays ¡and ¡Efros, ¡SIGGRAPH ¡2007 ¡

Compute ¡oriented ¡edge ¡response ¡at ¡mulJple ¡scales ¡(5 ¡spaJal ¡scales, ¡6 ¡orientaJons) ¡

slide-8
SLIDE 8

Scene ¡Descriptor ¡

Gist ¡scene ¡descriptor ¡(Oliva ¡and ¡Torralba ¡2001) ¡ ¡“semanJc” ¡descriptor ¡of ¡image ¡composiJon ¡ ¡aggregated ¡edge ¡responses ¡over ¡4x4 ¡windows ¡ ¡scenes ¡tend ¡to ¡be ¡semanJcally ¡similar ¡under ¡this ¡descriptor ¡if ¡very ¡close ¡

Hays ¡and ¡Efros, ¡SIGGRAPH ¡2007 ¡

slide-9
SLIDE 9

Scene ¡Descriptor ¡

+ ¡

Gist ¡scene ¡descriptor ¡ ¡ (Oliva ¡and ¡Torralba ¡2001) ¡

Hays ¡and ¡Efros, ¡SIGGRAPH ¡2007 ¡

Color ¡descriptor ¡– ¡color ¡of ¡the ¡query ¡ image ¡downsampled ¡to ¡4x4 ¡

slide-10
SLIDE 10

Hays ¡and ¡Efros, ¡SIGGRAPH ¡2007 ¡

Final ¡result ¡– ¡blended ¡between ¡the ¡two ¡images ¡along ¡the ¡cut ¡to ¡merge ¡seamlessly ¡

slide-11
SLIDE 11

Local ¡Features ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡ Feature ¡points ¡(locaJons) ¡+ ¡feature ¡descriptors ¡

slide-12
SLIDE 12

Why ¡extract ¡features? ¡

  • MoJvaJon: ¡panorama ¡sJtching ¡

– We ¡have ¡two ¡images ¡– ¡how ¡do ¡we ¡combine ¡them? ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-13
SLIDE 13

Why ¡extract ¡features? ¡

  • MoJvaJon: ¡panorama ¡sJtching ¡

– We ¡have ¡two ¡images ¡– ¡how ¡do ¡we ¡combine ¡them? ¡

Step ¡1: ¡extract ¡features ¡ Step ¡2: ¡match ¡features ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-14
SLIDE 14

Why ¡extract ¡features? ¡

  • MoJvaJon: ¡panorama ¡sJtching ¡

– We ¡have ¡two ¡images ¡– ¡how ¡do ¡we ¡combine ¡them? ¡

Step ¡1: ¡extract ¡features ¡ Step ¡2: ¡match ¡features ¡ Step ¡3: ¡align ¡images ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-15
SLIDE 15

CharacterisJcs ¡of ¡good ¡features ¡

  • Repeatability ¡

– The ¡same ¡feature ¡can ¡be ¡found ¡in ¡several ¡images ¡despite ¡geometric ¡and ¡ photometric ¡transformaJons ¡ ¡

  • Saliency ¡

– Each ¡feature ¡has ¡a ¡disJncJve ¡descripJon ¡

  • Compactness ¡and ¡efficiency ¡

– Many ¡fewer ¡features ¡than ¡image ¡pixels ¡

  • Locality ¡

– A ¡feature ¡occupies ¡a ¡relaJvely ¡small ¡area ¡of ¡the ¡image; ¡robust ¡to ¡cluger ¡and ¡

  • cclusion ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-16
SLIDE 16

ApplicaJons ¡ ¡ ¡

  • Feature ¡points ¡are ¡used ¡for: ¡

– MoJon ¡tracking ¡ – Image ¡alignment ¡ ¡ – 3D ¡reconstrucJon ¡ – Object ¡recogniJon ¡ – Indexing ¡and ¡database ¡retrieval ¡ – Robot ¡navigaJon ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-17
SLIDE 17

Feature ¡Types ¡

Shape! ¡ Color! ¡ Texture! ¡

slide-18
SLIDE 18

Color ¡Features ¡

slide-19
SLIDE 19

Linear ¡color ¡spaces: ¡RGB ¡

  • Primaries ¡are ¡monochromaJc ¡lights ¡(for ¡monitors, ¡

they ¡correspond ¡to ¡the ¡three ¡types ¡of ¡phosphors) ¡

RGB ¡matching ¡funcJons ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-20
SLIDE 20

Nonlinear ¡color ¡spaces: ¡HSV ¡

  • Perceptually ¡meaningful ¡dimensions: ¡ ¡

Hue, ¡SaturaJon, ¡Value ¡(Intensity) ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-21
SLIDE 21

Color ¡Histograms ¡

slide-22
SLIDE 22

Uses ¡of ¡color ¡in ¡computer ¡vision ¡

Color ¡histograms ¡for ¡indexing ¡and ¡retrieval ¡

Swain ¡and ¡Ballard, ¡Color ¡Indexing, ¡IJCV ¡1991. ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-23
SLIDE 23

Uses ¡of ¡color ¡in ¡computer ¡vision ¡

Skin ¡detecJon ¡

  • M. ¡Jones ¡and ¡J. ¡Rehg, ¡StaJsJcal ¡Color ¡Models ¡with ¡ApplicaJon ¡to ¡Skin ¡DetecJon, ¡

IJCV ¡2002. ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-24
SLIDE 24

Uses ¡of ¡color ¡in ¡computer ¡vision ¡

Image ¡segmentaJon ¡ ¡ and ¡retrieval ¡

  • C. ¡Carson, ¡S. ¡Belongie, ¡H. ¡Greenspan, ¡and ¡Ji. ¡Malik, ¡Blobworld: ¡Image ¡

segmentaJon ¡using ¡ExpectaJon-­‑MaximizaJon ¡and ¡its ¡applicaJon ¡to ¡image ¡ querying, ¡ICVIS ¡1999. ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-25
SLIDE 25

InteracJon ¡of ¡light ¡and ¡surfaces ¡

  • Reflected ¡color ¡is ¡the ¡result ¡of ¡

interacJon ¡of ¡light ¡source ¡ spectrum ¡with ¡surface ¡ reflectance ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-26
SLIDE 26

InteracJon ¡of ¡light ¡and ¡surfaces ¡

  • What ¡is ¡the ¡observed ¡color ¡of ¡any ¡surface ¡

under ¡monochromaJc ¡light? ¡

Olafur ¡Eliasson, ¡Room ¡for ¡one ¡color ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-27
SLIDE 27

Texture ¡Features ¡

slide-28
SLIDE 28

Texture ¡Features ¡

  • Texture ¡is ¡characterized ¡by ¡the ¡repeJJon ¡of ¡basic ¡

elements ¡or ¡textons ¡

  • For ¡stochasJc ¡textures, ¡it ¡is ¡the ¡idenJty ¡of ¡the ¡

textons, ¡not ¡their ¡spaJal ¡arrangement, ¡that ¡ magers ¡

Julesz, ¡1981; ¡Cula ¡& ¡Dana, ¡2001; ¡Leung ¡& ¡Malik ¡2001; ¡Mori, ¡Belongie ¡& ¡Malik, ¡2001; ¡Schmid ¡ 2001; ¡Varma ¡& ¡Zisserman, ¡2002, ¡2003; ¡Lazebnik, ¡Schmid ¡& ¡Ponce, ¡2003 ¡

slide-29
SLIDE 29

Texture ¡Histograms ¡

Universal ¡texton ¡dicJonary ¡ histogram ¡ Julesz, ¡1981; ¡Cula ¡& ¡Dana, ¡2001; ¡Leung ¡& ¡Malik ¡2001; ¡Mori, ¡Belongie ¡& ¡Malik, ¡2001; ¡Schmid ¡ 2001; ¡Varma ¡& ¡Zisserman, ¡2002, ¡2003; ¡Lazebnik, ¡Schmid ¡& ¡Ponce, ¡2003 ¡

slide-30
SLIDE 30

Shape ¡Features ¡

slide-31
SLIDE 31

We ¡want ¡invariance!!! ¡

  • Good ¡features ¡should ¡be ¡robust ¡to ¡all ¡sorts ¡of ¡

nasJness ¡that ¡can ¡occur ¡between ¡images. ¡ ¡ ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-32
SLIDE 32

Types ¡of ¡invariance ¡

  • IlluminaJon ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-33
SLIDE 33

Types ¡of ¡invariance ¡

  • IlluminaJon ¡
  • Scale ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-34
SLIDE 34

Types ¡of ¡invariance ¡

  • IlluminaJon ¡
  • Scale ¡
  • RotaJon ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-35
SLIDE 35

Types ¡of ¡invariance ¡

  • IlluminaJon ¡
  • Scale ¡
  • RotaJon ¡
  • Affine ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-36
SLIDE 36

Edge ¡detecJon ¡

  • Goal: ¡ ¡IdenJfy ¡sudden ¡

changes ¡(disconJnuiJes) ¡in ¡ an ¡image ¡

– IntuiJvely, ¡most ¡semanJc ¡and ¡ shape ¡informaJon ¡from ¡the ¡ image ¡can ¡be ¡encoded ¡in ¡the ¡ edges ¡ – More ¡compact ¡than ¡pixels ¡

  • Ideal: ¡arJst’s ¡line ¡drawing ¡

(but ¡arJst ¡is ¡also ¡using ¡

  • bject-­‑level ¡knowledge) ¡

Source: ¡D. ¡Lowe ¡

slide-37
SLIDE 37

Origin ¡of ¡edges ¡

  • Edges ¡are ¡caused ¡by ¡a ¡variety ¡of ¡factors: ¡

depth ¡disconJnuity ¡ surface ¡color ¡disconJnuity ¡ illuminaJon ¡disconJnuity ¡ surface ¡normal ¡disconJnuity ¡

Source: ¡Steve ¡Seitz ¡

slide-38
SLIDE 38

Characterizing ¡edges ¡

  • An ¡edge ¡is ¡a ¡place ¡of ¡rapid ¡change ¡in ¡the ¡

image ¡intensity ¡funcJon ¡

image ¡ intensity ¡funcJon ¡ (along ¡horizontal ¡scanline) ¡ first ¡derivaJve ¡ edges ¡correspond ¡to ¡ extrema ¡of ¡derivaJve ¡ source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-39
SLIDE 39

Finite ¡difference ¡filters ¡

  • Other ¡approximaJons ¡of ¡derivaJve ¡filters ¡

exist: ¡

Source: ¡K. ¡Grauman ¡

slide-40
SLIDE 40

Finite ¡differences: ¡example ¡

  • Which ¡one ¡is ¡the ¡gradient ¡in ¡the ¡x-­‑direcJon ¡(resp. ¡y-­‑direcJon)? ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-41
SLIDE 41

How ¡to ¡achieve ¡illuminaJon ¡invariance ¡

  • Use ¡edges ¡instead ¡of ¡raw ¡

values ¡ ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-42
SLIDE 42

Local ¡Features ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡ Feature ¡points ¡(locaJons) ¡+ ¡feature ¡descriptors ¡

slide-43
SLIDE 43

Local ¡Features ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡ Feature ¡points ¡(locaJons) ¡+ ¡feature ¡descriptors ¡ Where ¡should ¡we ¡put ¡features? ¡

slide-44
SLIDE 44

Local ¡Features ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡ Feature ¡points ¡(locaJons) ¡+ ¡feature ¡descriptors ¡ How ¡should ¡we ¡describe ¡them? ¡

slide-45
SLIDE 45

Where ¡to ¡put ¡features? ¡ ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

Edges ¡

slide-46
SLIDE 46

Finding ¡Corners ¡

  • Key ¡property: ¡in ¡the ¡region ¡around ¡a ¡

corner, ¡image ¡gradient ¡has ¡two ¡or ¡more ¡ dominant ¡direcJons ¡

  • Corners ¡are ¡repeatable ¡and ¡disJncJve ¡

C.Harris ¡and ¡M.Stephens. ¡"A ¡Combined ¡Corner ¡and ¡Edge ¡Detector.“ ¡ Proceedings ¡of ¡the ¡4th ¡Alvey ¡Vision ¡Conference: ¡pages ¡147-­‑-­‑151. ¡ ¡ ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-47
SLIDE 47

Corner ¡DetecJon: ¡Basic ¡Idea ¡

  • We ¡should ¡easily ¡recognize ¡the ¡point ¡by ¡

looking ¡through ¡a ¡small ¡window ¡

  • Shiving ¡a ¡window ¡in ¡any ¡direc:on ¡should ¡

give ¡a ¡large ¡change ¡in ¡intensity ¡

“edge”:
 no change along the edge direction “corner”:
 significant change in all directions “flat” region:
 no change in all directions

Source: ¡A. ¡Efros ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-48
SLIDE 48

Harris ¡Detector: ¡Steps ¡

Compute ¡corner ¡response ¡R ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-49
SLIDE 49

Harris ¡Detector: ¡Steps ¡

Find ¡points ¡with ¡large ¡corner ¡response: ¡R>threshold ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-50
SLIDE 50

Harris ¡Detector: ¡Steps ¡

Take ¡only ¡the ¡points ¡of ¡local ¡maxima ¡of ¡R ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-51
SLIDE 51

Harris ¡Detector: ¡Steps ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡

slide-52
SLIDE 52

Local ¡Features ¡

source: ¡Svetlana ¡Lazebnik ¡ ¡ Feature ¡points ¡(locaJons) ¡+ ¡feature ¡descriptors ¡ How ¡should ¡we ¡describe ¡them? ¡

slide-53
SLIDE 53

Shape ¡Context ¡

  • (a) ¡and ¡(b) ¡are ¡the ¡sampled ¡edge ¡points ¡of ¡the ¡two ¡shapes. ¡(c) ¡is ¡the ¡diagram ¡of ¡the ¡

log-­‑polar ¡bins ¡used ¡to ¡compute ¡the ¡shape ¡context. ¡(d) ¡is ¡the ¡shape ¡context ¡for ¡the ¡ circle, ¡(e) ¡is ¡that ¡for ¡the ¡diamond, ¡and ¡(f) ¡is ¡that ¡for ¡the ¡triangle. ¡As ¡can ¡be ¡seen, ¡ since ¡(d) ¡and ¡(e) ¡are ¡the ¡shape ¡contexts ¡for ¡two ¡closely ¡related ¡points, ¡they ¡are ¡ quite ¡similar, ¡while ¡the ¡shape ¡context ¡in ¡(f) ¡is ¡very ¡different. ¡

slide-54
SLIDE 54

Geometric ¡Blur ¡

slide-55
SLIDE 55

Geometric ¡Blur ¡

slide-56
SLIDE 56

Geometric ¡Blur ¡

slide-57
SLIDE 57

SIFT ¡

  • SIFT ¡(Scale ¡Invariant ¡Feature ¡Transform) ¡-­‑ ¡

stable ¡robust ¡and ¡disJncJve ¡local ¡features ¡

  • Current ¡most ¡popular ¡shape ¡based ¡feature ¡– ¡

descripJon ¡of ¡local ¡shape ¡(oriented ¡edges) ¡ around ¡a ¡keypoint ¡

slide-58
SLIDE 58

Scale Invariance

  • Find the points, whose surrounding patches (with some

scale) are distinctive find points that are distinctive in both position (x,y) and scale look for maxima/minima in DoG pyramid

slide-59
SLIDE 59

Maxima ¡and ¡minima ¡in ¡a ¡ ¡ 3*3*3 ¡neighborhood ¡

slide-60
SLIDE 60

Maxima ¡and ¡minima ¡in ¡a ¡ ¡ 3*3*3 ¡neighborhood ¡

slide-61
SLIDE 61

Differences ¡Of ¡Gaussians ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-62
SLIDE 62

RotaJon ¡Invariance ¡

  • Rotate ¡all ¡features ¡to ¡go ¡the ¡same ¡way ¡in ¡a ¡

determined ¡manner ¡

  • A histogram is formed by quantizing the
  • rientations into 36 bins;
  • Peaks in the histogram correspond to the
  • rientations of the patch;
slide-63
SLIDE 63

EliminaJng ¡rotaJon ¡ambiguity ¡

  • To ¡assign ¡a ¡unique ¡orientaJon ¡to ¡circular ¡

image ¡windows: ¡

– Create ¡histogram ¡of ¡local ¡gradient ¡direcJons ¡in ¡ the ¡patch ¡ – Assign ¡canonical ¡orientaJon ¡at ¡peak ¡of ¡ smoothed ¡histogram ¡

0 ¡ 2 ¡π ¡

slide-64
SLIDE 64

RotaJon ¡Invariance ¡

Slide ¡source: ¡Tom ¡Duerig ¡

slide-65
SLIDE 65

Feature ¡descriptor ¡

slide-66
SLIDE 66

Feature ¡descriptor ¡

  • Based ¡on ¡16*16 ¡patches ¡
  • 4*4 ¡subregions ¡
  • 8 ¡bins ¡in ¡each ¡subregion ¡
  • 4*4*8=128 ¡dimensions ¡in ¡total ¡
slide-67
SLIDE 67

Actual ¡SIFT ¡stage ¡output ¡

slide-68
SLIDE 68

ApplicaJon: ¡object ¡recogniJon ¡

  • The ¡SIFT ¡features ¡of ¡training ¡images ¡are ¡

extracted ¡and ¡stored ¡

  • For ¡a ¡query ¡image ¡
  • 1. Extract ¡SIFT ¡feature ¡
  • 2. Efficient ¡nearest ¡neighbor ¡indexing ¡
  • 3. 3 ¡keypoints, ¡Geometry ¡verificaJon ¡
slide-69
SLIDE 69
slide-70
SLIDE 70
slide-71
SLIDE 71
slide-72
SLIDE 72

Text ¡Features ¡

slide-73
SLIDE 73

Features ¡== ¡Words! ¡

slide-74
SLIDE 74

RepresentaJon ¡quesJons ¡

  • Model ¡whole ¡document ¡or ¡subparts ¡of ¡

documents ¡-­‑ ¡global ¡vs ¡local ¡

  • Words ¡vs ¡strings ¡ ¡-­‑ ¡do ¡you ¡want ¡to ¡allow ¡for ¡

strings ¡not ¡in ¡the ¡dicJonary/lexicon ¡common ¡ in ¡folksonomies ¡

  • Noise ¡words ¡– ¡some ¡words ¡may ¡not ¡be ¡related ¡

to ¡content ¡(e.g. ¡stop ¡words: ¡a, ¡and, ¡the) ¡

  • Orderless ¡(bag ¡of ¡words) ¡vs ¡representaJons ¡

that ¡care ¡about ¡order/syntax ¡etc. ¡

slide-75
SLIDE 75

Document ¡Vectors ¡

slide-76
SLIDE 76

Document ¡Vectors ¡

  • Represent ¡document ¡as ¡a ¡“bag ¡of ¡words” ¡
slide-77
SLIDE 77

Example ¡

  • Doc1 ¡= ¡“the ¡quick ¡brown ¡fox ¡jumped” ¡
  • Doc2 ¡= ¡“brown ¡quick ¡jumped ¡fox ¡the” ¡
slide-78
SLIDE 78

Example ¡

  • Doc1 ¡= ¡“the ¡quick ¡brown ¡fox ¡jumped” ¡
  • Doc2 ¡= ¡“brown ¡quick ¡jumped ¡fox ¡the” ¡

Would ¡a ¡bag ¡of ¡words ¡model ¡represent ¡these ¡ two ¡documents ¡differently? ¡ ¡

slide-79
SLIDE 79

Document ¡Vectors ¡

  • Documents ¡are ¡represented ¡as ¡“bags ¡of ¡words” ¡
  • Represented ¡as ¡vectors ¡when ¡used ¡computa4onally ¡
  • Each ¡vector ¡holds ¡a ¡place ¡for ¡every ¡term ¡in ¡the ¡collecJon ¡
  • Therefore, ¡most ¡vectors ¡are ¡sparse ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-80
SLIDE 80

Document ¡Vectors ¡

  • Documents ¡are ¡represented ¡as ¡“bags ¡of ¡words” ¡
  • Represented ¡as ¡vectors ¡when ¡used ¡computa4onally ¡
  • Each ¡vector ¡holds ¡a ¡place ¡for ¡every ¡term ¡in ¡the ¡collecJon ¡
  • Therefore, ¡most ¡vectors ¡are ¡sparse ¡

Slide ¡from ¡Mitch ¡Marcus ¡

Lexicon ¡– ¡the ¡vocabulary ¡set ¡that ¡you ¡consider ¡to ¡be ¡valid ¡ words ¡in ¡your ¡documents. ¡ ¡ ¡Usually ¡stemmed ¡(e.g. ¡running-­‑>run) ¡

slide-81
SLIDE 81

Document ¡Vectors: ¡ One ¡locaJon ¡for ¡each ¡word. ¡ ¡

nova galaxy heat h’wood film role diet fur 10 5 3 5 10 10 8 7 9 10 5 10 10 9 10 5 7 9 6 10 2 8 7 5 1 3 A A B B C C D D E E F F G G H H I I

“Nova” ¡occurs ¡10 ¡Jmes ¡in ¡text ¡A ¡ “Galaxy” ¡occurs ¡5 ¡Jmes ¡in ¡text ¡A ¡ “Heat” ¡occurs ¡3 ¡Jmes ¡in ¡text ¡A ¡ (Blank ¡means ¡0 ¡occurrences.) ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-82
SLIDE 82

Document ¡Vectors: ¡ One ¡locaJon ¡for ¡each ¡word. ¡ ¡

nova galaxy heat h’wood film role diet fur 10 5 3 5 10 10 8 7 9 10 5 10 10 9 10 5 7 9 6 10 2 8 7 5 1 3 A A B B C C D D E E F F G G H H I I

“Nova” ¡occurs ¡10 ¡Jmes ¡in ¡text ¡A ¡ “Galaxy” ¡occurs ¡5 ¡Jmes ¡in ¡text ¡A ¡ “Heat” ¡occurs ¡3 ¡Jmes ¡in ¡text ¡A ¡ (Blank ¡means ¡0 ¡occurrences.) ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-83
SLIDE 83

Document ¡Vectors ¡ ¡

nova galaxy heat h’wood film role diet fur 10 5 3 5 10 10 8 7 9 10 5 10 10 9 10 5 7 9 6 10 2 8 7 5 1 3 A A B B C C D D E E F F G G H H I I

Document ids

Slide ¡from ¡Mitch ¡Marcus ¡

slide-84
SLIDE 84

Vector ¡Space ¡Model ¡

  • Documents ¡are ¡represented ¡as ¡vectors ¡in ¡term ¡space ¡
  • Terms ¡are ¡usually ¡stems ¡
  • Documents ¡represented ¡by ¡vectors ¡of ¡terms ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-85
SLIDE 85

Vector ¡Space ¡Model ¡

  • Documents ¡are ¡represented ¡as ¡vectors ¡in ¡term ¡space ¡
  • Terms ¡are ¡usually ¡stems ¡
  • Documents ¡represented ¡by ¡vectors ¡of ¡terms ¡
  • A ¡vector ¡distance ¡measure ¡between ¡documents ¡is ¡used ¡to ¡

measure ¡document ¡similarity ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-86
SLIDE 86

Document ¡Vectors ¡ ¡

nova galaxy heat h’wood film role diet fur 10 5 3 5 10 10 8 7 9 10 5 10 10 9 10 5 7 9 6 10 2 8 7 5 1 3 A A B B C C D D E E F F G G H H I I

Document ids

Slide ¡from ¡Mitch ¡Marcus ¡

slide-87
SLIDE 87

Similarity ¡between ¡documents ¡

A ¡= ¡[10 ¡5 ¡3 ¡0 ¡0 ¡0 ¡0 ¡0]; ¡ G ¡= ¡[5 ¡0 ¡7 ¡0 ¡0 ¡9 ¡0 ¡0]; ¡ E ¡= ¡[0 ¡0 ¡0 ¡0 ¡0 ¡10 ¡10 ¡0]; ¡

slide-88
SLIDE 88

Similarity ¡between ¡documents ¡

A ¡= ¡[10 ¡ ¡5 ¡ ¡3 ¡ ¡0 ¡ ¡ ¡0 ¡ ¡ ¡ ¡ ¡0 ¡ ¡ ¡ ¡0 ¡ ¡ ¡0]; ¡ G ¡= ¡[ ¡ ¡5 ¡ ¡0 ¡ ¡7 ¡ ¡0 ¡ ¡ ¡0 ¡ ¡ ¡ ¡ ¡9 ¡ ¡ ¡ ¡0 ¡ ¡ ¡0]; ¡ E ¡= ¡ ¡[ ¡ ¡0 ¡ ¡0 ¡ ¡0 ¡ ¡0 ¡ ¡ ¡0 ¡ ¡10 ¡ ¡10 ¡ ¡ ¡0]; ¡ Treat ¡the ¡vectors ¡as ¡binary ¡= ¡number ¡of ¡words ¡in ¡

  • common. ¡ ¡

Sb(A,G) ¡= ¡? ¡ Sb(A,E) ¡= ¡? ¡ Sb(G,E) ¡= ¡? ¡ Which ¡pair ¡of ¡documents ¡are ¡the ¡most ¡similar? ¡

slide-89
SLIDE 89

Similarity ¡between ¡documents ¡

A ¡= ¡[10 ¡5 ¡3 ¡0 ¡0 ¡0 ¡0 ¡0]; ¡ G ¡= ¡[5 ¡0 ¡7 ¡0 ¡0 ¡9 ¡0 ¡0]; ¡ E ¡= ¡[0 ¡0 ¡0 ¡0 ¡0 ¡10 ¡10 ¡0]; ¡ Sum ¡of ¡Squared ¡Distances ¡(SSD) ¡= ¡ ¡ SSD(A,G) ¡= ¡? ¡ SSD(A,E) ¡= ¡? ¡ SSD(G,E) ¡= ¡? ¡

(Xi

i=1 n

−Yi)2

slide-90
SLIDE 90

Similarity ¡between ¡documents ¡

A ¡= ¡[10 ¡5 ¡3 ¡0 ¡0 ¡0 ¡0 ¡0]; ¡ G ¡= ¡[5 ¡0 ¡7 ¡0 ¡0 ¡9 ¡0 ¡0]; ¡ E ¡= ¡[0 ¡0 ¡0 ¡0 ¡0 ¡10 ¡10 ¡0]; ¡ Angle ¡between ¡vectors: ¡Cos(θ) ¡= ¡ ¡

a⋅ b a b

Dot ¡Product: ¡ Length ¡(Euclidean ¡norm): ¡ a =

a2

1 + a2 2 + ...+ a2 n

slide-91
SLIDE 91

Some ¡words ¡give ¡more ¡informaJon ¡than ¡

  • thers ¡
  • Does ¡the ¡fact ¡that ¡two ¡documents ¡both ¡

contain ¡the ¡word ¡“the” ¡tell ¡us ¡anything? ¡How ¡ about ¡“and”? ¡Stop ¡words ¡(noise ¡words): ¡ Words ¡that ¡are ¡probably ¡not ¡useful ¡for ¡

  • processing. ¡Filtered ¡out ¡before ¡natural ¡

language ¡is ¡applied. ¡

  • Other ¡words ¡can ¡be ¡more ¡or ¡less ¡informaJve. ¡ ¡

No ¡definiJve ¡list ¡but ¡might ¡include ¡things ¡like: ¡ ¡ hgp://www.dcs.gla.ac.uk/idom/ir_resources/linguisJc_uJls/stop_words ¡

slide-92
SLIDE 92

Vector ¡Space ¡Model ¡

  • Documents ¡are ¡represented ¡as ¡vectors ¡in ¡term ¡space ¡
  • Terms ¡are ¡usually ¡stems ¡
  • Documents ¡represented ¡by ¡vectors ¡of ¡terms ¡
  • A ¡vector ¡distance ¡measure ¡between ¡documents ¡is ¡used ¡to ¡

measure ¡document ¡similarity ¡

  • Terms ¡in ¡a ¡vector ¡can ¡be ¡“weighted” ¡in ¡many ¡ways ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-93
SLIDE 93

Assigning ¡Weights ¡to ¡Terms ¡

 Binary ¡Weights ¡  Raw ¡term ¡frequency ¡ ¡  J ¡x ¡idf ¡

  • Want ¡to ¡weight ¡terms ¡highly ¡if ¡they ¡are ¡

— frequent ¡in ¡relevant ¡documents ¡… ¡BUT ¡ — infrequent ¡in ¡the ¡collecJon ¡as ¡a ¡whole ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-94
SLIDE 94

TF ¡x ¡IDF ¡Weights ¡

  • J ¡x ¡idf ¡measure: ¡
  • Term ¡Frequency ¡(X) ¡– ¡how ¡oven ¡a ¡term ¡appears ¡in ¡a ¡document ¡
  • Inverse ¡Document ¡Frequency ¡(idf) ¡-­‑-­‑ ¡a ¡way ¡to ¡deal ¡with ¡terms ¡that ¡

are ¡frequent ¡across ¡many ¡documents ¡

  • Goal: ¡Assign ¡a ¡J ¡* ¡idf ¡weight ¡to ¡each ¡term ¡in ¡each ¡

document ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-95
SLIDE 95

TF ¡x ¡IDF ¡CalculaJon ¡

Tk = term k in document Di tfik = frequency of term Tk in document Di idfk = inverse document frequency of term T

k in C

N = total number of documents in the collection C nk = the number of documents in C that contain Tk idfk = log N

k

n

( )

Slide ¡from ¡Mitch ¡Marcus ¡

slide-96
SLIDE 96

TF ¡x ¡IDF ¡CalculaJon ¡

Tk = term k in document Di tfik = frequency of term Tk in document Di idfk = inverse document frequency of term T

k in C

N = total number of documents in the collection C nk = the number of documents in C that contain Tk idfk = log N

k

n

( )

Slide ¡from ¡Mitch ¡Marcus ¡

slide-97
SLIDE 97

TF ¡x ¡IDF ¡CalculaJon ¡

Tk = term k in document Di tfik = frequency of term Tk in document Di idfk = inverse document frequency of term T

k in C

N = total number of documents in the collection C nk = the number of documents in C that contain Tk idfk = log N

k

n

( )

Slide ¡from ¡Mitch ¡Marcus ¡

slide-98
SLIDE 98

Inverse ¡Document ¡Frequency ¡

  • IDF ¡provides ¡high ¡values ¡for ¡rare ¡words ¡and ¡low ¡values ¡

for ¡common ¡words ¡

For ¡a ¡collecJon ¡

  • f ¡10000 ¡

documents ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-99
SLIDE 99

TF ¡x ¡IDF ¡NormalizaJon ¡

  • Normalize ¡the ¡term ¡weights ¡(so ¡longer ¡documents ¡are ¡

not ¡unfairly ¡given ¡more ¡weight) ¡

  • The ¡longer ¡the ¡document, ¡the ¡more ¡likely ¡it ¡is ¡for ¡a ¡given ¡term ¡to ¡

appear ¡in ¡it, ¡and ¡the ¡more ¡oven ¡a ¡given ¡term ¡is ¡likely ¡to ¡appear ¡in ¡

  • it. ¡So, ¡we ¡want ¡to ¡reduce ¡the ¡importance ¡agached ¡to ¡a ¡term ¡

appearing ¡in ¡a ¡document ¡based ¡on ¡the ¡length ¡of ¡the ¡document. ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-100
SLIDE 100

Pair-­‑wise ¡Document ¡Similarity ¡

D

1 = w11,w12,...,w1n

D2 = w21,w22,...,w2n sim(D

1,D2) =

w1i ∗ w2i

i=1 n

(w1i)2 ∗

i=1 n

(w2i)2

i=1 n

Documents ¡now ¡represented ¡as ¡vectors ¡of ¡TFxIDF ¡weights ¡

Similarity ¡can ¡be ¡ computed ¡as ¡usual ¡

  • n ¡these ¡new ¡

weight ¡vectors ¡ (e.g. ¡cos(θ) ¡here) ¡

Slide ¡from ¡Mitch ¡Marcus ¡

nova galaxy heat h’wood film role diet fur 1 3 1 5 2 2 1 5 4 1

¡ ¡ ¡ ¡ ¡ ¡ ¡ ¡

A B C D

slide-101
SLIDE 101

Pair-­‑wise ¡Document ¡Similarity ¡

D

1 = w11,w12,...,w1n

D2 = w21,w22,...,w2n sim(D

1,D2) =

w1i ∗ w2i

i=1 n

(w1i)2 ∗

i=1 n

(w2i)2

i=1 n

Documents ¡now ¡represented ¡as ¡vectors ¡of ¡TFxIDF ¡weights ¡

Similarity ¡can ¡be ¡ computed ¡as ¡usual ¡

  • n ¡these ¡new ¡

weight ¡vectors ¡ (e.g. ¡cos(θ) ¡here) ¡

Slide ¡from ¡Mitch ¡Marcus ¡

slide-102
SLIDE 102

Issues ¡

  • Problems ¡that ¡arise ¡using ¡the ¡vector ¡space ¡

model: ¡

  • synonymy: ¡many ¡ways ¡to ¡refer ¡to ¡the ¡same ¡
  • bject, ¡e.g. ¡car ¡and ¡automobile ¡
  • polysemy: ¡most ¡words ¡have ¡more ¡than ¡one ¡

disJnct ¡meaning, ¡e.g. ¡bank, ¡python, ¡chip ¡

  • Can ¡we ¡infer ¡relaJonships ¡between ¡words ¡for ¡

beger ¡document ¡similarity? ¡

Slide ¡from ¡Melanie ¡MarJn ¡

slide-103
SLIDE 103

The ¡Problem ¡

  • Example: ¡Vector ¡Space ¡Model ¡

– ¡(from ¡Lillian ¡Lee) ¡

auto engine bonnet tyres lorry boot car emissions hood make model trunk make hidden Markov model emissions normalize Synonymy Will have small cosine but are related Polysemy Will have large cosine but not truly related

Slide ¡from ¡Melanie ¡MarJn ¡

slide-104
SLIDE 104

LSA ¡

  • Latent ¡SemanJc ¡Indexing ¡was ¡proposed ¡to ¡address ¡

these ¡two ¡problems ¡with ¡the ¡vector ¡space ¡model ¡

  • Idea ¡(Deerwester ¡et ¡al): ¡

“We ¡would ¡like ¡a ¡representaJon ¡in ¡which ¡a ¡set ¡of ¡terms, ¡ which ¡by ¡itself ¡is ¡incomplete ¡and ¡unreliable ¡evidence ¡

  • f ¡the ¡relevance ¡of ¡a ¡given ¡document, ¡is ¡replaced ¡by ¡

some ¡other ¡set ¡of ¡enJJes ¡which ¡are ¡more ¡reliable ¡

  • indicants. ¡We ¡take ¡advantage ¡of ¡the ¡implicit ¡higher-­‑
  • rder ¡(or ¡latent) ¡structure ¡in ¡the ¡associaJon ¡of ¡terms ¡

and ¡documents ¡to ¡reveal ¡such ¡relaJonships.” ¡

Slide ¡from ¡Melanie ¡MarJn ¡

slide-105
SLIDE 105

LSA ¡

  • ImplementaJon: ¡four ¡basic ¡steps ¡

– Construct ¡term ¡by ¡document ¡matrix ¡ – Convert ¡matrix ¡entries ¡to ¡weights ¡ – Rank-­‑reduced ¡Singular ¡Value ¡DecomposiJon ¡(SVD) ¡ performed ¡on ¡matrix ¡

  • all ¡but ¡the ¡k ¡highest ¡singular ¡values ¡are ¡set ¡to ¡0 ¡
  • produces ¡k-­‑dimensional ¡approximaJon ¡of ¡the ¡original ¡matrix ¡(in ¡

least-­‑squares ¡sense) ¡

  • this ¡is ¡the ¡“semanJc ¡space” ¡

– Compute ¡similariJes ¡between ¡enJJes ¡in ¡semanJc ¡space ¡ (usually ¡with ¡cosine) ¡

Slide ¡from ¡Melanie ¡MarJn ¡

slide-106
SLIDE 106

LSA ¡

  • SVD ¡

– unique ¡mathemaJcal ¡decomposiJon ¡of ¡a ¡ matrix ¡into ¡the ¡product ¡of ¡three ¡matrices: ¡

  • two ¡with ¡orthonormal ¡columns ¡
  • one ¡with ¡singular ¡values ¡on ¡the ¡diagonal ¡

– tool ¡for ¡dimension ¡reducJon ¡ – similarity ¡measure ¡based ¡on ¡co-­‑occurrence ¡ – finds ¡opJmal ¡projecJon ¡into ¡low-­‑dimensional ¡ space ¡

Slide ¡from ¡Melanie ¡MarJn ¡

slide-107
SLIDE 107

Singular ¡Value ¡DecomposiJon ¡

u1 u2 : : uM v1

T v2 T ….. vN T

W VT S U

Slide ¡from ¡Dharmendra ¡P. ¡Kanejiya ¡

0 ¡

slide-108
SLIDE 108

New ¡Documents ¡

  • ProjecJng ¡a ¡new ¡document ¡in ¡LS ¡space ¡
  • Calculate ¡the ¡frequency ¡count ¡[di] ¡of ¡words ¡

in ¡the ¡document. ¡ ¡ ¡ ¡d ¡= ¡U ¡S ¡vT ¡ ¡ ¡⇒ ¡UTd ¡= ¡SvT ¡ ¡ ¡ ¡ ¡

Slide ¡from ¡Dharmendra ¡P. ¡Kanejiya ¡

slide-109
SLIDE 109

SemanJc ¡Similarity ¡Measure ¡

  • To ¡find ¡similarity ¡between ¡two ¡documents, ¡

project ¡them ¡in ¡LS ¡space ¡

  • Then ¡calculate ¡the ¡cosine ¡measure ¡between ¡

their ¡projecJon ¡

  • With ¡this ¡measure, ¡various ¡problems ¡can ¡be ¡

addressed ¡e.g., ¡natural ¡language ¡ understanding, ¡cogniJve ¡modeling ¡etc ¡

Slide ¡from ¡Dharmendra ¡P. ¡Kanejiya ¡

slide-110
SLIDE 110

Other ¡measures ¡of ¡word ¡relatedness ¡

  • WordNet ¡Distance ¡– ¡measure ¡the ¡length ¡of ¡

the ¡shortest ¡path ¡between ¡words ¡in ¡WordNet ¡

  • Normalized ¡Google ¡Distance ¡ ¡

¡where ¡M ¡is ¡the ¡total ¡number ¡of ¡web ¡pages ¡ searched ¡by ¡Google; ¡f(x) ¡and ¡f(y) ¡are ¡the ¡ number ¡of ¡hits ¡for ¡search ¡terms ¡x ¡and ¡y, ¡ respecJvely; ¡and ¡f(x, ¡y) ¡is ¡the ¡number ¡of ¡web ¡ pages ¡on ¡which ¡both ¡x ¡and ¡y ¡occur. ¡