Answered step by step
Verified Expert Solution
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 c: Perform Rocchio query updates pts
Finally it's time to engage with the inquisitive User. Complete the method gatherfeedback for inviting a user to your Rocchio relevance feedback loop. Your interaction with the user proceeds in four steps.
Step : You request the user to issue queries by invoking the user's issuequeries method. The user then returns to you a dict of queries represented by queries, and a number maxdocs indicating the maximum number of documents the user wants to retrieve for each query.
Step : You retrieve the required number of documents based on queries as you did in the last question.
Step : You invite the user to give feedback to the documents retrieved, retdocs, by invoking the user's givefeedback method with retdocs 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 retdocs is as follows:
q: ddddd
q : ddddd
q: ddddd
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 retdocs to the user for feedback, you would get back:
q:
q :
q:
where each number indicates the precision at that rank. For example, the second number from q indicates that the precision at rank is for query q Similarly, the precision at rank is for query q For queries q and q the precisions at top ranks are, unfortunately, zero. The precisions at each rank are returned back to you in the variable preatn along with another variable avgndcg 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 : 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.qvecs 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.qvecs.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started