2011-12-07

Practice Final Answers .

'''Originally Posted By: sctice'''

Problem 3<br><br>Question: Explain why it is reasonable to guess that Δ-values for posting lists follow a geometric distribution.<br><br>The geometric distribution is defined by Pr[X = k] = (1 - p)^{k - 1} * p.<br><br>Assume that the probability of finding term t in a random document is N_t / N, where N_t is the number of documents that contain t, and N is the total number of documents. Also, assume that documents are independent of each other.<br><br>The probability a Δ-value is equal to k is the probability of finding a term t in a document given that the previous k-1 documents did not contain t. This probability is<br><br>Pr[Δ = k] = (1 - (N_t / N))^{k-1} * (N_t / N)<br><br>which is just the geometric distribution with p = (N_t / N).

'''Originally Posted By: sctice''' Problem 3<br><br>Question: Explain why it is reasonable to guess that &Delta;-values for posting lists follow a geometric distribution.<br><br>The geometric distribution is defined by Pr[X = k] = (1 - p)^{k - 1} * p.<br><br>Assume that the probability of finding term t in a random document is N_t / N, where N_t is the number of documents that contain t, and N is the total number of documents. Also, assume that documents are independent of each other.<br><br>The probability a &Delta;-value is equal to k is the probability of finding a term t in a document given that the previous k-1 documents did not contain t. This probability is<br><br>Pr[&Delta; = k] = (1 - (N_t / N))^{k-1} * (N_t / N)<br><br>which is just the geometric distribution with p = (N_t / N).

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: dhruvjalota&#039;&#039;&#039;

Question 9: Explain one method to estimate P1 and one method to estimate P2 in the divergence-from-randomness approach to coming up with a relevance measure.&lt;br&gt;&lt;br&gt;Answer:&lt;br&gt;The basic starting formula for DFR is the following: (1-P2).(-logP1)&lt;br&gt;P1 represents the probability that a random document d contains exactly f_t,d occurrences of t.&lt;br&gt;The second factor, P2 is related to eliteness and compensates for this rapid change. A document is said to be elite for the term t when it is &amp;quot;about&amp;quot; the topic associated with the term.&lt;br&gt;To determine the relevance of a document to a query with this model we calculate: Sumt_belongs_q(1-P_2,t).(-logP_1,t) where P_1,t and P_2,t are the P1 and P2 associated with the particular term t.&lt;br&gt;To estimate each, we use Binomial co-efficient: [N+lt_lt-1] = [N+ lt - 1]!/[N-1]!(lt)! ()&lt;br&gt;&lt;br&gt;To compute P1 suppose d is found to contain f_t,d occurrences of t.&lt;br&gt;Using the binomial coefficient, we get:&lt;br&gt;[(N-1)+ (lt - f_t,d) - 1)_lt-f_t,d] = [(N-1)+(lt-f_t,d)-1]!/(N-2)!(lt-f_t,d)! ()&lt;br&gt;We can estimate P1 as the ratio ()/()&lt;br&gt;&lt;br&gt;Thus, estimates for P1 and -logP1:&lt;br&gt;P1=(1/[1+(lt/N)])([lt/N]/[1+(lt/N)])_f_t,d&lt;br&gt;and &lt;br&gt;-logP1=log(1+[lt/N])+f_t,d.log(1+[N/lt])&lt;br&gt;&lt;br&gt;For P2, using law of succession:&lt;br&gt;estimate P2 = {(f_t,d)/[(f_t,d)+1]}&lt;br&gt;&lt;br&gt;Using this, estimate (1-P2).(-logP1) = &lt;br&gt;{log(1+[lt/N])/(f_t,d+1)}+(f_t,d)log(1+[N/lt])

