-
Notifications
You must be signed in to change notification settings - Fork 134
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
Sequential output #5
Comments
Agreed, an example would be nice - setting the seq_output argument to any of the recurrent layers to true should work but I've only tested this for language modeling with softmax output. Do you have a suggestion for a good sequence prediction dataset for NER or POS or something else that the example can be trained with? |
Actually, language modeling would be one good example, as training data is practically unlimited. For NER, the most commonly used English is the CoNLL 2003 data (http://www.cnts.ua.ac.be/conll2003/ner/). The annotations are publicly available; the corresponding text is available free of charge from NIST. For Spanish and Dutch, there are publicly available NER data from CoNLL 2002: http://www.cnts.ua.ac.be/conll2002/ner/ |
I've tried to make this work using
I get a dimension mismatch when compiling this |
It looks like they have the sequence labelling there as an option with seq_output=True. Can someone provide a working examples using some dummy data or provided data as to how to make that work? |
Update on this, clean output sequence support starts to get into a rabbit hole of re-factoring and/or interface ugliness that's still being figured out. Alpha support is working on the Still chewing on this one to figure out the best way forward without compromising ease of use or overly complicating codebase/interface. Have a feeling we're going to start making specific classes like Here's an example for langauge modeling using a softmax output and training on fixed length context sequences from a collection of documents: from passage.preprocessing import Tokenizer
from passage.layers import Embedding, GatedRecurrent, Dense
from passage.models import RNN
from passage.theano_utils import intX
from passage.iterators import SortedPadded
trX = load_list_of_text_documents()
tokenizer = Tokenizer(min_df=10, character=False, max_features=10000)
trX = tokenizer.fit_transform(trX)
trY = [x[1:][:100] for x in trX]
trX = [x[:-1][:100] for x in trX]
layers = [
Embedding(size=512, n_features=tokenizer.n_features),
GatedRecurrent(size=512, seq_output=True),
Dense(size=tokenizer.n_features, activation='softmax')
]
iterator = SortedPadded(y_pad=True, y_dtype=intX)
model = RNN(layers=layers, cost='seq_cce', iterator=iterator, Y=T.imatrix())
model.fit(trX, trY, n_epochs=1) Let me know if you have any suggestions on api/changes. |
Thanks! I like the idea of having separate classes, e.g. |
Hi there, I'm building an RNN to assign a label for each element in the sequence (according to this blog post!) for activity recognition based on location. Assume the shape of each input location is 4x1, and the sequence of length n has a shape of 10xn. How would I setup the layers in the RNN? Is my input the Embedding layer and the output the Dense layer? Thanks! |
It would be helpful to have an example of a network configuration where a label is predicted for each element in the sequence. This is a common scenario in NLP (e.g. named entity recognition).
The text was updated successfully, but these errors were encountered: