Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 2 c: Perform Rocchio query updates ( 2 0 pts ) Finally it's time to engage with the inquisitive User. Complete the method gather

Question 2c: Perform Rocchio query updates (20 pts)
Finally it's time to engage with the inquisitive User. Complete the method gather_feedback for inviting a user to your Rocchio relevance feedback loop. Your interaction with the user proceeds in four steps.
Step 1: You request the user to issue queries by invoking the user's issue_queries method. The user then returns to you a dict of queries represented by queries, and a number max_docs indicating the maximum number of documents the user wants to retrieve for each query.
Step 2: You retrieve the required number of documents based on queries as you did in the last question.
Step 3: You invite the user to give feedback to the documents retrieved, ret_docs, by invoking the user's give_feedback method with ret_docs passed along. Normally in a relevance feedback loop, the user would mark each document retrieved as either relevant or irrelevant; however, the user you are engaging with prefers giving feedback in the form of precisions at each rank.
Specifically, suppose your ret_docs is as follows:
{
'q167': ['d553','d1100','d1096','d1279','d1099'],
'q54' : ['d123','d554','d623','d398','d102'],
'q197': ['d768','d884','d883','d909','d882']
}
from which we can deduce that the user must have issued three queries and for each query at most five documents should be retrieved. If you pass your ret_docs to the user for feedback, you would get back:
{
'q167': [0.0,0.0,0.0,0.0,0.0],
'q54' : [0.0,0.0,0.0,0.0,0.0],
'q197': [0.0,0.5,0.3333333333333333,0.25,0.2]
}
where each number indicates the precision at that rank. For example, the second number 0.5 from q197 indicates that the precision at rank 2 is 0.5 for query q197. Similarly, the precision at rank 4 is 0.25 for query q197. For queries q167 and q54, the precisions at top 5 ranks are, unfortunately, zero. The precisions at each rank are returned back to you in the variable pre_at_n, along with another variable avg_ndcg which indicates your average NDCG for all queries.
Code for the first three steps has been provided to you. Your task is to complete the code for
Step 4: You perform a Rocchio update on all the queries the user issued to you based on the feedback you received. As a result, the query vectors in self.q_vecs should be updated accordingly. In other words, the "modified query vector" for each query under consideration should be stored in the corresponding entry in self.q_vecs.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Systems Design Implementation And Management

Authors: Peter Rob, Carlos Coronel

6th International Edition

061921323X, 978-0619213237

More Books

Students also viewed these Databases questions

Question

Add, expressing the result in rectangular form: (3 4) + (59 1).

Answered: 1 week ago

Question

What is meant by 'Wealth Maximization ' ?

Answered: 1 week ago