'''Originally Posted By: dhruvjalota''' Question 9: Explain one method to estimate P1 and one method to estimate P2 in the divergence-from-randomness approach to coming up with a relevance measure.<br><br>Answer:<br>The basic starting formula for DFR is the following: (1-P2).(-logP1)<br>P1 represents the probability that a random document d contains exactly f_t,d occurrences of t.<br>The second factor, P2 is related to eliteness and compensates for this rapid change. A document is said to be elite for the term t when it is &quot;about&quot; the topic associated with the term.<br>To determine the relevance of a document to a query with this model we calculate: Sum[t_belongs_q](q_t)(1-P_2,t).(-logP_1,t) where P_1,t and P_2,t are the P1 and P2 associated with the particular term t.<br>To estimate each, we use Binomial co-efficient: [N+lt_lt-1] = [N+ lt - 1]!/[N-1]!(lt)! (*)<br><br>To compute P1 suppose d is found to contain f_t,d occurrences of t.<br>Using the binomial coefficient, we get:<br>[(N-1)+ (lt - f_t,d) - 1)_lt-f_t,d] = [(N-1)+(lt-f_t,d)-1]!/(N-2)!(lt-f_t,d)! (**)<br>We can estimate P1 as the ratio (**)/(*)<br><br>Thus, estimates for P1 and -logP1:<br>P1=(1/[1+(lt/N)])([lt/N]/[1+(lt/N)])_f_t,d<br>and <br>-logP1=log(1+[lt/N])+f_t,d.log(1+[N/lt])<br><br>For P2, using law of succession:<br>estimate P2 = {(f_t,d)/[(f_t,d)+1]}<br><br>Using this, estimate (1-P2).(-logP1) = <br>{log(1+[lt/N])/(f_t,d+1)}+(f_t,d)log(1+[N/lt])

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: sheetalg&#039;&#039;&#039;

&lt;br&gt;Problem 5. What are some advantages and disadvantages of the IMMEDIATE MERGE versus NO MERGE index update strategies.&lt;br&gt;&lt;br&gt;IMMEDIATE MERGE:&lt;br&gt;Advantages: &lt;br&gt;1. Works well when the size of the posting list to be added is not much smaller than the entire posting list for that term.&lt;br&gt;2. Better query processing because of contiguous on-disk posting lists.&lt;br&gt;Disadvantages:&lt;br&gt;1. Impractical for large indices because total number of tokens to transfer to/from disk is quadratic in number of tokens in the collection.&lt;br&gt;2. Require the search engine to read the entire index from disk every time it runs out of memory.&lt;br&gt;&lt;br&gt;NO MERGE:&lt;br&gt;Advantages: &lt;br&gt;1. Practical for large indices&lt;br&gt;2. Since there is no merging, there is no need to read the entire index from disk.&lt;br&gt;Disadvantages:&lt;br&gt;1. Large number of disk seeks required to process a query&lt;br&gt;2. Query processing is slower and inefficient because of large number of disk seeks required.

'''Originally Posted By: sheetalg''' <br>Problem 5. What are some advantages and disadvantages of the IMMEDIATE MERGE versus NO MERGE index update strategies.<br><br>IMMEDIATE MERGE:<br>Advantages: <br>1. Works well when the size of the posting list to be added is not much smaller than the entire posting list for that term.<br>2. Better query processing because of contiguous on-disk posting lists.<br>Disadvantages:<br>1. Impractical for large indices because total number of tokens to transfer to/from disk is quadratic in number of tokens in the collection.<br>2. Require the search engine to read the entire index from disk every time it runs out of memory.<br><br>NO MERGE:<br>Advantages: <br>1. Practical for large indices<br>2. Since there is no merging, there is no need to read the entire index from disk.<br>Disadvantages:<br>1. Large number of disk seeks required to process a query<br>2. Query processing is slower and inefficient because of large number of disk seeks required.

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: sheetalg&#039;&#039;&#039;

&lt;br&gt;Problem 6. Describe how the Hybrid Index Maintenance system works.&lt;br&gt;&lt;br&gt;From Nov 23rd, slide 4&lt;br&gt;IMMEDIATE MERGE works well when the size of the new postings we are adding is not too much smaller than the entire posting list for the term.&lt;br&gt;INPLACE works better when the number of disk accesses is kept low.&lt;br&gt;The book describes a hybrid set-up where we have two indexes a merge index and a inplace index.&lt;br&gt;Initially, all new terms are placed into the merge index.&lt;br&gt;When a list size reaches a certain threshold (based on the disk seek time ~ 0.5MB for typical hard drives), it is switched from the merge to the inplace index.&lt;br&gt;Since most terms never reach this threshold, for the majority of terms we use IMMEDIATE MERGE and this is fast because the posting lists in question are all short.&lt;br&gt;Since there are only a few longer postings lists, we don&#039;t need to perform that many seeks and we achieve the performance benefits of INPLACE for these longer posting lists.

'''Originally Posted By: sheetalg''' <br>Problem 6. Describe how the Hybrid Index Maintenance system works.<br><br>From Nov 23rd, slide 4<br>IMMEDIATE MERGE works well when the size of the new postings we are adding is not too much smaller than the entire posting list for the term.<br>INPLACE works better when the number of disk accesses is kept low.<br>The book describes a hybrid set-up where we have two indexes a merge index and a inplace index.<br>Initially, all new terms are placed into the merge index.<br>When a list size reaches a certain threshold (based on the disk seek time ~ 0.5MB for typical hard drives), it is switched from the merge to the inplace index.<br>Since most terms never reach this threshold, for the majority of terms we use IMMEDIATE MERGE and this is fast because the posting lists in question are all short.<br>Since there are only a few longer postings lists, we don't need to perform that many seeks and we achieve the performance benefits of INPLACE for these longer posting lists.
2011-12-10

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: Amruta&#039;&#039;&#039;

Can others please post the remaining answers?

'''Originally Posted By: Amruta''' Can others please post the remaining answers?

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: jnewth&#039;&#039;&#039;

&lt;br&gt;Problem 4: Briefly describe the REBUILD and REMERGE batch index operations.&lt;br&gt;&lt;br&gt;&lt;br&gt;This discussion is on page 228-231 of the text and the notes of November 21st.&lt;br&gt;&lt;br&gt;The REBUILD and REMERGE strategies are BATCH update strategies where the index is periodically updated rather than continually updated. &lt;br&gt;&lt;br&gt;REBUILD is:&lt;br&gt;1. The index is built for the corpus.&lt;br&gt;2. Time passes and the corpus changes.&lt;br&gt;3. A new index is built for the updated corpus.&lt;br&gt;4. The new index replaces the old index.&lt;br&gt;&lt;br&gt;REMERGE is: &lt;br&gt;1. The index is built for the corpus.&lt;br&gt;2. Time passes and the corpus changes.&lt;br&gt;3. A partial index is built ONLY for the documents added to the corpus.&lt;br&gt;4. At some point the new index is merged in to the original index.&lt;br&gt;&lt;br&gt;If there are only additions, REMERGE is the clear winner. However, when there are deletions in the corpus, there is a tradeoff between the two strategies. The tradeoff is derived in the following manner:&lt;br&gt;&lt;br&gt;REBUILD:&lt;br&gt;&lt;br&gt;The documents in the new corpus are the old documents, minus and deletions, plus any additions:&lt;br&gt;&lt;br&gt;dnew = dold - ddelete + dinsert&lt;br&gt;&lt;br&gt;REBUILD_TIME = c1*(dold - ddelete + dinsert) //for some constant c&lt;br&gt;&lt;br&gt;REMERGE:&lt;br&gt;&lt;br&gt;The total time to compute is a function of the new documents added and the final merge operation. We estimate this merge takes roughly 25% of the time to build the full index.&lt;br&gt;&lt;br&gt;REMERGE_TIME = cdinsert + (c/4)(dold+dnew)&lt;br&gt;&lt;br&gt;We set the two equal and solve for ddelete.&lt;br&gt;&lt;br&gt;ddelete = (3/4)dold - 1/4dinsert&lt;br&gt;&lt;br&gt;Assuming that the number of insertions and deletions roughly equals (ie, very gradual change in size), then&lt;br&gt;&lt;br&gt;dinsert = ddelete&lt;br&gt;&lt;br&gt;and &lt;br&gt;ddelete + (1/4) ddelete = 3/4 dold or more simply &lt;br&gt;&lt;br&gt;ddelete = (3/5) dold&lt;br&gt;&lt;br&gt;The point where the two strategies take about the same time is when we are deleting 60% of the existing corpus. This doesn&#039;t happen very often so REMERGE is almost always the better strategy.

