Skip to content

Instantly share code, notes, and snippets.

@risenW
Created July 16, 2018 18:54
Show Gist options
  • Save risenW/f66d6b11aedf1f8677bba7731771dd30 to your computer and use it in GitHub Desktop.
Save risenW/f66d6b11aedf1f8677bba7731771dd30 to your computer and use it in GitHub Desktop.
Code for Pseudo Huber loss
#Plot of the Pseudo-Huber loss
delta = tf.constant(0.24)
temp_ph = tf.multiply(tf.square(delta),tf.sqrt(1. + tf.square((Y_truth - Y_pred) / delta)) - 1. )
pseudo_h_vals = sess.run(temp_ph)
#ploting the predicted values against the L2 loss
Y_array = sess.run(Y_pred)
plt.plot(Y_array, pseudo_h_vals, 'g-' )
plt.title('Pseudo Huber loss')
plt.xlabel('$Y_{pred}$', fontsize=15)
plt.ylabel('$Y_{true}$', fontsize=15)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment