Exemple #1
0
 def calculate_and_log_out(self, loss, pred, label, info=''):
     loss = np.mean(np.array(loss))
     hit_at_one = youtube8m_metrics.calculate_hit_at_one(pred, label)
     perr = youtube8m_metrics.calculate_precision_at_equal_recall_rate(
         pred, label)
     gap = youtube8m_metrics.calculate_gap(pred, label)
     logger.info(info + ' , loss = {0}, Hit@1 = {1}, PERR = {2}, GAP = {3}'.format(\
                  '%.6f' % loss, '%.2f' % hit_at_one, '%.2f' % perr, '%.2f' % gap))
Exemple #2
0
 def calculate_and_log_out(self, fetch_list, info=''):
     loss = np.mean(np.array(fetch_list[0]))
     pred = np.array(fetch_list[1])
     label = np.array(fetch_list[2])
     hit_at_one = youtube8m_metrics.calculate_hit_at_one(pred, label)
     perr = youtube8m_metrics.calculate_precision_at_equal_recall_rate(pred,
                                                                       label)
     gap = youtube8m_metrics.calculate_gap(pred, label)
     logger.info(info + ', loss: {0}, Hit@1: {1}, PERR: {2}, GAP: {3}'.format(\
                  '%.6f' % loss, '%.2f' % hit_at_one, '%.2f' % perr, '%.2f' % gap))