CSC/ECE 517 Fall 2017/E17A7 Allow Reviewers to bid on what to review: Difference between revisions

From Expertiza_Wiki
Jump to navigation Jump to search
No edit summary
Line 44: Line 44:
* To develop code such that both applications (bidding for project teams and bidding for conference paper reviews) use the same code
* To develop code such that both applications (bidding for project teams and bidding for conference paper reviews) use the same code
* To improve the algorithm for calculating the score for a particular project topic/conference paper review assigned to a project team/conference reviewer
* To improve the algorithm for calculating the score for a particular project topic/conference paper review assigned to a project team/conference reviewer
* To ensure that the topic assignment algorithm assigns topics in a balanced manner in the case no reviewer has bid for any topic
* To develop a variable name in the database so as to distinguish between a project topic and a reviewer topic


We want to state here that we are not responsible for developing any conference features. Specifically, this means that we are not changing any UI features. We will be primarily relying on UI changes done by E17A5
We want to state here that we are not responsible for developing any conference features. Specifically, this means that we are not changing any UI features. We will be primarily relying on UI changes done by E17A5

Revision as of 00:43, 25 December 2017

This page describes the project E17A7 which is one of the several projects to allow Expertiza support a conference. Specifically, it involves adding the ability of conference paper reviewers to bid for what they want to review. The members of this project are:

Leiyang Guo (lguo7@ncsu.edu)

Bikram Singh (bsingh8@ncsu.edu)

Navin Venugopal (nvenugo2@ncsu.edu)

Sathwick Goparapu (sgopara@ncsu.edu)

Introduction

Expertiza is an open source project created using Ruby on Rails. This project is a software primarily to create reusable learning objects through peer review and also supports team projects. Expertiza allows the creation of instructors and student accounts. This allows the instructors to post projects (student learning objects) which can be viewed and worked upon by students. These can also be peer reviewed by students later.

Background of the project

In the existing Expertiza functionality, the functionality for bidding for topics is present though only for specific situations. The bidding ability is only for bidding for a topic for (teams of) students in a course. This involves the instructor posting a list of project topics, and each student (or all students together as a team, if some students have already formed a team) then post a preference list, listing topics (s)he wants to work on. Then the bidding algorithm assigns the topics, particularly with the following features:

  • Students (not in a team) with close preferences are assigned to a project team, and the common preference is the project topic assigned to the team. Alternatively, for existing teams, the project topic is assigned as per the common project topic preference list
  • Each team is assigned only one topic
  • Each topic (if assigned) is assigned to a maximum of one team

Description of project

This project is responsible for the bidding algorithm used in the conference, which is significantly different from the project bidding algorithm as explained above.

For the purposes of the project, we assume that there are several reviewers in a conference who review papers which are proposed to be presented in the conference. Also, the entire list of papers proposed to be presented in the conference is also available.

Then the basic working of the project assumes:

  • Before the bidding close deadline, reviewers submit a list of papers they wish to review.
  • After the bidding deadline, the algorithm assigns papers to reviewers to review, such that:
    • Each paper (if assigned) is assigned to a maximum of R reviewers (here R represents some constant)
    • Each reviewer is assigned a maximum of P papers to review (here P represents some constant)
    • Assignment of papers can be individual or team based

Project Requirements

In this section, we discuss the problem statement, then discuss the existing code and possible changes required.

Problem Statement

  • To take the existing bidding code in Expertiza (which is meant for students bidding for project topics) and make it callable either for bidding for topics or bidding for submissions to review.
  • The matching algorithm is currently not very sophisticated. Top trading cycles is implemented in the web service (though it is currently not used by bidding assignment) and could be adapted to this use.

In the subsequent discussion with the mentor, it was concluded that the two bidding situations are very different hence it was decided to keep the two separate, at least initially. Also, the second requirement was modified to first make the bidding for a conference using any algorithm and if time permits, to use a better algorithm like top trading cycles.

Current Project Aims

  • To develop code such that both applications (bidding for project teams and bidding for conference paper reviews) use the same code
  • To improve the algorithm for calculating the score for a particular project topic/conference paper review assigned to a project team/conference reviewer
  • To ensure that the topic assignment algorithm assigns topics in a balanced manner in the case no reviewer has bid for any topic
  • To develop a variable name in the database so as to distinguish between a project topic and a reviewer topic

We want to state here that we are not responsible for developing any conference features. Specifically, this means that we are not changing any UI features. We will be primarily relying on UI changes done by E17A5

