Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # skip-gram learning example
- import numpy as np
- 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]])
- 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]])
- xk = np.array([[0, 1, 0, 0, 0, 0, 0, 0]])
- ht = np.dot(xk, wi)
- u0 = np.dot(ht, wo)
- yk = np.exp(u0) / np.dot(np.exp(u0), np.exp(u0).transpose())
- print yk
- [[ 0.14522021 0.09623482 0.11615102 0.11297892 0.15114373 0.12464769 0.12064487 0.1466973 ]]
Add Comment
Please, Sign In to add comment