0% found this document useful (0 votes)
11 views5 pages

Search Engine Competition Assignment

The Programming Assignment 2 involves a search engine competition where students must optimize their search engine using provided training and testing queries. Participants are encouraged to implement various retrieval methods, including pseudo feedback and query expansion, while experimenting with different ranking functions and parameters. The assignment must be submitted by September 10, 11:59 PM PDT, and requires compiling MeTA and running a grader script to evaluate performance before submission.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
11 views5 pages

Search Engine Competition Assignment

The Programming Assignment 2 involves a search engine competition where students must optimize their search engine using provided training and testing queries. Participants are encouraged to implement various retrieval methods, including pseudo feedback and query expansion, while experimenting with different ranking functions and parameters. The assignment must be submitted by September 10, 11:59 PM PDT, and requires compiling MeTA and running a grader script to evaluate performance before submission.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Honors Programming

Assignment: Programming Assignment 2


You have not submitted. You must earn 70/100 points to pass.
Deadline
Pass this assignment by Sep 10, 11:59 PM PDT
InstructionsMy submissionsDiscussions
Programming Assignment 2: Search Engine Competition
This assignment is a search engine competition where you will freely experiment with
different retrieval methods to improve your score. You will be asked to submit your final
performance to us, and if you are doing well enough, scores will be granted. Throughout the
competition, if you want to know more about a certain class or function, you can use the
search toolbar in MeTA's documentation, which provides a brief explanation of the different
modules. You might also find some of MeTA's tutorials useful when experimenting with the
analyzer and writing new functions. If you have questions about the programming
assignment, use the Programming Assignments Forum. This is a great place to ask questions
and also help your fellow classmates.

Downloading the Assignment


Before downloading this assignment, make sure you have installed MeTA and run the
[Link] script as detailed in Programming Assignment 1.

1. Download Assignment_2.[Link] and extract it into the parent directory of meta. If meta is in
~/Desktop/, then you should extract the assignment in ~/Desktop/

2. In the terminal, change the directory to Assignment_2 and run the bash script [Link].
This can be done using the following two commands:

1
2
cd Assignment_2/
./[Link]

which will move necessary data into correct locations.

3. Recompile MeTA:

1
cd Assignment_2//build/cmake .. -DCMAKE_BUILD_TYPE=Release; make -j8
Competition
The competition involves optimizing your own search engine to search the MOOC's dataset.
We have provided you with 100 training queries accompanied by relevance judgments to
quantify the effectiveness of your search engine. After optimizing your search engine based
on the training queries, it will be evaluated by the automated grader based on another set of
538 testing queries. If your search engine is robust enough, you should expect the MAP value
you get on the training queries to be close to the MAP on the testing queries. You can have a
look at the training and testing queries in meta/data/moocs/[Link], but do not
modify the file.

We have created a program for this competition called [Link] located in


meta/src/index/tools/. Open [Link], read the code within the main function along
with the comments, and try to understand what is being performed. You should focus on the
two while loops within main. The first loop passes over the 100 training queries and prints the
precision at 10 documents and the MAP. The second while loop passes over the 538 testing
queries and writes the IDs of the top 50 documents corresponding to each query to the
output file [Link], which is located in Assignment_2/build/Assignment2/.

You are free to try to implement any concept that you feel can lead to better retrieval in the
MOOC's dataset, even if it was not discussed in class. We provide some pointers below that
will help you in achieving higher retrieval performance. The main techniques are
programming-based and require writing new functions, but we also provide pointers to some
techniques that do not require programming. You are highly encouraged to experiment with
the programming-based techniques first.

Programming-Based
Implement pseudo feedback through Rocchio's method. One simple way to do this is to write
a new function in [Link] that implements Rocchio feedback. The function should
take a query and a set of positive feedback documents as arguments and return a modified
query. Call the Rocchio function for each query and its top 10 initially retrieved documents.
Then, call the scoring function again on the modified query that was output by Rocchio. This
can be done as follows:

Replace:

1
auto ranking = ranker->score(*idx, query, 50);
with:

1
2
3
4
auto ranking = ranker->score(*idx, query, 10);
auto new_query = Rocchio(query, ranking); // You should implement this function
ranking = ranker->score(*idx, new_query, 50);

