From 0590b9e427079f88f20ecc5e090f17c0030a9441 Mon Sep 17 00:00:00 2001 From: Bob Date: Tue, 22 Jan 2019 01:38:41 -0500 Subject: [PATCH] update --- nlp_class2/neural_network2.py | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/nlp_class2/neural_network2.py b/nlp_class2/neural_network2.py index 1f0be410..573dd9e9 100644 --- a/nlp_class2/neural_network2.py +++ b/nlp_class2/neural_network2.py @@ -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))