'''Originally Posted By: jnewth''' <br>Problem 4: Briefly describe the REBUILD and REMERGE batch index operations.<br><br><br>This discussion is on page 228-231 of the text and the notes of November 21st.<br><br>The REBUILD and REMERGE strategies are BATCH update strategies where the index is periodically updated rather than continually updated. <br><br>REBUILD is:<br>1. The index is built for the corpus.<br>2. Time passes and the corpus changes.<br>3. A new index is built for the updated corpus.<br>4. The new index replaces the old index.<br><br>REMERGE is: <br>1. The index is built for the corpus.<br>2. Time passes and the corpus changes.<br>3. A partial index is built ONLY for the documents added to the corpus.<br>4. At some point the new index is merged in to the original index.<br><br>If there are only additions, REMERGE is the clear winner. However, when there are deletions in the corpus, there is a tradeoff between the two strategies. The tradeoff is derived in the following manner:<br><br>REBUILD:<br><br>The documents in the new corpus are the old documents, minus and deletions, plus any additions:<br><br>dnew = dold - ddelete + dinsert<br><br>REBUILD_TIME = c1*(dold - ddelete + dinsert) //for some constant c<br><br>REMERGE:<br><br>The total time to compute is a function of the new documents added and the final merge operation. We estimate this merge takes roughly 25% of the time to build the full index.<br><br>REMERGE_TIME = c*dinsert + (c/4)*(dold+dnew)<br><br>We set the two equal and solve for ddelete.<br><br>ddelete = (3/4)*dold - 1/4*dinsert<br><br>Assuming that the number of insertions and deletions roughly equals (ie, very gradual change in size), then<br><br>dinsert = ddelete<br><br>and <br>ddelete + (1/4) ddelete = 3/4 dold or more simply <br><br>ddelete = (3/5) dold<br><br>The point where the two strategies take about the same time is when we are deleting 60% of the existing corpus. This doesn't happen very often so REMERGE is almost always the better strategy.

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: Rohit Kulkarni&#039;&#039;&#039;

For each of the following give the distribution for which it is an optimal code: (a) unary code, gamma code, delta code.&lt;br&gt;&lt;br&gt;Answers: &lt;br&gt;&lt;br&gt;a) Optimal distribution for unary code: 2^-k&lt;br&gt;&lt;br&gt;b) Optimal distribution for gamma code: 1/(2kk)&lt;br&gt;&lt;br&gt;c) Optimal distribution for delta code: 1/ (2k*((log k)^2))

'''Originally Posted By: Rohit Kulkarni''' For each of the following give the distribution for which it is an optimal code: (a) unary code, gamma code, delta code.<br><br>Answers: <br><br>a) Optimal distribution for unary code: 2^-k<br><br>b) Optimal distribution for gamma code: 1/(2*k*k)<br><br>c) Optimal distribution for delta code: 1/ (2k*((log k)^2))
2011-12-11

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: sayali&#039;&#039;&#039;

Problem 8. Give the equations for the LMJM and LMD relevance measures. Do one example calculation with each.&lt;br&gt;&lt;br&gt;Ans:&lt;br&gt;i. Equation for LMJM and LMD&lt;br&gt;Link - http://www.cs.sjsu.edu/faculty/pollett/ ... ml#%289%29&lt;br&gt;where,&lt;br&gt;qt = frequency of term &#039;t&#039; in query q, (q = )&lt;br&gt;lambda = 0.5&lt;br&gt;ft,d = frequency of term t in document d&lt;br&gt;ld = length of document d .. (description for each symbol to be mentioned)&lt;br&gt;&lt;br&gt;&lt;br&gt;ii. Example calculation &lt;br&gt; For LMJM, refer page 295 in the book&lt;br&gt; For LMD, reduced form of equation (equation 9.33 on page 295) is used for calculation.&lt;br&gt; For LMD calculation, refer page 296 in the book.

'''Originally Posted By: sayali''' Problem 8. Give the equations for the LMJM and LMD relevance measures. Do one example calculation with each.<br><br>Ans:<br>i. Equation for LMJM and LMD<br>Link - http://www.cs.sjsu.edu/faculty/pollett/ ... ml#%289%29<br>where,<br>qt = frequency of term 't' in query q, (q = )<br>lambda = 0.5<br>ft,d = frequency of term t in document d<br>ld = length of document d .. (description for each symbol to be mentioned)<br><br><br>ii. Example calculation <br> For LMJM, refer page 295 in the book<br> For LMD, reduced form of equation (equation 9.33 on page 295) is used for calculation.<br> For LMD calculation, refer page 296 in the book.

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: sandybb&#039;&#039;&#039;

Q7. Briefly explain the BM25F relevance measure. Briefly explain how pseudo-relevance feedback works.&lt;br&gt;Ans-&lt;br&gt;In the BM25F relevance measure, a document is split into different components. BM25 scores are computed for each component. The weighted sum of BM25 scores for the individual components is the BM25F score for the document.&lt;br&gt;For example, the document can be split into title and body. BM25 scores are calculated for each. The weights of 10 and 1 are assigned to title and the body. So, the final weighted sum will be the BM25F score for the document.&lt;br&gt;&lt;br&gt;Pseudo relevance feedback - &lt;br&gt;An initial query is performed to compute top m results. The retrieval system assumes the top m results to be relevant. Then using a scoring system the terms for which these results are the most relevant, are found.&lt;br&gt;These terms are added to the initial query and query results are computed based on this expanded query.

'''Originally Posted By: sandybb''' Q7. Briefly explain the BM25F relevance measure. Briefly explain how pseudo-relevance feedback works.<br>Ans-<br>In the BM25F relevance measure, a document is split into different components. BM25 scores are computed for each component. The weighted sum of BM25 scores for the individual components is the BM25F score for the document.<br>For example, the document can be split into title and body. BM25 scores are calculated for each. The weights of 10 and 1 are assigned to title and the body. So, the final weighted sum will be the BM25F score for the document.<br><br>Pseudo relevance feedback - <br>An initial query is performed to compute top m results. The retrieval system assumes the top m results to be relevant. Then using a scoring system the terms for which these results are the most relevant, are found.<br>These terms are added to the initial query and query results are computed based on this expanded query.
2011-12-13

-- Practice Final Answers

&#039;&#039;&#039;Originally Posted By: Rohit Kulkarni&#039;&#039;&#039;

Problem 10: Map Reduce algorithm for most common word&lt;br&gt;&lt;br&gt;Step1: map (k,v) =&lt;br&gt; split v into tokens&lt;br&gt; for each token t do&lt;br&gt; output(t, 1)&lt;br&gt; return&lt;br&gt;&lt;br&gt;Step2: reduce (k, = &lt;br&gt; count )&lt;br&gt; max_count max_count &lt;br&gt; max_count Rohit Kulkarni &amp;mdash; Tue Dec 13, 2011 10:04 am &lt;hr&gt;

'''Originally Posted By: Rohit Kulkarni''' Problem 10: Map Reduce algorithm for most common word<br><br>Step1: map (k,v) =<br> split v into tokens<br> for each token t do<br> output(t, 1)<br> return<br><br>Step2: reduce (k, = <br> count )<br> max_count max_count <br> max_count Rohit Kulkarni &mdash; Tue Dec 13, 2011 10:04 am <hr>
X