You should perform pseudo feedback on both the training and testing queries, which means
that you should replace "auto ranking = ranker->score(*idx, query, 50);" in the two while
loops. Also, note that this is only a suggestion. You can implement the feedback in other ways
and using a different number of positive feedback documents.

Write a tuning function, similar to the one you saw in Programming Assignment 1, to optimize
your ranking function over a suitable set of parameters.

Write a new scoring function, similar to the PL2 that you implemented in Assignment 1, that
returns a weighted combination of the scores of different retrieval formulas. For example, you
can implement something like:

Score(Q,D)=αBM25(Q,D)
+(1−α)DirichletPrior(Q,D)Score(Q,D)=αBM25(Q,D)
+(1−α)DirichletPrior(Q,D)S, c, o, r, e, left parenthesis, Q, comma, D, right
parenthesis, equals, alpha, B, M, 25, left parenthesis, Q, comma, D, right parenthesis, plus, left
parenthesis, 1, −, alpha, right parenthesis, D, i, r, i, c, h, l, e, t, P, r, i, o, r, left parenthesis, Q,
comma, D, right parenthesis where 0<α<10<α<10, is less than, alpha, is less than, 1

We have already provided you with a scaffold where you can implement your new function. At
the top of [Link] you can find a commented class called new_ranker along with
some functions. Uncomment the code and modify score_one to return the weighted
combination you choose. The code assumes that the ranking function has two parameters
named "param1" and "param2" and that the ranker can be called from [Link] using the
name "newranker.". If your ranking function requires a different number of parameters, you
should modify the code accordingly. Also, feel free to change the names of the variables and
parameters; the provided code is there just to guide you through writing your new function.
After implementing the function, uncomment the first line in main:

1
index::register_ranker<new_ranker>();
Don't forget to point [Link] to your new ranker. For more information on how to
implement your new function, see the last section in MeTA's Search Tutorial and inspect the
code of [Link] from Assignment 1.

If you want to further improve your ranking functions, you might want to have a look at
section 6 of this paper, which introduces several empirically-driven enhancements to some of
the well-known retrieval functions.

Write a function that expands queries with synonyms. Given a query, your function will use a
thesaurus to augment the query words with their synonyms. It is a good idea to give the
original query words more weight since the synonyms might cause a topic drift in some cases.
One crude way to do this is to duplicate the original query words several times and have each
synonym appear only once in the modified query. In [Link], you should replace:

1
[Link](content);

with:

1
2
3
[Link](content);
query = expand_query(query); // You should write this function

Make sure to expand the queries in both while loops.

Non-Programming Based
Try different ranking functions and different parameters (ideally, you should tune the
parameters). MeTA has several built-in rankers other than BM25. For example, you can use
the Jelinek-Mercer smoothing ranking function by setting the ranker in [Link] to jelinek-
mercer and tuning its parameter lambda. You can check the different built-in rankers in
meta/src/index/ranker/. When you open the cpp file of the ranker, you should find a constant
string called id whose value you can use in [Link], in addition to the parameters of the
ranking function which are defined in the constructor (see okapi_bm25.cpp and
jelinek_mercer.cpp to gain more insight).

Index the MOOCs dataset again while experimenting with different tokenization parameters
under the analyzers tag in [Link]. You can try different combinations of text filters and
select the one that gives the best performance on the training queries. See MeTA's Analyzers
and Filters Tutorial for instructions on how to modify the default filtering behavior.
Modify MeTA's default stopwords list, which is located in meta/data/[Link].
You can extend or shrink the list and check if you can achieve higher performance. After
modifying the list, make sure to index the dataset again.

After you perform the optimizations, compile MeTA again and run the competition program.
You can do so by executing:

1
2
3
4
cd Assignment_2/build
cmake .. -DCMAKE_BUILD_TYPE=Release; make -j8
./competition ../[Link]

The results of the training queries, the precision at 10 documents, and the MAP will be
printed. When you are satisfied with your results, run the grader script:

1
python [Link]

which will generate a file called [Link]

Submit this file under the assignment's My Submission tab. Click + Create submission, and
upload your file.

