Last active
September 25, 2019 19:44
-
-
Save Blaizzy/a39ba3aec8f17660af1c47d16abf83a1 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ## Numpy implementation of GRU | |
| # Params | |
| ht = [] | |
| for t, xt in enumerate(train_data): | |
| if t == 0: h.append(t) | |
| if t >= 1: | |
| ht_1 = ht[t-1] | |
| zt = sigmoid(np.dot(xt, Wz) + np.dot(ht_1, Uz) + bz) # Update Gate Vector | |
| rt = sigmoid(np.dot(xt, Wr)+ np.dot(ht_1, Ur) + br) # Forget/Reset Gate Vector | |
| ht.append((1 - z) * ht_1 + z * np.tanh(np.dot(xt, Wh) | |
| + np.dot(r * ht_1, Uh) + bh)) # Output Vector |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment