Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
change the way of getting vocsize, nclasses.
with previous way, when training data is big, need many hours.
  • Loading branch information
stray-leone committed Sep 12, 2015
commit e4cad43f96b52589e7d95a66156f698963c33e09
6 changes: 2 additions & 4 deletions code/rnnslu.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,10 +288,8 @@ def main(param=None):
valid_lex, valid_ne, valid_y = valid_set
test_lex, test_ne, test_y = test_set

vocsize = len(set(reduce(lambda x, y: list(x) + list(y),
train_lex + valid_lex + test_lex)))
nclasses = len(set(reduce(lambda x, y: list(x)+list(y),
train_y + test_y + valid_y)))
vocsize = len(dic['words2idx'])
nclasses = len(dic['labels2idx'])
nsentences = len(train_lex)

groundtruth_valid = [map(lambda x: idx2label[x], y) for y in valid_y]
Expand Down