Note: Always check the feedback from the automated grader on the submissions page after
you submit your output. If the nickname you chose is already in use, the grader will ask you to
submit your output again using a different nickname.
How to submit

When you're ready to submit, you can upload files for each part of the assignment on the "My
submissions" tab.
Like
Dislike

Common questions

Powered by AI

When running the competition script, the expected outputs include precision at 10 documents and the Mean Average Precision (MAP) for the training queries. These metrics help quantify the effectiveness of the search engine. The competition evaluates success by comparing the MAP values obtained from training queries to those from testing queries, aiming for a close match indicating robust search engine performance .

To set up and run the assignment, first download and extract Assignment_2.tar.gz into the parent directory of MeTA, and then use the terminal to change to the Assignment_2 directory. Execute the setup.sh script to move necessary data. Recompile MeTA by navigating to Assignment_2/build and running cmake and make commands. To run the competition program, make sure the config.toml points to the new ranker and compile MeTA again. Ensure to submit the results using python grader.py, creating a submit.txt file which should be uploaded under the assignment's My Submission tab .

Query expansion using synonyms can enhance search results by capturing a broader linguistic scope that might match more relevant documents that use different terminology. This can be particularly beneficial in retrieving documents with semantically similar content that might not share exact query terms. However, care must be taken to avoid topic drift, often addressed by giving original query terms more weight compared to the added synonyms. This technique can increase the recall of relevant documents while maintaining precision .

The training data file containing 100 queries with relevance judgments is used to optimize the search engine's parameters and retrieval methods by adjusting them to maximize metrics like precision and MAP. For effective optimization, one should ensure that the training data performance closely predicts testing outcomes. The testing data file contains 538 queries for final assessment, making it crucial to verify that optimizations transfer to unseen data, maintaining the robustness of the search engine .

The configuration file config.toml can be adjusted by changing the ranker parameter to use different built-in ranking functions, such as switching from BM25 to Jelinek-Mercer smoothing and tuning its lambda parameter. Additionally, the analyzers tag can be modified to experiment with different tokenization parameters and text filters, optimizing for the combination that yields the best performance. Altering the stopwords list can also potentially enhance performance by reducing noise from irrelevant terms .

The assignment suggests experimenting with different retrieval functions by implementing new ranking functions or tuning existing ones. For example, one could combine scores from multiple retrieval formulas, like BM25 and Dirichlet Prior, using a weighted approach to generate a composite score. The assignment provides a scaffold in competition.cpp to implement this kind of function, where experimentation with parameter tuning is also encouraged. Using non-programming techniques like adapting built-in rankers and varying tokenization and filtering parameters are additional suggested strategies .

Rocchio's method can be implemented by writing a new function in competition.cpp that modifies a query using positive feedback documents. The function takes a query and a set of top retrieved positive feedback documents, processes them, and outputs a modified query. This involves calling the Rocchio function on each query with its top 10 initially retrieved documents, then re-running the scoring function on the modified query. This process is incorporated in both the training and testing phases, replacing the original ranking score line with a new one to utilize the modified query for improved retrieval performance .

Non-programmatic methods to enhance retrieval performance include experimenting with different built-in rankers, such as the Jelinek-Mercer smoothing function, and tuning their parameters. Additionally, users are encouraged to test various tokenization strategies and text filters within the config.toml file, and modify the default stopwords list to include or exclude terms that might impact retrieval performance. Reindexing the dataset after such changes is essential for these modifications to take effect .

The automated grader evaluates the effectiveness of the search engine by calculating performance metrics such as precision and MAP from the submitted output file (submit.txt). It provides feedback on the performance, guiding students in improving their search engine's retrieval capabilities. Moreover, the grader handles submission validation, such as ensuring unique nicknames for submissions .

The dual-loop approach in competition.cpp serves two main purposes. The first loop iterates over 100 training queries to calculate and print metrics like precision at 10 documents and MAP, fostering search engine optimization during development. The second loop processes 538 testing queries, extracting top document IDs for output, providing a comparative evaluation of the search engine's performance against unseen data. This separation ensures robust evaluation and optimization .

You might also like