-
Notifications
You must be signed in to change notification settings - Fork 218
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using Theano in Word Embedding Method #19
Comments
Seems like
should be:
Am I right? @mesnilgr |
@lucas0 i met the same question.i want to run the code:
but errors happened in emb[idxs].i do not understand why emb[idxs] is correct?i think emb is a matrix,idxs is also a matrix.So why? I would appreciate it if you could give me some tips.thanks. |
Im not sure, but idxs is a matrix of indexes, so it can be used as index of another matrix, like:
a = [7,6,5,4,3,2,1] //a list
b = [1, 3, 4] //a list of idxs
a[b] = [6, 4, 3]
hope it helps a bit.
… On May 11, 2017, at 1:50 PM, Helicqin ***@***.***> wrote:
@lucas0 <https://github.com/lucas0> i met the same question.i want to run the code:
import theano, numpy
from theano import tensor as T
# nv :: size of our vocabulary
# de :: dimension of the embedding space
# cs :: context window size
nv, de, cs = 1000, 50, 5
emb = theano.shared(0.2 * numpy.random.uniform(-1.0, 1.0, \
(nv+1, de)).astype(theano.config.floatX)) # add one for PADDING at the end
idxs = T.imatrix() # as many columns as words in the context window and as many lines as words in the sentence
x = self.emb[idxs].reshape((idxs.shape[0], de*cs))
but errors happened in emb[idxs].i do not understand why emb[idxs] is correct?i think emb is a matrix,idxs is also a matrix.So why?
I would appreciate it if you could give me some tips.thanks.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#19 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/AAr0PGt4jqIZ282ltddECL1yhL9m7OHYks5r4wQtgaJpZM4GcZ4z>.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello,
I'm trying to use your pre-processing methods to feed my LSTM RNN, and I cannot find a way to use the method for creating the Word Embeddings matrixes:
I can do the context window, but the code provided for the Word Embedding generation gives me this error:
I've tried to put the code in another .py file but is of no use, I'm sure it has a simple solution but I can't figure it out. Would you please give me a hand in this?
The text was updated successfully, but these errors were encountered: