Exemplo n.º 1
0
        model.middle_dropout_keep_prob: 1 - middle_dropout,
        model.input_dropout_keep_prob: 1 - input_dropout,
        model.l2_penalty: l2,
        model.drop_penalty: regularize_drop_penalty
    }
    lstm_feed.update(char_embedding_feed)

    run_list = [train_op, model.loss]
    _, loss = sess.run(run_list, feed_dict=lstm_feed)

    return loss


epochs = 6000

train_batches_weak = dp.get_batches('cdr_train_weak', batch_size, random=False)
train_batches_cdr = dp.get_batches('cdr_train', batch_size, random=False)
train_batches_bc = dp.get_batches('bc_train', batch_size, random=False)

dev_batches_cdr = dp.get_batches('cdr_dev', batch_size, random=False)
dev_batches_bc = dp.get_batches('bc_dev', batch_size, random=False)

test_batches_cdr = dp.get_batches('cdr_test', batch_size, random=False)
test_batches_bc = dp.get_batches('bc_test', batch_size, random=False)

max_f1 = 0
epoch_last_saved = 0
last_saved = 'N/A'
for i in range(epochs):
    batches_weak = dp.get_batches('cdr_train_weak', batch_size)
    batches_cdr = dp.get_batches('cdr_train', batch_size)
Exemplo n.º 2
0
        model.middle_dropout_keep_prob: 1 - middle_dropout,
        model.input_dropout_keep_prob: 1 - input_dropout,
        model.l2_penalty: l2,
        model.drop_penalty: regularize_drop_penalty
    }
    lstm_feed.update(char_embedding_feed)

    run_list = [train_op, model.loss]
    _, loss = sess.run(run_list, feed_dict=lstm_feed)

    return loss


epochs = 6000

train_batches_A = dp.get_batches('A_train', batch_size, random=False)
train_batches_B = dp.get_batches('B_train', batch_size, random=False)

dev_batches = dp.get_batches('dev', batch_size, random=False)
test_batches = dp.get_batches('test', batch_size, random=False)

max_f1 = 0
epoch_last_saved = 0
last_saved = 'N/A'
for i in range(epochs):
    batches_A = dp.get_batches('A_train', batch_size)
    batches_B = dp.get_batches('B_train', batch_size)

    l = min(len(batches_A), len(batches_B))

    for j in range(l):