Exemplo n.º 1
0
def regression_loss(predicty, ylabel, weight_map=None):
    """
    Distance regression loss
    :param predicty: prediction results
    :param ylabel: ground truth
    :return: regression loss
    """
    loss = l2_loss(predicty, ylabel, weight_map)

    return loss
Exemplo n.º 2
0
 def test_l2_loss(self):
     # expected loss: (0.04 + 4 + 1) /2 = 2.52
     # (note - not the mean, just the sum)
     with self.test_session():
         predicted = tf.constant([1.2, 1, 2],
                                 dtype=tf.float32,
                                 name='predicted')
         gold_standard = tf.constant([1, 3, 3],
                                     dtype=tf.float32,
                                     name='gold_standard')
         self.assertAlmostEqual(
             l2_loss(predicted, gold_standard).eval(), 2.52)
Exemplo n.º 3
0
 def test_l2_loss(self):
     # expected loss: (0.04 + 4 + 1) /2 = 2.52
     # (note - not the mean, just the sum)
     with self.test_session():
         predicted = tf.constant(
             [1.2, 1, 2],
             dtype=tf.float32, name='predicted')
         gold_standard = tf.constant(
             [1, 3, 3],
             dtype=tf.float32, name='gold_standard')
         self.assertAlmostEqual(
             l2_loss(predicted, gold_standard).eval(), 2.52)