Skip to content

Commit 26914e4

Browse files
committed
Add a parameter to make the test set smaller
1 parent 906a30e commit 26914e4

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

code/lstm.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -395,6 +395,7 @@ def train_lstm(
395395
use_dropout=True, # if False slightly faster, but worst test error
396396
# This frequently need a bigger model.
397397
reload_model="", # Path to a saved model we want to start from.
398+
test_size=-1, # If >0, we will trunc the test set to this number of example.
398399
):
399400

400401
# Model options
@@ -406,6 +407,8 @@ def train_lstm(
406407
print 'Loading data'
407408
train, valid, test = load_data(n_words=n_words, valid_portion=0.05,
408409
maxlen=maxlen)
410+
if test_size > 0:
411+
test = (test[0][:test_size], test[1][:test_size])
409412

410413
ydim = numpy.max(train[1]) + 1
411414

@@ -578,4 +581,5 @@ def train_lstm(
578581
train_lstm(
579582
#reload_model="lstm_model.npz",
580583
max_epochs=100,
584+
test_size=500,
581585
)

0 commit comments

Comments
 (0)