Skip to content

Instantly share code, notes, and snippets.

@risenW
Last active July 17, 2018 11:53
Show Gist options
  • Save risenW/84029ca0591c41b2bae2bab82bf75b0b to your computer and use it in GitHub Desktop.
Save risenW/84029ca0591c41b2bae2bab82bf75b0b to your computer and use it in GitHub Desktop.
Code for L1 norm loss/ Absolute loss function
#Computing L1 loss with the same values
temp = tf.abs(Y_truth - Y_pred)
L1_val = sess.run(temp)
#ploting the predicted values against the L2 loss
Y_array = sess.run(Y_pred)
plt.plot(Y_array, L1_val, 'r-' )
plt.title('L1 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