Existing Algorithm

Problem

The existing algorithm solves the following problem:

To form teams of students of Maximum size M and then assign topics (there are N topics) based on preference lists submitted either by individual students or teams (complete or otherwise). Preference Lists can have minimum 1 topic and a maximum of L topics. Then the topics are allocated to teams such that each team gets a unique topic and each topic is assigned only to one team.

Functionality

The topics are assigned to project teams in 2 steps:

  • Making teams: This is done using a k-means clustering and a weighting formula that favors increasing overall student satisfaction and adding members until the maximum allowable team size is reached. You can read about it in detail here.
    • The basic cost function used in the algorithm is: C(i,j) = 1/N * ∑ [ M -S(i) ] where i varies from 1 to N
    • The Algorithm calculates the weights for every user, not a team or part of an incomplete team. It then assigns teams using the weights, by plotting graphs for each topic. It is as follows:
      • Draw a graph for every topic j with X-axis as the priority position i and the Y axis as the Weights.
      • Hierarchical K means to select teams such that all students in a team are close to each other in the graph above, hopefully, more towards the left of the graph, and also such that there are a minimum of 1 and a maximum of M students per team;
    • The Algorithm is as follows:
  
      For every topic j :
         For every position i that topic j can be placed in (any) preference list:
              Let S(i) = number of students who selected topic j at position i of their (individual) preference list
              B(i) = 1/S(i)
              Calculate C(i,j)                
              Weight(i,j) = B(i) / C(i,j)
 
  • Assigning topics to teams: This is implemented as a one line, comparing bid preferences to allot topics.

Design

In the following subsections, we discuss the problem, proposed design and code. We are trying to combine the code so that it can be used for both the project topic bidding as well as the conference paper review bidding.

The Combined Problem

The combined problem statement is as follows: Given a list of people (students or reviewers) and also a list of N items to bid on (project topics or conference paper reviews), we require the following:

  • To form teams of Maximum size M
  • Based on preference lists submitted by people/teams having a minimum of 1 item and a maximum of L topics, to allot topics to teams such that each team gets P items and each item (to be bid on) is assigned to R teams.

Points of Discussion

We note the differences:

  • For Bidding for Assignment Topics, M is generally greater then 1, but P = 1 and R = 1. The item to be bid on is the project topics.
  • For Bidding for Conference Paper Reviews, M = 1 but P and R are generally greater then 1. The item to be bid on is the conference paper reviews.

We note that a team of 1 person makes little sense, but we still implement it to be so that the code is compatible for both the applications.

Proposed Design

Keeping the existing algorithm and the project requirements in mind, we decided to divide the code into 2 parts:

  • Part A: Make teams for people not in a team (and if applicable, complete incomplete teams)
  • Part B: Assign topics to teams

We note that Part A has been implemented on a web service independent of Expertiza. We also note that the algorithm explained above applies only to Part A, and that it is pretty sophisticated. Hence we choose to keep the existing code as is for this part. We will simply call the webservice, provide the list of people, their bidding preference and also the max_team_size.

Part B is implemented as one line. It is pretty simple. We also note that it simply cannot be used for conference paper review assignemnt. Hence we completely change this section and implement it using a new algorithm.

Proposed Algorithm for Part B

Let N = Number of topics

   B = Base score
   t = Total number of topics an user prefers


For every topic i:

    den = find_den
    for every user j:
        if(user has preferred this topic)
             r = priority(topic)
             num = (N + 1 - r) * B * N
             score[topic][user] = num/den + B
        if(user has preferred no topic)
             score[topic][user] = B
        if(user has not preferred this topic)
             num = B * N
             score[topic][user] = B - num/den

Now find_den = ∑ [ N + 1 ] - ∑ [k] where the iterating variable k varies from 1 to t

Methodology

We will implement this new algorithm such that the code is DRY, proper naming conventions are used

Use Case Diagram

Actors:

  • Conference Reviewer: Submits a preference list of papers and reviews assigned papers
  • Conference Administrator: Responsible for the assignment of topics to the reviewers

Scenario The case of reviewers submitting a list of preferred topics and the administrator running the assignment process. For our project, the main modification would be concentrating on Use Case 4 and 5.



Choose and submit preference to be reviewed

  • Use Case Id: 1
  • Use Case Description: Participants choose the preference for conference review topics and submit it
  • Actors: Participants
  • Pre Conditions: Conference papers are presented and submitted, and the participants are eligible for reviewing
  • Post Conditions: Conference committee members can view participants preference and run bidding algorithm on it

Saving topic and participant information into database

  • Use Case Id: 2
  • Use Case Description: bidding preferences and related participants information are processed and saved to database
  • Actors: None
  • Triggered by Use Case 1
  • Pre Conditions: participants preferences are submitted
  • Post Conditions: information can be retrieved and used by bidding algorithm

View list of topics and bid

  • Use Case Id: 3
  • Use Case Description: participants can view list of topic available for conference paper topic
  • Actors: Participants

Run bidding Algorithm

  • Use Case Id: 4
  • Use Case Description: Committee members can run bidding algorithm on application to help assigning the conference paper topics to participants
  • Actors: Conference Committee
  • Pre Conditions: preferences must be submitted by participants
  • Post Conditions: the bidding result can be used for paper assignment

Display assigned paper to bidders

  • Use Case Id: 5
  • Use Case Description: System assigns participants to conference paper topics according to bidding result
  • Actors: None
  • Triggered by Use Case 4
  • Pre Conditions: bidding algorithm has run and result has been returned
  • Post Conditions: Participants can view topics been assigned to them

Change assignment of review using CRUD actions

  • Use Case Id: 6
  • Use Case Description: Conference committee members can change assignment result manually
  • Actors: Conference Committee
  • Pre Conditions: topic assignment has been done
  • Post Conditions: changes in bidding result is visible to participants and other committee members

Data Flow Diagram

Below is the Data Flow Diagram for process flows of the project. The diagram shows the process of bidding algorithm that we proposed to use for conference paper review assignment.


We explain in the terms of the actors: Reviewer and Administrator

  • Before the deadline, all the reviewers have to submit preference list of papers. They can save, modify list as many times as they want, but they can submit once
  • This information is saved in the database
  • When the deadline is passed, stop accepting preference lists
  • The administrator runs the paper assignment algorithm
    • For every topic, calculate the score for each user
    • Make a common scorelist, which keeps score assigned to every topic of every user. There should be a way to find out the topic and user a particular element of the scorelist belongs to
    • Now start assigning topics according to highest score
    • Keep track of the number of topics assigned to each user and the number of users assigned to each topic
    • If the number of topics assigned to one user reaches the maximum value, remove that user from consideration (remove all scores corresponding to that user from scorelist)
    • If the number of users assigned to one topic reaches the maximum value, remove that topic from consideration (remove all scores correspoinding to that topic from scorelist)
    • Continue the above process until the scorelist is empty
  • Save the bidding into the database
  • Inform users about the results of the bidding

Changing Existing Files

This subsection details what is to be changed in the existing code.

Files to be changed

  • lottery_controller.rb

Current Code

This is current code for the bidding assignment. The code will basically get target assignment and then get all topics and teams for the assignment. Then it will assign priority of each team-topic pair according to user preference for each user, and append it to priority information list. Afterward, it sends priority information along with maximum team size information to web-server and rearranging the priority order according to top-trading cycle algorithm, and pass returned result to create_new_teams_for_bidding_response function for bidding handling on topics with preferences and run_intelligent_bid function for bidding handling for leftover assignment as well as cleaning up.

 def run_intelligent_assignment
   priority_info = []
   assignment = Assignment.find_by(id: params[:id])
   topics = assignment.sign_up_topics
   teams = assignment.teams
   teams.each do |team|
     # grab student id and list of bids
     bids = []
     topics.each do |topic|
       bid_record = Bid.find_by(team_id: team.id, topic_id: topic.id)
       bids << (bid_record.nil? ? 0 : bid_record.priority ||= 0)
     end
     team.users.each { |user| priority_info << { pid: user.id, ranks: bids } if bids.uniq != [0] }
   end
   data = { users: priority_info, max_team_size: assignment.max_team_size }
   url = WEBSERVICE_CONFIG["topic_bidding_webservice_url"]
   begin
     response = RestClient.post url, data.to_json, content_type: :json, accept: :json
     # store each summary in a hashmap and use the question as the key
     teams = JSON.parse(response)["teams"]
     create_new_teams_for_bidding_response(teams, assignment)
     run_intelligent_bid(assignment)
   rescue => err
     flash[:error] = err.message
   end
   redirect_to controller: 'tree_display', action: 'list'
 end

Proposed Code

Then we will change the run_intelligent_assignment function to implementation as shown below: The update involves the use of the existing assignment bidding tables since the UI and table entries specific to conference paper bidding has not been created and is out of scope for this project.

Proposal: Allow the instructor to choose whether is it a topic assignment bid or conference paper bid via an update of a flag variable from the UI. For example, the is_assignment variable is used to indicate if it is an assignment bidding. If not the flag is set to false and assumes it is a conference bid. This enables the reuse of existing precondition variables and table entries. The bidding is run by calculating the weighted scores for each team's bidding priority of all the topics. Score calculation is done as explained in the Design section.

Upon score calculation, the topics are used to populate the singed_up table for the corresponding teams and topic id. The resulting assigned topics can be viewed through the sing up sheet view by each participant. Each topic can be assigned to multiple teams as denoted by the max_per_topic variable. A hash map is used to keep track of how many times the same topic has been assigned to a team. Hence we are able to restrict the number of times the same paper/topic can be reviewed.

 def run_conference_bid teams, assignment, topic_per_team, team_per_topic
   incomplete_teams = Hash.new(0)
   incomplete_topics = Hash.new(0)
   all_topics=[]
   all_topics = assignment.sign_up_topics
   score_list=Array.new(teams.length*all_topics.length){Array.new(3)}
   sorted_list=Array.new(teams.length*all_topics.length){Array.new(3)}
   temp=[]
   base = 10
   p = 0
   #looping through each team to calculate score for each topic in the assignment
   teams.each do |t|
     incomplete_teams.store(t.id,0)
     team_bids = Bid.where(team_id: t.id)
     denom = 0
     b_length = team_bids.length
     (1..b_length).each do |i|
       denom = denom+all_topics.length - i
     end
     #Score calculation based on bid priority
     all_topics.each do |j|
       if(team_bids.any?{|tb| tb.topic_id == j.id})
         bid_priority = Bid.where(team_id:t.id,topic_id:j.id).first.priority
         score = base+((all_topics.length+1-bid_priority)*base*all_topics.length) / denom
       elsif(team_bids.length!=0)
         score = base-(base*all_topics.length)/denom
       else
         score = base
       end
       score_list[p][0] = score
       score_list[p][1] = t.id
       score_list[p][2] = j.id
       p+=1
     end
   end
   sorted_list = score_list.sort_by{|e| [e[0],e[1],e[2]]}.each{|line| p line}
   sorted_list.reverse!
   all_topics.each do |k|
     incomplete_topics.store(k.id,0)
   end
   if(all_topics.length*team_per_topic<teams.length)
     flash[:error] = 'There are not enough reviews to be assigned'
   end
   #Assigning topics to teams based on highest score
   sorted_list.each do |s|
     if((incomplete_topics[s[2]]<team_per_topic) && (incomplete_teams[s[1]]<topic_per_team))
       SignedUpTeam.create(team_id: s[1], topic_id: s[2])
       incomplete_teams[s[1]]+=1
       incomplete_topics[s[2]]+=1
     end
   end
   assignment.update_attribute(:is_intelligent,false)
   flash[:notice] = 'The intelligent assignment was successfully completed for ' + assignment.name + '.'
 end


Test Plan

Manual Testing

  • UI testing of the implemented functionality to be done.
  • No UI has been created been created for the conference paper review bidding. Hence assignment bidding controller is used to manually test the code on a local host to determine the feasibility of code.
    • Log in as a participants/student
    • Go to Assignment
    • Go to Other's works and check preferred conference paper topics to bid on reviewing
    • Click submit and wait for bidding deadline
    • After deadline reaches, go back to assignment and click on Other's work to view topics assigned for reviewing

Automated Test Cases

  • TDD and Feature Test cases to be written. For instance, we will do Rspec test in cases below:
    • Test on score calculation, see if the calculation gives right scoring distribution when no preference is given, when one preference is given, and when multiple preferences are given;
    • Test on preference levels matching, check if the algorithm is matched first, second, third, and so on preferences and evaluating them correctly;
    • Test if teams per topic or topics per team can exceed required number by assigning many teams with same first preference and assigning many teams with multiple preferences (preference number per team > number of topics/2);
  • For the Rspec tests, we will have to create an object of team, assignment, and ranks. A sample team object in JSON format would be:
 {"users":[{"ranks":[1,0,2,3], "pid":1023}],"max_team_size":1}
  • The objects would be generated inside the spec file lottery_controller_spec.rb using model object initializer;

Edge cases

  • Case 1: No reviewer submits a list of preferred topics to review
  • Case 2: All reviewers submit exactly the same list of topics to review.
  • Case 3: Number of teams exceed the number of topics to review.