Project: 001_RM-Bench_Benchmarking_Reward_Models_of_Language_Mo | Function: compute_accuracy (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:** Core function implementing the paper's evaluation method for computing hard/normal/easy accuracy metrics. Creates a 3x3 comparison matrix to evaluate chosen vs rejected response pairs across different style levels (concise, detailed_plain, detailed_markdown), computing accuracy metrics based on matrix triangular regions.

**KEY TERMS:** {
  "score_chosen": "Scores of chosen responses",
  "score_rejected": "Scores of rejected responses",
  "hard_acc": "Hard accuracy - chosen responses with less fancy style vs rejected with more fancy style",
  "normal_acc": "Normal accuracy - chosen and rejected responses with same style",
  "easy_acc": "Easy accuracy - chosen responses with more fancy style vs rejected with less fancy style",
  "MATRIX_SIZE": "Matrix dimensions (3) - corresponding to concise, detailed_plain, detailed_markdown styles",
  "acc_matrix": "3x3 comparison accuracy matrix"
}

**CONTEXT CODE:** import logging
import numpy as np
from typing import List, Dict, Any, Tuple
import json
from datasets import Dataset, load_from_disk

try:
    from fastchat.conversation import Conversation
    from datasets import DatasetDict, Value, concatenate_datasets, load_dataset
    from transformers import PreTrainedTokenizer
    from rewardbench.utils import check_tokenizer_chat_template, prepare_dialogue, prepare_dialogue_from_tokenizer
    HAS_OPTIONAL_DEPS = True
except ImportError:
    HAS_OPTIONAL_DEPS = False
EXTRA_PREF_SETS = "allenai/pref-test-sets"

def convert_robust_dataset_to_preference_dataset_list(robust_dataset_path: str) -> List[Dataset]:
    raise NotImplementedError("Function implementation has been masked for testing")
    
def split_dataset_by_domain(dataset: List[Dict[str, Any]]) -> Dict[str, List[Dict[str, Any]]]:
    domains = ["chat","math","code","safety"]
    domain_dataset_dict = {}
    for domain in domains:
        domain_dataset_dict[domain] = [example for example in dataset if example['domain'].startswith(domain)]
    
    # pop the domain keys
    for domain in domain_dataset_dict:
        for example in domain_dataset_dict[domain]:
            example.pop('domain')
    
    return domain_dataset_dict


def compute_accuracy(results: List[Dict[str, Any]]) -> Dict[str, float]:
    raise NotImplementedError("Function implementation has been masked for testing")
    
def load_eval_dataset(
    raw_Dataset: Dataset = None,
    core_set: bool = True,
    custom_dialogue_formatting: bool = False,
    conv: Conversation = None,
    tokenizer: PreTrainedTokenizer = None,
    logger: logging.Logger = None,
    keep_columns: List[str] = ["text_chosen", "text_rejected", "id"],
    return_extra_data: bool = False,
    max_turns: int = None,
) -> Tuple[Dataset, List[str]]:
    """
    Loads either the core eval set for HERM or the existing preference data test sets.

    Args:
        core_set: if True, load the core eval set for HERM.
        custom_dialogue_formatting: if True, format the dialogue as needed for custom models (e.g. SHP and PairRM).
        conv: fastchat conversation template.
                If None (default) the passed tokenizer needs to have a usable chat template.
        tokenizer: HuggingFace tokenizer to use. The tokenizer's chat template, if available, has precedence over conv.
        logger: logger to use for logging. If None (default), no logging is done.
        keep_columns: list of columns to keep in the dataset.
        max_turns: maximum number of turns in the dialogue (usually even). If None (default), no filtering is done.

    Returns:
        dataset: loaded dataset with required properties.
        subsets: list of subsets for the corresponding samples in the dataset.
    """
    if raw_Dataset is not None:
        raw_dataset = raw_Dataset
    elif core_set:
        raw_dataset = load_from_disk("data/reward-bench")
        raw_dataset = raw_dataset['filtered']
    else:
        raw_dataset = load_dataset(EXTRA_PREF_SETS)
        modified_datasets = []

        # Iterate over each subset in the DatasetDict
        for subset_name, subdataset in raw_dataset.items():
            # if subset column exists, move to subsubset (for pref sets)
            if "subset" in subdataset.column_names:
                subdataset = subdataset.rename_column("subset", "subsubset")

            # Add a new column 'subset' to the dataset with the subset name
            subdataset = subdataset.add_column("subset", [subset_name] * len(subdataset))

            # Append the modified dataset to the list
            # remove pku_safer and pku_better from the dict, no longer part of the benchmark
            if subset_name not in ["pku_safer", "pku_better"]:
                modified_datasets.append(subdataset)

        # Concatenate all the modified datasets into one dataset
        raw_dataset = concatenate_datasets(modified_datasets)

    # Apply chat template
    if not custom_dialogue_formatting:
        usable_tokenizer = check_tokenizer_chat_template(tokenizer)

        # assert either conv is passed or tokenizer has chat_template
        assert conv is not None or usable_tokenizer

        if usable_tokenizer:
            if logger is not None:
                logger.info("*** Preparing dataset with HF Transformers ***")
            # docs https://huggingface.co/docs/transformers/main/en/chat_templating
            dataset = raw_dataset.map(
                prepare_dialogue_from_tokenizer,
                fn_kwargs={"tokenizer": tokenizer},
                num_proc=8,
                load_from_cache_file=False,
            )

        # else use FastChat to get chat template
        else:
            if logger is not None:
                logger.info("*** Preparing dataset with FastChat ***")
            dataset = raw_dataset.map(
                prepare_dialogue,
                fn_kwargs={"dialogue_template": conv},
                num_proc=8,  # using >1 process causes issues with re-assigning prompt in example
                load_from_cache_file=False,
            )
    else:
        if logger is not None:
            logger.info("*** Preparing dataset with custom formatting ***")

        def map_conversations(example, core_set=True):
            if core_set:
                example["text_chosen"] = [
                    {"role": "user", "content": example["prompt"]},
                    {"role": "assistant", "content": example["chosen"]},
                ]
                example["text_rejected"] = [
                    {"role": "user", "content": example["prompt"]},
                    {"role": "assistant", "content": example["rejected"]},
                ]
            else:


Complete the function implementation replacing "raise NotImplementedError".