Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
Inverted Index
Lecture 12
1 December 2014 Inverted Index 1
Inverted Index Lecture 12 Inverted Index 1 December 2014 1 - - PowerPoint PPT Presentation
Wentworth Institute of Technology COMP570 Database Applications | Fall 2014 | Derbinsky Inverted Index Lecture 12 Inverted Index 1 December 2014 1 Wentworth Institute of Technology COMP570 Database Applications | Fall 2014 | Derbinsky
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 1
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Full-Text Search – Big-O Review – Indexing
– An Example – Design a relational index – Advanced Issues
1 December 2014 Inverted Index 2
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– General problem in the field of Information Retrieval
words
– Fast & scalable – Relevant results (precision, recall, f-score) – Expressive queries – Up-to-date
1 December 2014 Inverted Index 3
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 4
document ¡= ¡web ¡page/map ¡lis4ng ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 5
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 6
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 7
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Find 5 documents that contain “WIT”
1 December 2014 Inverted Index 8
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 9
– 60T pages * 250 w/page * 8 bytes/w ~ 106PB
– 7.5M * 2GHz 64-bit CPU (assume 1 cycle/w) – (7.5M * 68K) CPUs * 85W/CPU * $.15/kWh ~ $1.8M/s
~4M ¡Blu-‑ray ¡ ~70 ¡CPU/ person ¡ 3X ¡US ¡GDP ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Memory for data structure(s) – Time to update the data structure(s)
– Search engines – Graphics/game engines – Simulation software …
1 December 2014 Inverted Index 10
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 11
– D1 = “it is what it is” – D2 = “what is it” – D3 = “it is a banana”
– “a”: [ D3 ] – “banana”: [ D3 ] – “is”: [ D1, D2, D3 ] – “it”: [ D1, D2, D3 ] – “what”: [ D1, D2 ]
Dis:nct ¡Word ¡List ¡ (sorted) ¡ Let’s ¡try ¡some ¡queries: ¡ “what”, ¡“a”, ¡“banana”, ¡“apple” ¡ Time ¡& ¡Memory: ¡O(?) ¡ Construc)on ¡& ¡Query ¡ Describe ¡an ¡algorithm ¡to ¡ populate ¡these ¡lists ¡ Document ¡Lists ¡ Describe ¡an ¡algorithm ¡to ¡query ¡ this ¡data ¡structure ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Document d = [ w1, w2, … wn ]
– Does document D have word w? – The list of documents D that have word w?
1 December 2014 Inverted Index 12
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Multi-word – Locality: [“what is it”] vs. [ “what it is” ] vs. [“what”, “is”, “it”]
– Document-ranking algorithm (e.g. PageRank) – Efficient ranked retrieval
– Document addition/removal/modification – Rank
1 December 2014 Inverted Index 13
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 14
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 15
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 16
Example ¡cue: ¡ last(obama),spouse(X)
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 17
j −d
j=1 n
0 ¡ 0.5 ¡ 1 ¡ 1.5 ¡ 0 ¡ 10 ¡ 20 ¡ 30 ¡ 40 ¡ 50 ¡ 60 ¡ 70 ¡ 80 ¡ 90 ¡ 100 ¡ Base-‑Level ¡Ac:va:on ¡ Time ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 18
Semantic Objects: Features
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 19
Semantic Objects: Features Inverted Index
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 20
Semantic Objects: Features Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡ 1 ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 21
Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡ 2 ¡ 3 ¡ Cue: ¡ Query ¡Plan: ¡ Candidate: ¡ 1 ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 22
Semantic Objects: Features Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡
2 ¡ 1 ¡ 3 ¡
1 ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 23
Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡ 2 ¡ 3 ¡ Cue: ¡ Query ¡Plan: ¡ Candidate: ¡
2 ¡ 1 ¡
1 ¡ Each ¡query ¡scales ¡with ¡the ¡size ¡of ¡ the ¡candidate ¡list! ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 24
Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡ 2 ¡ 3 ¡ Cue: ¡ Query ¡Plan: ¡ Candidate: ¡
1 ¡ 1 ¡ 1 ¡ 2 ¡ 2 ¡ 2 ¡ 3 ¡ 3 ¡
1 ¡
3 ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
1 December 2014 Inverted Index 25
Inverted Index
3 ¡ 2 ¡ 1 ¡ 1 ¡ 1 ¡ 2 ¡ 3 ¡ Cue: ¡ Query ¡Plan: ¡ Candidate: ¡
1 ¡ 1 ¡ 1 ¡ 2 ¡ 2 ¡ 2 ¡ 3 ¡ 3 ¡
1 ¡
3 ¡
Each ¡rank ¡update ¡scales ¡with ¡ feature ¡cardinality! ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
– Candidate enumeration scales with # of objects with large cardinality (empirically rare)
– Bias updates must be locally efficient
1 December 2014 Inverted Index 26
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
Inverted index (via SQLite) + new approach was fast and scaled!
>30x faster than off-the-shelf database (on >3x data)!
1 December 2014 Inverted Index 27
0 ¡ 0.1 ¡ 0.2 ¡ 0.3 ¡ 0.4 ¡ 0.5 ¡ 1 ¡ 2 ¡ 3 ¡ 4 ¡ 5 ¡ 6 ¡ 7 ¡ 8 ¡ 9 ¡ 10 ¡ 11 ¡ Retreival ¡Time ¡(msec) ¡ Query ¡Size ¡ 3.6M ¡ 362K ¡ 40K ¡ 5K ¡
Wentworth Institute of Technology COMP570 – Database Applications | Fall 2014 | Derbinsky
using data structure(s) to improve access speed
(even in situations that might not look like it)
forward to implement
analysis and algorithm development can often beat generic approaches
– Even if you don’t use a DBMS, DBMS methods can be very useful in a variety of applications!
1 December 2014 Inverted Index 28