Skip to content

Instantly share code, notes, and snippets.

@risenW
Created July 16, 2018 18:49
Show Gist options
  • Save risenW/0e2511a751206410268df5a2ec1c926b to your computer and use it in GitHub Desktop.
Save risenW/0e2511a751206410268df5a2ec1c926b to your computer and use it in GitHub Desktop.
Code for L2 loss function
#Calculating the L2 loss
val = tf.square(Y_truth - Y_pred)
L2_val = sess.run(val)
#ploting the predicted values against the L2 loss
Y_array = sess.run(Y_pred)
plt.plot(Y_array, L2_val, 'b-', label='L2 loss' )
plt.title('L2 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