現(xiàn)代信息檢索導(dǎo)論英文課件:04-IndexConstruction_第1頁
現(xiàn)代信息檢索導(dǎo)論英文課件:04-IndexConstruction_第2頁
現(xiàn)代信息檢索導(dǎo)論英文課件:04-IndexConstruction_第3頁
現(xiàn)代信息檢索導(dǎo)論英文課件:04-IndexConstruction_第4頁
現(xiàn)代信息檢索導(dǎo)論英文課件:04-IndexConstruction_第5頁
已閱讀5頁,還剩42頁未讀 繼續(xù)免費閱讀

下載本文檔

版權(quán)說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請進行舉報或認(rèn)領(lǐng)

文檔簡介

1、An Introduction to IR4th CourseChapter 4:Index constructionHardware basicsTerm/TermID sort based indexing & mergingIn-memory inversion & mergingDistributed indexing using MapReduceOnline/dynamic indexing (using multiple subindexes)PlanLast lectures:Dictionary data structuresTolerant retrievalWildcar

2、dsSpell correctionSoundexThis time:How to construct indexesa-huhy-mn-zmoonamong$mmaceabandonamortizemaddenamongIndex constructionHow do we construct an index?What strategies can we use with limited main memory?Hardware basicsMany design decisions in information retrieval are based on the characteris

3、tics of hardwareWe begin by reviewing hardware basicsHardware basicsAccess to data in memory is much faster than access to data on disk.Disk seeks: No data is transferred from disk while the disk head is being positioned.Therefore: Transferring one large chunk of data from disk to memory is faster t

4、han transferring many small chunks.Disk I/O is block-based: Reading and writing of entire blocks (as opposed to smaller chunks).Block sizes: 8KB to 256 KB.Hardware basicsServers used in IR systems now typically have several GB of main memory, sometimes tens of GB. Available disk space is several (23

5、)orders of magnitude larger.Fault tolerance is very expensive: Its much cheaper to use many regular machines rather than one fault tolerant machine.Hardware assumptionssymbol statistic valuesaverage seek time 5 ms = 5 x 103 sb transfer time per byte 0.02 s = 2 x 108 s processors clock rate109 s1plow

6、level operation 0.01 s = 108 s (e.g., compare & swap a word) size of main memory several GB size of disk space 1 TB or moreRCV1: Our corpus for this lectureShakespeares collected works definitely arent large enough for demonstrating many of the points in this course.The corpus well use isnt really l

7、arge enough either, but its publicly available and is at least a more plausible example.As an example for applying scalable index construction algorithms, we will use the Reuters RCV1 collection.This is one year of Reuters newswire (part of 1995 and 1996)A Reuters RCV1 documentReuters RCV1 statistic

8、ssymbolstatistic valueN documents 800,000L avg. # tokens per doc 200Mterms (= word types) 400,000 avg. # bytes per token 6 (incl. spaces/punct.) avg. # bytes per token4.5 (without spaces/punct.) avg. # bytes per term7.5 non-positional postings100,000,0004.5 bytes per word token vs. 7.5 bytes per wor

9、d type: why?Documents are parsed to extract words and these are saved with the Document ID.I did enact JuliusCaesar I was killed i the Capitol; Brutus killed me.Doc 1So let it be withCaesar. The nobleBrutus hath told youCaesar was ambitiousDoc 2Recall IIR1 index construction Key stepAfter all docume

10、nts have been parsed, the inverted file is sorted by terms. We focus on this sort step.We have 100M items to sort.Scaling index constructionIn-memory index construction does not scale.How can we construct an index for very large collections?Taking into account the hardware constraints we just learne

11、d about . . .Memory, disk, speed etc.Sort-based Index constructionAs we build the index, we parse docs one at a time.While building the index, we cannot easily exploit compression tricks (you can, but much more complex)The final postings for any term are incomplete until the end.At 12 bytes per post

12、ings entry, demands a lot of space for large collections.T = 100,000,000 in the case of RCV1So we can do this in memory in 2008, but typical collections are much larger. E.g. New York Times provides index of 150 years of newswireThus: We need to store intermediate results on disk.Use the same algori

13、thm for disk?Can we use the same index construction algorithm for larger collections, but by using disk instead of memory?No: Sorting T = 100,000,000 records on disk is too slow too many disk seeks.We need an external sorting algorithm.BottleneckParse and build postings entries one doc at a timeNow

14、sort postings entries by term (then by doc within each term)Doing this with random disk seeks would be too slow must sort T=100M recordsIf every comparison took 2 disk seeks, and N items could besorted with N log2N comparisons, how long would this take?BSBI: Blocked sort-based Indexing (Sorting with

15、 fewer disk seeks)12-byte (4+4+4) records (term, doc, freq).These are generated as we parse docs.Must now sort 100M such 12-byte records by term.Define a Block 10M such recordsCan easily fit a couple into memory.Will have 10 such blocks to start with.Basic idea of algorithm:Accumulate postings for e

16、ach block, sort, write to disk.Then merge the blocks into one long sorted order.Sorting 10 blocks of 10M recordsFirst, read each block and sort within: Quicksort takes 2N ln N expected stepsIn our case 2 x (10M ln 10M) stepsExercise: estimate total time to read each block from disk and and quicksort

17、 it.10 times this estimate - gives us 10 sorted runs of 10M records each.Done straightforwardly, need 2 copies of data on diskBut can optimize thisHow to merge the sorted runs?Can do binary merges, with a merge tree of log210 = 4 layers.During each layer, read into memory runs in blocks of 10M, merg

18、e, write back.Disk13422143Runs beingmerged.Merged run.How to merge the sorted runs?But it is more efficient to do a n-way merge, where you are reading from all blocks simultaneouslyProviding you read decent-sized chunks of each block into memory, youre not killed by disk seeksRemaining problem with

19、sort-based algorithmOur assumption was: we can keep the dictionary in memory.We need the dictionary (which grows dynamically) in order to implement a term to termID mapping.Actually, we could work with term/docID postings instead of termID/docID postings . . . . . but then intermediate files become

20、very large. (We would end up with a scalable, but very slow index construction method.)SPIMI: Single-pass in-memory indexingKey idea 1: Generate separate dictionaries for each block no need to maintain term-termID mapping across blocks.Key idea 2: Dont sort terms. Accumulate postings in postings lis

21、ts as they occur.With these two ideas we can generate a complete inverted index for each block.These separate indexes can then be merged into one big index.SPIMI-InvertMerging of blocks is analogous to BSBI.SPIMI: CompressionCompression makes SPIMI even more efficient.Compression of termsCompression

22、 of postingsSee next lectureDistributed indexingFor web-scale indexing (dont try this at home!):must use a distributed computing clusterIndividual machines are fault-proneCan unpredictably slow down or failHow do we exploit such a pool of machines?Google data centersGoogle data centers mainly contai

23、n commodity machines.Data centers are distributed around the world.Estimate: a total of 1 million servers, 3 million processors/cores (Gartner 2007)Estimate: Google installs 100,000 servers each quarter.Based on expenditures of 200250 million dollars per yearThis would be 10% of the computing capaci

24、ty of the world!?!Google data centersIf in a non-fault-tolerant system with 1000 nodes, each node has 99.9% uptime, what is the uptime of the system?Answer: 63%Calculate the number of servers failing per minute for an installation of 1 million servers.Distributed indexingMaintain a master machine di

25、recting the indexing job considered “safe”.Break up indexing into sets of (parallel) tasks.Master machine assigns each task to an idle machine from a pool.Parallel tasksWe will use two sets of parallel tasksParsersInvertersBreak the input document corpus into splitsEach split is a subset of document

26、s (corresponding to blocks in BSBI/SPIMI)ParsersMaster assigns a split to an idle parser machineParser reads a document at a time and emits (term, doc) pairsParser writes pairs into j partitionsEach partition is for a range of terms first letters(e.g., a-f, g-p, q-z) here j=3.Now to complete the ind

27、ex inversionInvertersAn inverter collects all (term,doc) pairs (= postings) for one term-partition.Sorts and writes to postings listsData flowsplitsParserParserParserMastera-fg-pq-za-fg-pq-za-fg-pq-zInverterInverterInverterPostingsa-fg-pq-zassignassignMapphaseSegment filesReducephaseMapReduceThe ind

28、ex construction algorithm we just described is an instance of MapReduce.MapReduce (Dean and Ghemawat 2004) is a robust and conceptually simple framework fordistributed computing without having to write code for the distribution part.They describe the Google indexing system (ca. 2002) as consisting o

29、f a number of phases, each implemented in MapReduce.MapReduceIndex construction was just one phase.Another phase: transforming a term-partitioned index into document-partitioned index.Term-partitioned: one machine handles a subrange of termsDocument-partitioned: one machine handles a subrange of doc

30、uments(As we discuss in the web part of the course) most search engines use a document-partitioned index better load balancing, etc.)Schema for index construction in MapReduceSchema of map and reduce functionsmap: input list(k, v) reduce: (k,list(v) outputInstantiation of the schema for index constr

31、uctionmap: web collection list(termID, docID)reduce: (, , ) (postings list1, postings list2, )Example for index constructionmap: d2 : C died. d1 : C came, C ced. (, , , , , reduce: (, , , ) (, , , )Dynamic indexingUp to now, we have assumed that collections are static.They rarely are: Documents come

32、 in over time and need to be inserted.Documents are deleted and modified.This means that the dictionary and postings lists have to be modified:Postings updates for terms already in dictionaryNew terms added to dictionarySimplest approachMaintain “big” main indexNew docs go into “small” auxiliary ind

33、exSearch across both, merge resultsDeletionsInvalidation bit-vector for deleted docsFilter docs output on a search result by this invalidation bit-vectorPeriodically, re-index into one main indexIssues with main and auxiliary indexesProblem of frequent merges you touch stuff a lotPoor performance du

34、ring mergeActually:Merging of the auxiliary index into the main index is efficient if we keep a separate file for each postings list.Merge is the same as a simple append.But then we would need a lot of files inefficient for O/S.Assumption for the rest of the lecture: The index is one big file.In rea

35、lity: Use a scheme somewhere in between (e.g., split very large postings lists, collect postings lists of length 1 in one file etc.)Logarithmic mergeMaintain a series of indexes, each twice as large as the previous one.Keep smallest (Z0) in memory, Larger ones (I0, I1, ) on diskIf Z0 gets too big (

36、n), write to disk as I0, Or merge with I0 (if I0 already exists) as Z1, and then delete I0Either write merge Z1 to disk as I1 (if no I1),Or merge with I1 to form Z2, and then delete I1etc.Logarithmic mergeLogarithmic mergeAuxiliary and main index: index construction time is O(T2) as each posting is

37、touched in each merge.Logarithmic merge: Each posting is merged O(log T) times, so complexity is O(T log T)So logarithmic merge is much more efficient for index constructionBut query processing now requires the merging of O(log T) indexesWhereas it is O(1) if you just have a main and auxiliary index

38、Further issues with multiple indexesCorpus-wide statistics are hard to maintainE.g., when we spoke of spell-correction: which of several corrected alternatives do we present to the user?We said, pick the one with the most hitsHow do we maintain the top ones with multiple indexes and invalidation bit vectors?One possibility: ignore everything but the main index for such orderingWill see more such statistics used in results rankingDynamic indexing at searc

溫馨提示

  • 1. 本站所有資源如無特殊說明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁內(nèi)容里面會有圖紙預(yù)覽,若沒有圖紙預(yù)覽就沒有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫網(wǎng)僅提供信息存儲空間,僅對用戶上傳內(nèi)容的表現(xiàn)方式做保護處理,對用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時也不承擔(dān)用戶因使用這些下載資源對自己和他人造成任何形式的傷害或損失。

評論

0/150

提交評論