Skip to content

Commit e4cad43

Browse files
committed
change the way of getting vocsize, nclasses.
with previous way, when training data is big, need many hours.
1 parent 777c75a commit e4cad43

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

Diff for: code/rnnslu.py

+2-4
Original file line numberDiff line numberDiff line change
@@ -288,10 +288,8 @@ def main(param=None):
288288
valid_lex, valid_ne, valid_y = valid_set
289289
test_lex, test_ne, test_y = test_set
290290

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

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

0 commit comments

Comments
 (0)