Guest User

Untitled

a guest
Nov 21st, 2017
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.67 KB | None | 0 0
  1. # skip-gram learning example
  2.  
  3. import numpy as np
  4.  
  5. wi = np.array([[-0.094, -0.44, 0.31], [-0.491, -0.23, 0.065], [0.07, 0.17, -0.36], [0.1, 0.46, 0.08], [-0.23, -0.15, -0.04], [0.41, -0.19, -0.44], [0.18, 0.09, 0.28], [-0.05, 0.49, 0.26]])
  6. wo = np.array([[0.02, 0.48, 0.43, 0.37, -0.36, -0.12, 0.27, -0.35], [-0.37, 0.42, -0.26, -0.15, 0.03, 0.35, -0.14, 0.13], [0.42, 0.36, 0.47, -0.02, -0.42, -0.44, 0.27, -0.45]])
  7.  
  8. xk = np.array([[0, 1, 0, 0, 0, 0, 0, 0]])
  9. ht = np.dot(xk, wi)
  10. u0 = np.dot(ht, wo)
  11. yk = np.exp(u0) / np.dot(np.exp(u0), np.exp(u0).transpose())
  12.  
  13. print yk
  14.  
  15. [[ 0.14522021 0.09623482 0.11615102 0.11297892 0.15114373 0.12464769 0.12064487 0.1466973 ]]
Add Comment
Please, Sign In to add comment