<commit_before>import copy
import numpy as np

from chainer import reporter
import chainer.training.extensions

from chainercv.evaluations import eval_detection_voc_ap
from chainercv.utils import apply_prediction_to_iterator


class DetectionVOCEvaluator(chainer.training.extensions.Evaluator):

    """An extension that evaluates a detection model by PASCAL VOC metric.

    This extension iterates over an iterator and evaluates the prediction
    results by average precisions and mean of them.
    This extension reports the following values with keys.
    Please note that :obj`'ap/label_names[l]'` is reported only if
    :obj:`label_names` is specified.

    * :obj`'map'`: Mean of average precisions.
    * :obj`'ap/label_names[l]'`: Average precision of class :math:`l`. \
        For example, this evaluator reports :obj`'ap/aeroplane'`, \
        :obj`'ap/bicycle'`, etc. if :obj:`label_names` is \
        :obj:`~chainercv.datasets.voc_detection_label_names`. \
        If class :math:`l` does not exist in either ground truth or \
        prediction, it reports :obj:`numpy.nan`.

    Args:
        iterator (chainer.Iterator): An iterator. Each sample should be<commit_msg>fix docs<commit_after>import copy
import numpy as np

from chainer import reporter
import chainer.training.extensions

from chainercv.evaluations import eval_detection_voc_ap
from chainercv.utils import apply_prediction_to_iterator


class DetectionVOCEvaluator(chainer.training.extensions.Evaluator):

    """An extension that evaluates a detection model by PASCAL VOC metric.

    This extension iterates over an iterator and evaluates the prediction
    results by average precisions (APs) and mean of them
    (mean Average Precision, mAP).
    This extension reports the following values with keys.
    Please note that :obj:`'ap/label_names[l]'` is reported only if
    :obj:`label_names` is specified.

    * :obj:`'map'`: Mean of average precisions (mAP).
    * :obj:`'ap/label_names[l]'`: Average precision of class :math:`l`. \
        For example, this evaluator reports :obj:`'ap/aeroplane'`, \
        :obj:`'ap/bicycle'`, etc. if :obj:`label_names` is \
        :obj:`~chainercv.datasets.voc_detection_label_names`. \
        If class :math:`l` does not exist in either ground truth or \
        prediction, it reports :obj:`numpy.nan` as its average precision. \
        In this case, mAP is computed without this class.

    Args:
        iterator (chainer.Iterator): An iterator. Each sample should be
{'fraction_non_alphanumeric': 0.08982035928143713, 'fraction_numerical': 0.0, 'mean_word_length': 3.76425855513308, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3136477', 'n_tokens_mistral': 742, 'n_tokens_neox': 714, 'n_words': 253}