'Construct a calculator to calculate the (macro) average precision.
Args:
num_class: A positive Integer specifying the number of classes.
top_n_array: A list of positive integers specifying the top n for each
class. The top n in each class will be used to calculate its average
precision at n.
The size of the array must be num_class.
Raises:
ValueError: An error occurred when num_class is not a positive integer;
or the top_n_array is not a list of positive integers.'

def __init__(self, num_class):

    if ((not isinstance(num_class, int)) or (num_class <= 1)):
        raise ValueError('num_class    must    be    a    positive    integer.')
    self._ap_calculators = []
    self._num_class = num_class
    for i in range(num_class):
        self._ap_calculators.append(average_precision_calculator.AveragePrecisionCalculator())
