Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bob7783 committed Jan 22, 2019
1 parent 877acd6 commit 0590b9e
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions nlp_class2/neural_network2.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,11 +95,14 @@ def softmax(a):
# # for reference:
# # original: W1 = W1 - lr * inputs.T.dot(dhidden) # VxN NxD --> VxD

# fastest way
np.subtract.at(W1, inputs, lr * dhidden)

# test this
i = 0
for w in inputs: # don't include end token
W1[w] = W1[w] - lr * dhidden[i]
i += 1
# i = 0
# for w in inputs: # don't include end token
# W1[w] = W1[w] - lr * dhidden[i]
# i += 1

# vs this
# oh_inputs = np.zeros((n - 1, V))
Expand Down

0 comments on commit 0590b9e

Please sign in to comment.