08.03.2014 Views

Machine Learning 3. Nearest Neighbor and Kernel Methods - ISMLL

Machine Learning 3. Nearest Neighbor and Kernel Methods - ISMLL

Machine Learning 3. Nearest Neighbor and Kernel Methods - ISMLL

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

<strong>Machine</strong> <strong>Learning</strong> / 1. Distance Measures<br />

Distances for Strings / Sequences<br />

edit distance / Levenshtein distance:<br />

d(x, y) := minimal number of deletions, insertions or substitions to transform x in y<br />

Examples:<br />

d(man, men) =1<br />

d(house, spouse) =2<br />

d(order, express order) =8<br />

Lars Schmidt-Thieme, Information Systems <strong>and</strong> <strong>Machine</strong> <strong>Learning</strong> Lab (<strong>ISMLL</strong>), Institute BW/WI & Institute for Computer Science, University of Hildesheim<br />

Course on <strong>Machine</strong> <strong>Learning</strong>, winter term 2007 11/48<br />

<strong>Machine</strong> <strong>Learning</strong> / 1. Distance Measures<br />

Distances for Strings / Sequences<br />

The edit distance is computed recursively. With<br />

x 1:i := (x i ′) i ′ =1,...,i = (x 1 , x 2 , . . . , x i ),<br />

i ∈ N<br />

we compute the number of operations to transform x 1:i into y 1:j as<br />

c(x 1:i , y 1:j ) := min{ c(x 1:i−1 , y 1:j ) + 1, // delete x i , x 1:i−1 y 1:j<br />

c(x 1:i , y 1:j−1 ) + 1,<br />

// x 1:i y 1:j−1 , insert y j<br />

c(x 1:i−1 , y 1:j−1 ) + I(x i ≠ y j )} // x 1:i−1 y 1:j−1 , substitute y j for x i<br />

starting from<br />

c(x 1:0 , y 1:j ) = c(∅, y 1:j ) := j // insert y 1 , . . . , y j<br />

c(x 1:i , y 1:0 ) = c(x 1:i , ∅) := i // delete x 1 , . . . , x i<br />

Such a recursive computing scheme is called dynamic<br />

programming.<br />

Lars Schmidt-Thieme, Information Systems <strong>and</strong> <strong>Machine</strong> <strong>Learning</strong> Lab (<strong>ISMLL</strong>), Institute BW/WI & Institute for Computer Science, University of Hildesheim<br />

Course on <strong>Machine</strong> <strong>Learning</strong>, winter term 2007 12/48

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!