'Calculate the evaluation metrics for the whole epoch.
Raises:
ValueError: If no examples were accumulated.
Returns:
dictionary: a dictionary storing the evaluation metrics for the epoch. The
dictionary has the fields: avg_hit_at_one, avg_perr, avg_loss, and
aps (default nan).'

def get(self):

    if (self.num_examples <= 0):
        raise ValueError('total_sample    must    be    positive.')
    avg_hit_at_one = (self.sum_hit_at_one / self.num_examples)
    avg_perr = (self.sum_perr / self.num_examples)
    avg_loss = (self.sum_loss / self.num_examples)
    aps = self.map_calculator.peek_map_at_n()
    gap = self.global_ap_calculator.peek_ap_at_n()
    epoch_info_dict = {}
    return {'avg_hit_at_one': avg_hit_at_one, 'avg_perr': avg_perr, 'avg_loss': avg_loss, 'aps': aps, 'gap': gap}
