File size: 3,460 Bytes
53709ed
 
bdafe83
 
 
 
 
 
 
 
53709ed
bdafe83
 
 
 
 
 
 
 
 
 
 
 
53709ed
 
bdafe83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1d838f0
bdafe83
1d838f0
bdafe83
 
 
1d838f0
bdafe83
1d838f0
bdafe83
 
 
1d838f0
bdafe83
1d838f0
bdafe83
 
1d838f0
bdafe83
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
from typing import Union

default_reviewer_setting = {
    "is_benign": None,
    "is_knowledgeable": None,
    "is_responsible": None,
    "provides_numeric_rating": True,
}


def get_experiment_settings(paper_id: Union[int, None] = None, paper_decision: Union[str, None] = None, setting: dict = None):
    """
    Generate experiment settings based on provided configurations for area chairs (AC) and reviewers.

    Args:
        setting (dict): A dictionary containing configuration for AC, reviewers, authors, and global settings.

    Returns:
        dict: Experiment settings including players (Paper Extractor, AC, Author, Reviewer)
              and global settings.
    """

    experiment_setting = {
        "paper_id": paper_id,
        "paper_decision": paper_decision,
        "players": {

            # Paper Extractor is a special player that extracts a paper from the dataset.
            # Its constructor does not take any arguments.
            "Paper Extractor": [{}],

            # Assume there is only one area chair (AC) in the experiment.
            "AC": [get_ac_setting_from_ac_type(ac_type) for ac_type in setting['AC']],

            # Author role with default configuration.
            "Author": [{}],

            # Reviewer settings are generated based on reviewer types provided in the settings.
            "Reviewer": [get_reviewer_setting_from_reviewer_type(reviewer_type) for reviewer_type in setting[
                'reviewer']],
        },
        "global_settings": setting['global_settings']
    }

    return experiment_setting


def get_reviewer_setting_from_reviewer_type(reviewer_type: str):
    """
    Map a reviewer type (e.g., 'benign', 'malicious') to a reviewer setting dictionary.

    Args:
        reviewer_type (str): The type of reviewer (e.g., 'benign', 'malicious', 'knowledgeable').

    Returns:
        dict: A dictionary representing the reviewer's attributes like is_benign, is_knowledgeable,
              is_responsible, or if they know the authors (e.g., 'famous', 'unfamous').

    Raises:
        ValueError: If an unknown reviewer type is provided.
    """
    reviewer_setting = {
        "is_benign": None,
        "is_knowledgeable": None,
        "is_responsible": None
    }

    # Intention
    if "benign" in reviewer_type:
        reviewer_setting["is_benign"] = True
    if "malicious" in reviewer_type:
        reviewer_setting["is_benign"] = False

    # Knowledgeability
    if "knowledgeable" in reviewer_type:
        reviewer_setting["is_knowledgeable"] = True
    if "unknowledgeable" in reviewer_type:
        reviewer_setting["is_knowledgeable"] = False

    # Commitment
    if "responsible" in reviewer_type:
        reviewer_setting["is_responsible"] = True
    if "irresponsible" in reviewer_type:
        reviewer_setting["is_responsible"] = False

    if reviewer_type in ["authors_are_famous"]:
        reviewer_setting["knows_authors"] = "famous"

    elif reviewer_type in ["authors_are_unfamous"]:
        reviewer_setting["knows_authors"] = "unfamous"

    return reviewer_setting


def get_ac_setting_from_ac_type(ac_type: str):
    """
    Generate the area chair (AC) settings based on the type of AC.

    Args:
        ac_type (str): The type of area chair (e.g., 'senior', 'junior').

    Returns:
        dict: A dictionary containing the area chair type.
    """

    ac_setting = {
        "area_chair_type": ac_type
    }

    return ac_setting