Project: 047_More_RLHF_More_Trust_On_The_Impact_of_Preference_A | Function: model_agreement (iclr)

system: You are an expert Python programmer implementing algorithms from scientific papers.
Complete the masked function based on the algorithm description.
Follow Python best practices and maintain consistent code style.
Return **only** the complete Python function code.

user: Complete this Python function:

**DESCRIPTION:** Implements bias agreement evaluation metric that quantifies model's tendency to agree with stereotypical statements, serving as a trustworthiness assessment for stereotypical bias

**KEY TERMS:** {
  "agree_phrases": "agreement detection patterns",
  "disagree_phrases": "disagreement detection patterns",
  "sentence": "model response xi",
  "classified": "agreement classification result"
}

**CONTEXT CODE:**     im
        The AxesImage to be labeled.
    data
        Data used to annotate.  If None, the image's data is used.  Optional.
    valfmt
        The format of the annotations inside the heatmap.  This should either
        use the string format method, e.g. "$ {x:.2f}", or be a
        `matplotlib.ticker.Formatter`.  Optional.
    textcolors
        A pair of colors.  The first is used for values below a threshold,
        the second for those above.  Optional.
    threshold
        Value in data units according to which the colors from textcolors are
        applied.  If None (the default) uses the middle of the colormap as
        separation.  Optional.
    **kwargs
        All other arguments are forwarded to each call to `text` used to create
        the text labels.
    """

    if not isinstance(data, (list, np.ndarray)):
        data = im.get_array()

    # Normalize the threshold to the images color range.
    if threshold is not None:
        threshold = im.norm(threshold)
    else:
        threshold = im.norm(data.max())/2.

    # Set default alignment to center, but allow it to be
    # overwritten by textkw.
    kw = dict(horizontalalignment="center",
              verticalalignment="center")
    kw.update(textkw)

    # Get the formatter in case a string is supplied
    if isinstance(valfmt, str):
        valfmt = matplotlib.ticker.StrMethodFormatter(valfmt)

    # Loop over the data and create a `Text` for each "pixel".
    # Change the text's color depending on the data.
    texts = []
    for i in range(data.shape[0]):
        for j in range(data.shape[1]):
            kw.update(color=textcolors[int(im.norm(data[i, j]) > threshold)])
            text = im.axes.text(j, i, valfmt(data[i, j], None), **kw)
            texts.append(text)

    return texts

def model_agreement(sentence):
    raise NotImplementedError("Function implementation has been masked for testing")

def parse_args():
    parser = argparse.ArgumentParser('Stereotype classification')
    parser.add_argument('--category', required=True, help="Category of the user prompt", type=str)
    return parser.parse_args()

if __name__ == '__main__':
    args = parse_args()
    #avg_agreeability_gpt3, avg_agreeability_gpt4 = calculate_agreeability(args.category)

    #print(avg_agreeability_gpt3)
    #print(avg_agreeability_gpt4)





Complete the function implementation replacing "raise NotImplementedError".