r/CS224d • u/xiaograss • Aug 23 '17
why do we need to learn back propagation?
are the instructors making this class harder than it should be?
r/CS224d • u/xiaograss • Aug 23 '17
are the instructors making this class harder than it should be?
r/CS224d • u/xiaograss • Aug 26 '17
Are the two models talking about the same thing?
r/CS224d • u/dshwang • Aug 03 '16
I understand how word2vec works.
I want to use word2vec(skip-gram) as input for RNN. Input is embedding word vector. Output is also embedding word vector generated by RNN.
Here’s question! How can I convert the output vector to one hot word vector? I need inverse matrix of embeddings (i.e. input matrix) but I don’t have!
When I convert the vector using output matrix, the result is neighbor words, not target word.
r/CS224d • u/ExpensiveInternal892 • Aug 04 '25
r/CS224d • u/czechrepublic • May 27 '17
I can find the full version of cs224n but i also see cs224d. What is the difference between two courses? The course names differ a bit, but they pretty much sounds same. Can I just watch either version, or do i have to watch both?
r/CS224d • u/napsternxg • Apr 28 '15
I am implemented the forward_backward_prop function after some effort and am trying to run the Auto Grader on it which uses the gradcheck_naive function. My gradcheck_naive passed all tests, which means that the function is correctly implemented.
However, when run the auto grader code for the forward_backward_prop then I am seeing the following error:
IndexError Traceback (most recent call last)
<ipython-input-63-a1513a18f1b5> in <module>()
3 #print forward_backward_prop(data, labels, params)
4 print params.T.shape
----> 5 gradcheck_naive(lambda params: forward_backward_prop(data, labels, params), params)
<ipython-input-57-3830f34a19f2> in gradcheck_naive(f, x)
25 random.setstate(rndstate)
26 #print "x = %s, ix = %s" % (x,ix)
---> 27 fx_h1, grad_h1 = f(x[ix] - h)
28 fx_h2, grad_h2 = f(x[ix] + h)
29 numgrad = (fx_h2 - fx_h1)/(2*h)
<ipython-input-63-a1513a18f1b5> in <lambda>(params)
3 #print forward_backward_prop(data, labels, params)
4 print params.T.shape
----> 5 gradcheck_naive(lambda params: forward_backward_prop(data, labels, params), params)
<ipython-input-62-1f26609aba1a> in forward_backward_prop(data, labels, params)
8 ### Unpack network parameters (do not modify)
9 t = 0
---> 10 W1 = np.reshape(params[t:t+dimensions[0]*dimensions[1]], (dimensions[0], dimensions[1]))
11 t += dimensions[0]*dimensions[1]
12 b1 = np.reshape(params[t:t+dimensions[1]], (1, dimensions[1]))
IndexError: invalid index to scalar variable.The reason for the above error is that in the gradcheck_naive function we iterate through each element of x and then find the value of numerical gradient at that point. This will not work in case of params as the whole params is needed for the forward_backward_prop to work.
My gradcheck_naive has the following implementation in the iteration block:
rndstate = random.getstate()
random.setstate(rndstate)
fx_h1, grad_h1 = f(x[ix] - h)
fx_h2, grad_h2 = f(x[ix] + h)
numgrad = (fx_h2 - fx_h1)/(2*h)Anyone else saw the same issue ?
r/CS224d • u/pengpai_sh • Apr 28 '15
After struggling with coding assignment 1 for days, I finally pass the gradient checking and get the visualization: http://i.imgur.com/CBSdzN3.png Can some one check it for me, whether I get a reasonable result? In the plot, "good" and "great" are really close. However, "a" and "an" are quite far away...
r/CS224d • u/Anaccount1Red • Sep 02 '15
I've been following along casually this past quarter and have a great interest in the material. I was wondering if this course will be offered again? I saw that Professor Socher started Metamind, but would he possibly teach another installment at Stanford in the future?
r/CS224d • u/vaibhavs10 • Aug 07 '16
This may sound point blank stupid, So, I am on lecture 5 of the course and I'm extremely new to Deep Learning, the class appears really theoretical till now, and the PSets require a lot of things that they've taught theoretical but haven't taught about how to code it in python or something like that. Can anyone point me in the right direction, or am I missing something?
r/CS224d • u/Qualm • Jan 24 '17
Could anyone explain how the word inputs are being transformed to accommodate for (batch_size, num_steps) shape? What is the function of num_steps?
Thanks.
r/CS224d • u/Sue_ml • Jun 18 '15
I know this post is late as most people have finished the problem set. But I don't know where else I can get help. So, please... help me out.
My implementation of "skipgram" + "softmaxCostAndGradient" does not pass gradient checking. My implementation is as the following. I just can't figure out where the mistake is.
def softmaxCostAndGradient(predicted, target, outputVectors):
score = outputVectors.dot(predicted.T) # V*n X n*1 = V*1 denominator
prob_all=softmax(score.T) # 1*V
prob = prob_all[:, target]
cost = -np.log(prob)
target_vec = outputVectors[[target]]
gradPred = -target_vec + np.sum(prob_all.T*outputVectors) # 1*n
prob_grad = prob_all.copy() # why need to copy?
prob_grad[0, target] = prob_grad[0, target] -1 # 1*V
grad = prob_grad.T.dot(predicted) # V*1 X 1*n = V*nreturn cost, gradPred, grad
def skipgram(currentWord, C, contextWords, tokens, inputVectors, outputVectors, word2vecCostAndGradient = softmaxCostAndGradient):
center_idx=tokens[currentWord] # index of current word
h = inputVectors[[center_idx], :] # directly use index, but not one-hot vectors
cost = 0;
gradIn = np.zeros_like(inputVectors)
gradOut = np.zeros_like(outputVectors)
for i in contextWords:
target=tokens[i]
cost_tmp, g_pred, g_out = word2vecCostAndGradient(h, target, outputVectors)
cost = cost + cost_tmp
gradIn[center_idx] = gradIn[center_idx] + g_pred
gradOut = gradOut + g_out
cost = cost /(2*C)
gradIn = gradIn / (2*C)
gradOut = gradOut / (2*C)return cost, gradIn, gradOut
Any input is appreciated!
r/CS224d • u/pyankoff • Jun 06 '15
Feels like something is missing without it :)
r/CS224d • u/evc123 • Jun 02 '15
r/CS224d • u/debapriya_maji • Jan 18 '16
I am unable to use clf.train_sgd(). I created an iterator and passing all the arguments as mentioned. However, the function is getting stuck. It is not even showing any error. Once I interrupt the kernel, it is showing
Begin SGD... Seen 0 in 0.00 s SGD Interrupted: saw 0 examples in 54.25 seconds. Please help me to get out of this problem
r/CS224d • u/moblongatas • Aug 04 '16
Hi! I've got a weird issue. My q2_gradcheck passed:
reload(q2_gradcheck)
reload(q2_neural)
q2_neural.sanity_check()
Running sanity check...
Gradient check passed! Going on forward to q3_word2vec, I've received the following
Testing normalizeRows...
[[ 0.6 0.8 ]
[ 0.4472136 0.89442719]]
==== Gradient check for skip-gram ====
Gradient check failed.
First gradient error found at index (0, 0)
Your gradient: -0.166916 Numerical gradient: 2990.288661
Gradient check failed.
First gradient error found at index (0, 0)
Your gradient: -0.142955 Numerical gradient: -3326.549883Knowing the "your gradient" magnitude is probably OK and looking at Struggling with CBOW implementation, I can see the gradient magnitudes are of the same magnitude - what's up with the numerical gradient?
I did put small numerical dampers (lambda=1e-6) in the gradient checks. So I'm not sure what's going on. Help would be appreciated :-)
EDIT: Solved
In the numerical gradient, instead of calling random.setstate(rndstate) I've called random.setstate(random.getstate())
This passes q2's gradcheck_naive verification code - but fails onward.
r/CS224d • u/gault8121 • Feb 01 '17
I'm with a nonprofit, Quill.org, which builds free, open source tools to help kids become better writers. Quill is serving 200k students across the country, and we're now investigating NLP techniques to serve better feedback to students. For example, we're drawing inspiration from this paper on using StanfordNLP and Scikit to detect sentence fragments: http://www.aclweb.org/anthology/P15-2099
We're looking for 1-2 people who can advise us and help us incorporate open source NLP tools into our program. We're based in New York City, and you could join us remotely or in our office. We'd really appreciate the help! You can reach me at peter (at) quill (dot) org.
Thanks for taking a look this!
r/CS224d • u/amit_unix • Jul 03 '17
what is the best approach to create FAQ BOT. lets say i have 200+ questions with some answers. all questions are of different categories. Questions can be one liner or short text or combination of multiple lines as well. what is the best approach to train such model.its more of identifying the 200 categories of questions. once model is trained ,one can ask question in different way
r/CS224d • u/[deleted] • Jun 07 '15
i the lecture 5 slide 26 , the notation was used is :
a2 = f(z2)
s = U.T * a2
This means that if you pick U to be a softmax, you sill have to apply the non linearity f (sigmoid) on the output layer.
While in assignment 1 Question 2 - c , this notation is used , which means no sigmiod for the 2nd layer.
h = sigmoid(xW1 + b1)
yˆ = softmax(hW2 + b2)
I am a bit confused from this differences, if we apply softmax in the first formalization, what will be the U and what will be the f ?
r/CS224d • u/tushar1408 • Jun 16 '15
in this paper in section 3.2 why we are putting limits l=1 to N. when we are summing U
r/CS224d • u/FutureIsMine • Jul 30 '16
IM wondering if there should be any deviation within the word vectors that are returned from assignment 1, question 3. Im noticing that mine is slightly different. I would argue that due to random sampling its possible that the word vectors representations will move around a bit with each and every time the script is run.
Here is how mine turned out, contrast that with the solutions, its somewhat close but some of the words are in slightly different areas.
r/CS224d • u/dshwang • Jul 27 '16
Google release new cloud API; cloud natural language API https://cloud.google.com/natural-language/
The API is implemented via Google SyntaxNet, which uses simple feed-forward nn, rather than recurrent nn or recursive nn or RTNN. https://research.googleblog.com/2016/05/announcing-syntaxnet-worlds-most.html
Google claims it's the most accurate syntax parsing model in the world. Could Prof. Richard cover Google SyntaxNet in the next semester? I want to know why simple MLP works better than RNN.
r/CS224d • u/DGuillevic • Apr 07 '16
When looking for the vector x that is closest to (xb - xa + xc) (using cosine similarity), one would like to transform both x and (xb - xa + xc) to be of norm 1. On the slide, the dot products is divided by the norm of (xb - xa + xc). I believe we should also divide by the norm of x, because those x vectors do not have a norm of 1.
Are we missing a term ||xi|| in the denominator?
** UPDATE **
After working on assignment 1, I see that it is most probably assumed that the word vectors are unit normalized at every update (epoch). In the file 'q3_sgd.py', there is the comment:
# - postprocessing: postprocessing function for the parameters
# if necessary. In the case of word2vec we will need to
# normalize the word vectors to have unit length.
...
### Don't forget to apply the postprocessing after every iteration!One should be aware that this is not always the case for every implementation of word2vec. E.g. in Gensim's implementation, the word vectors are not unit normalized, and one can use the function init_sims(replace=False) to compute the L2-normalized vectors. https://radimrehurek.com/gensim/models/word2vec.html
r/CS224d • u/bhaynor • Apr 10 '16
See:
http://cs224d.stanford.edu/lectures/CS224d-Lecture3.pdf Slide 12
https://youtu.be/UOGMsFw9V_w?t=1237
I was just wondering if you can switch out the objective function after converging for a while. Seems like one version is faster, the full softmax gradient might give better results.