Guest User

Untitled

a guest
Jul 16th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.53 KB | None | 0 0
  1. #Redefining our data
  2. Y_pred = tf.linspace(-4., 6., 500)
  3. Y_label = tf.constant(1.)
  4. Y_labels = tf.fill([500,], 1.)
  5.  
  6. #applying sigmoid
  7. x_entropy_vals = - tf.multiply(Y_label, tf.log(Y_pred)) - tf.multiply((1. - Y_label), tf.log(1. - Y_pred))
  8. x_entropy_loss = sess.run(x_entropy_vals)
  9. #ploting the predicted values against the cross entropy loss
  10. Y_array = sess.run(Y_pred)
  11. plt.plot(Y_array, x_entropy_loss, 'r-' )
  12. plt.title('Cross entropy loss')
  13. plt.xlabel('$Y_{pred}$', fontsize=15)
  14. plt.ylabel('$Y_{label}$', fontsize=15)
  15. plt.ylim(-2, 5)
  16. plt.show()
Add Comment
Please, Sign In to add comment