stanford-tensorflow-tutorials icon indicating copy to clipboard operation
stanford-tensorflow-tutorials copied to clipboard

04_linreg_eager issue

Open yikayiyo opened this issue 7 years ago • 0 comments

train(huber_loss) and train(tf.losses.huber_loss) have different resluts. it seems like

  def huber_loss(y, y_predicted, m=1.0):
    """Huber loss."""
    t = y - y_predicted
    return t ** 2 if tf.abs(t) <= m else m * (2 * tf.abs(t) - m)

should be

  return 0.5*t**2 if tf.abs(t) <= m else m*(tf.abs(t)-0.5*m)

yikayiyo avatar Jun 24 '18 10:06 yikayiyo