Information Retrieval IR 4. Plan This time: Index construction.

Slides:



Advertisements
Similar presentations
CS276 Lecture 5. Plan Last lecture: Tolerant retrieval Wildcards Spell correction Soundex This time: Index construction.
Advertisements

Lecture 4: Index Construction
Information Retrieval in Practice
Sorting Really Big Files Sorting Part 3. Using K Temporary Files Given  N records in file F  M records will fit into internal memory  Use K temp files,
Srihari-CSE535-Spring2008 CSE 535 Information Retrieval Lecture 2: Boolean Retrieval Model.
PrasadL07IndexCompression1 Index Compression Adapted from Lectures by Prabhakar Raghavan (Yahoo, Stanford) and Christopher Manning.
Indexing UCSB 290N. Mainly based on slides from the text books of Croft/Metzler/Strohman and Manning/Raghavan/Schutze All slides ©Addison Wesley, 2008.
Indexes. Primary Indexes Dense Indexes Pointer to every record of a sequential file, (ordered by search key). Can make sense because records may be much.
FALL 2004CENG 351 Data Management and File Structures1 External Sorting Reference: Chapter 8.
FALL 2006CENG 351 Data Management and File Structures1 External Sorting.
CS347 Lecture 3 April 16, 2001 ©Prabhakar Raghavan.
1 INF 2914 Information Retrieval and Web Search Lecture 6: Index Construction These slides are adapted from Stanford’s class CS276 / LING 286 Information.
Query Expansion and Index Construction Lecture 5.
Hinrich Schütze and Christina Lioma Lecture 4: Index Construction
Lecture 4 Index construction
INF 2914 Information Retrieval and Web Search
Indexing Debapriyo Majumdar Information Retrieval – Spring 2015 Indian Statistical Institute Kolkata.
External Sorting Problem: Sorting data sets too large to fit into main memory. –Assume data are stored on disk drive. To sort, portions of the data must.
Algorithms for Information Retrieval Is algorithmic design a 5-mins thinking task ???
Introduction to Information Retrieval (Manning, Raghavan, Schutze) Chapter 1 Boolean retrieval.
Index Construction David Kauchak cs458 Fall 2012 adapted from:
LIS618 lecture 2 the Boolean model Thomas Krichel
ADFOCS 2004 Prabhakar Raghavan Lecture 2. Corpus size for estimates Consider n = 1M documents, each with about 1K terms. Avg 6 bytes/term incl spaces/punctuation.
CS728 Web Indexes Lecture 15. Building an Index for the Web Wish to answer simple boolean queries – given query term, return address of web pages that.
©Silberschatz, Korth and Sudarshan13.1Database System Concepts Chapter 13: Query Processing Overview Measures of Query Cost Selection Operation Sorting.
Introduction to Information Retrieval Introduction to Information Retrieval CS276 Information Retrieval and Web Search Christopher Manning and Prabhakar.
An Introduction to IR Lecture 4 Index construction 1.
Index Construction 1 Lecture 5: Index Construction Web Search and Mining.
Modern Information Retrieval Lecture 3: Boolean Retrieval.
Index Construction (Modified from Stanford CS276 Class Lecture 4 Index construction)
CS276A Text Information Retrieval, Mining, and Exploitation Lecture 3 8 Oct 2002.
1 ITCS 6265 Lecture 4 Index construction. 2 Plan Last lecture: Dictionary data structures Tolerant retrieval Wildcards Spell correction Soundex This lecture:
Introduction to Information Retrieval Introduction to Information Retrieval CS276 Information Retrieval and Web Search Pandu Nayak and Prabhakar Raghavan.
Chapter 12 Query Processing (1) Yonsei University 2 nd Semester, 2013 Sanghyun Park.
PrasadL06IndexConstruction1 Index Construction Adapted from Lectures by Prabhakar Raghavan (Yahoo and Stanford) and Christopher Manning (Stanford)
Index construction 4장4장. Plan Tolerant retrieval Wildcards Spell correction Soundex This time: Index construction.
Sorting by the Numbers Sorting Part Four. Question Suppose you are given the task of writing an application to sort a big data file. What do you need.
Index Construction: sorting Paolo Ferragina Dipartimento di Informatica Università di Pisa Reading Chap 4.
1. L01: Corpuses, Terms and Search Basic terminology The need for unstructured text search Boolean Retrieval Model Algorithms for compressing data Algorithms.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 4: Index Construction Related to Chapter 4:
Evidence from Content INST 734 Module 2 Doug Oard.
Chapter 15 A External Methods. © 2004 Pearson Addison-Wesley. All rights reserved 15 A-2 A Look At External Storage External storage –Exists beyond the.
Introduction to Information Retrieval COMP4210: Information Retrieval and Search Engines Lecture 4: Index Construction United International College.
Introduction to Information Retrieval Introduction to Information Retrieval CS276: Information Retrieval and Web Search Christopher Manning and Prabhakar.
Lecture 4: Index Construction Related to Chapter 4:
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 4: Index Construction Related to Chapter 4:
Introduction to Information Retrieval Introduction to Information Retrieval Modified from Stanford CS276 slides Chap. 4: Index Construction.
Introduction to Information Retrieval CSE 538 MRS BOOK – CHAPTER IV Index Construction 1.
Introduction to Information Retrieval Introduction to Information Retrieval Introducing Information Retrieval and Web Search.
CS276 Lecture 4 Index construction. Plan Last lecture: Tolerant retrieval Wildcards Spell correction Soundex This time: Index construction.
Introduction to COMP9319: Web Data Compression and Search Search, index construction and compression Slides modified from Hinrich Schütze and Christina.
CS315 Introduction to Information Retrieval Boolean Search 1.
Introduction to Information Retrieval Introduction to Information Retrieval Lecture 7: Index Construction.
COMP9319: Web Data Compression and Search
Large Scale Search: Inverted Index, etc.
Chapter 4 Index construction
Indexing & querying text
Modified from Stanford CS276 slides Lecture 4: Index Construction
Lecture 7: Index Construction
Implementation Issues & IR Systems
CS276: Information Retrieval and Web Search
Lecture 7: Index Construction
Lecture 2- Query Processing (continued)
Discussion 5 Sara Javanmardi.
3-2. Index construction Most slides were adapted from Stanford CS 276 course and University of Munich IR course.
Lecture 4: Index Construction
Index construction 4장.
CENG 351 Data Management and File Structures
Presentation transcript:

Information Retrieval IR 4

Plan This time: Index construction

How do we construct an index? What strategies can we use with limited main memory?

Recall our corpus Number of docs = n = 1M Each doc has 1K terms Number of distinct terms = m = 500K Use Zipf to estimate number of postings entries

Zipf estimation of postings Recall the blocks in the matrix of Lecture 3 Each row corresponds to term Rows ordered by diminishing term frequency Each column corresponds to a document We broke up the matrix into blocks. We are asking: how many 1’s in this matrix?

Rows by decreasing frequency n docs m terms J most frequent terms. J next most frequent terms. J next most frequent terms. etc. n 1’s in each row. n/2 1’s per row. n/3 1’s per row. Overestimate or underestimate, by how much?

How many postings? Number of 1’s in the i th block = nJ/i Summing this over m/J blocks, we have For our numbers, this should be about 667 million postings.

Documents are parsed to extract words and these are saved with the Document ID. I did enact Julius Caesar I was killed i' the Capitol; Brutus killed me. Doc 1 So let it be with Caesar. The noble Brutus hath told you Caesar was ambitious Doc 2 Recall index construction

Key step After all documents have been parsed the inverted file is sorted by terms. We focus on this sort step. We have 667M items to sort.

Index construction As we build up the index, cannot exploit compression tricks Parse docs one at a time. Final postings for any term – incomplete until the end. (actually you can exploit compression, but this becomes a lot more complex) At bytes per postings entry, demands several temporary gigabytes

System parameters for design Disk seek ~ 10 milliseconds Block transfer from disk ~ 1 microsecond per byte (following a seek) All other ops ~ 10 microseconds E.g., compare two postings entries and decide their merge order

Bottleneck Parse and build postings entries one doc at a time Now sort postings entries by term (then by doc within each term) Doing this with random disk seeks would be too slow – must sort n=667M records If every comparison took 2 disk seeks, and n items could be sorted with nlog 2 n comparisons, how long would this take?

Sorting with fewer disk seeks 12-byte (4+4+4) records (term, doc, freq). These are generated as we parse docs. Must now sort 667M such 12-byte records by term. Define a Block ~ 10M such records can “easily” fit a couple into memory. Will have 64 such blocks to start with. Will sort within blocks first, then merge the blocks into one long sorted order.

Sorting 64 blocks of 10M records First, read each block and sort within: Quicksort takes 2n ln n expected steps In our case 2 x (10M ln 10M) steps Exercise: estimate total time to read each block from disk and quicksort it. Exercise: estimate total time to read each block from disk and quicksort it. 64 times this estimate - gives us 64 sorted runs of 10M records each. Need 2 copies of data on disk, throughout.

Merging 64 sorted runs Merge tree of log 2 64= 6 layers. During each layer, read into memory runs in blocks of 10M, merge, write back. Disk Runs being merged. Merged run.

Merge tree … … Sorted runs runs, 20M/run 16 runs, 40M/run 8 runs, 80M/run 4 runs … ? 2 runs … ? 1 run … ? Bottom level of tree.

Merging 64 runs Time estimate for disk transfer: 6 x (64runs x 120MB x sec) x 2 ~ 25hrs. Disk block transfer time. Why is this an Overestimate? Work out how these transfers are staged, and the total time for merging. # Layers in merge tree Read + Write

Exercise - fill in this table TimeStep 64 initial quicksorts of 10M records each Read 2 sorted blocks for merging, write back Merge 2 sorted blocks Add (2) + (3) = time to read/merge/write 64 times (4) = total merge time ?

Large memory indexing Suppose instead that we had 16GB of memory for the above indexing task. Exercise: What initial block sizes would we choose? What index time does this yield? Repeat with a couple of values of n, m. In practice, spidering often interlaced with indexing. Spidering bottlenecked by WAN speed and many other factors - more on this later.

Improvements on basic merge Compressed temporary files compress terms in temporary dictionary runs How do we merge compressed runs to generate a compressed run? Given two  -encoded runs, merge them into a new  -encoded run To do this, first  -decode a run into a sequence of gaps, then actual records: 33,14,107,5…  33, 47, 154, ,12,109,5…  13, 25, 134, 139

Merging compressed runs Now merge: 13, 25, 33, 47, 134, 139, 154, 159 Now generate new gap sequence 13,12,8,14,87,5,15,5 Finish by  -encoding the gap sequence But what was the point of all this? If we were to uncompress the entire run in memory, we save no memory How do we gain anything?

“Zipper” uncompress/decompress When merging two runs, bring their  -encoded versions into memory Do NOT uncompress the entire gap sequence at once – only a small segment at a time Merge the uncompressed segments Compress merged segments again Compressed inputs Compressed, merged output Uncompressed segments

Improving on binary merge tree Merge more than 2 runs at a time Merge k>2 runs at a time for a shallower tree maintain heap of candidates from each run …

Next up – scoring/ranking Thus far, documents either match a query or do not. It’s time to become more discriminating - how well does a document match a query? Gives rise to ranking and scoring

Resources MG Chapter 5