Guest User

Untitled

a guest
Mar 17th, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. a_selected = tf$gather(a, a_index)
  2. b_selected = tf$gather(b, b_index)
  3. c_selected = tf$gather(c, c_index)
  4.  
  5. logit = a_selected * b_selected - c_selected
  6. y_model = tf$sigmoid(logit)
  7.  
  8. loss = tf$losses$log_loss(y_real, y_model)
  9.  
  10. a_mm = mm = tf$nn$moments(a, axes = 0L)
  11.  
  12. total_loss = loss +
  13. tf$abs(a_mm[[1]]) + # mean(a) = 0
  14. tf$abs(a_mm[[2]] - 1) # var(a) = 1^2
  15.  
  16. a_sort = tf$contrib$framework$sort(a)
  17. n = length(a)
  18. ideal_dist = qnorm((1:n)/(n+1), mean = 0, sd = 1)
  19. divergence = tf$reduce_mean(tf$abs(a_sort - ideal_dist))
  20.  
  21. total_loss = loss +
  22. divergence
Add Comment
Please, Sign In to add comment