<filename>src/rte_pac/train_condition_LSTM.py
import argparse
# from universal_embedding.embedding import embed_sentences
from utils.data_reader import embed_data_sets_with_glove_concat
# from baseline.common.util.log_helper import LogHelper
from common.util.log_helper import LogHelper
from deep_models.CondtionLSTM import ConditionLSTM


if __name__ == '__main__':
    LogHelper.setup()
    logger = LogHelper.get_logger('train')
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--train', help='/path/to/training/set', required=True)
    parser.add_argument(
        '--valid', help='/path/to/validation/set', required=True)
    parser.add_argument('--save', help='/path/to/save/model')
    parser.add_argument('--db', help='/path/to/data/base', required=True)
    parser.add_argument(
        '--max-sent', type=int, help='Maximal number of sentences per claim', default=5)
    parser.add_argument('--embed', help='/path/to/embedding', required=True)
    args = parser.parse_args()
    paths = [args.train, args.valid]
    dataset_list, vocab, embeddings = embed_data_sets_with_glove_concat(
        paths, args.db, args.embed)
    # X_train, Y_labels_train, embeddings = embed_data_sets_with_glove(
    #     args.train, args.db, args.embed)
    # X_valid, Y_labels_valid, _ = embed_data_sets_with_glove(
    #     args.valid, args.db, args.embed)
    # X_claims_embedding = embed_sentences(X_claims)
    # X_evidences_embedding = []
    # for evidences in X_evidences:
    #     evidences_embedding = embed_sentences(evidences)
    # logger.debug(X_train['b'][100])
    # USE_mlp = USEMLP()
    # USE_blstm = USEBiLSTM(random_state=55, tensorboard_logdir="logdir/",
    #                       dropout_rate=0.15, learning_rate=0.0001, batch_size=32)
    # USE_blstm.fit(X_train, Y_labels_train, X_valid, Y_labels_valid)
    condLSTM = ConditionLSTM(random_state=55, tensorboard_logdir="logdir/", dropout_rate=0.15, learning_rate=0.0001,
                             batch_size=32, num_neurons=[300, 200, 100], mlp_layers=2, embedding=embeddings, lstm_layers=1, show_progress=1)
    condLSTM.fit(dataset_list[0]['data'], dataset_list[0]['label'],
                 dataset_list[1]['data'], dataset_list[1]['label'])

<filename>src/rte_pac/train_condition_LSTM.py
import argparse
# from universal_embedding.embedding import embed_sentences
from utils.data_reader import embed_data_sets_with_glove_concat
# from baseline.common.util.log_helper import LogHelper
from common.util.log_helper import LogHelper
from deep_models.CondtionLSTM import ConditionLSTM


if __name__ == '__main__':
    LogHelper.setup()
    logger = LogHelper.get_logger('train')
    parser = argparse.ArgumentParser()
    parser.add_argument(
        '--train', help='/path/to/training/set', required=True)
    parser.add_argument(
        '--valid', help='/path/to/validation/set', required=True)
    parser.add_argument('--save', help='/path/to/save/model')
    parser.add_argument('--db', help='/path/to/data/base', required=True)
    parser.add_argument(
        '--max-sent', type=int, help='Maximal number of sentences per claim', default=5)
    parser.add_argument('--embed', help='/path/to/embedding', required=True)
    args = parser.parse_args()
    paths = [args.train, args.valid]
    dataset_list, vocab, embeddings = embed_data_sets_with_glove_concat(
        paths, args.db, args.embed)
    # X_train, Y_labels_train, embeddings = embed_data_sets_with_glove(
    #     args.train, args.db, args.embed)
    # X_valid, Y_labels_valid, _ = embed_data_sets_with_glove(
    #     args.valid, args.db, args.embed)
    # X_claims_embedding = embed_sentences(X_claims)
    # X_evidences_embedding = []
    # for evidences in X_evidences:
    #     evidences_embedding = embed_sentences(evidences)
    # logger.debug(X_train['b'][100])
    # USE_mlp = USEMLP()
    # USE_blstm = USEBiLSTM(random_state=55, tensorboard_logdir="logdir/",
    #                       dropout_rate=0.15, learning_rate=0.0001, batch_size=32)
    # USE_blstm.fit(X_train, Y_labels_train, X_valid, Y_labels_valid)
    condLSTM = ConditionLSTM(random_state=55, tensorboard_logdir="logdir/", dropout_rate=0.15, learning_rate=0.0001,
                             batch_size=32, num_neurons=[300, 200, 100], mlp_layers=2, embedding=embeddings, lstm_layers=1, show_progress=1)
    condLSTM.fit(dataset_list[0]['data'], dataset_list[0]['label'],
                 dataset_list[1]['data'], dataset_list[1]['label'])

# from universal_embedding.embedding import embed_sentences # from baseline.common.util.log_helper import LogHelper # X_train, Y_labels_train, embeddings = embed_data_sets_with_glove( #     args.train, args.db, args.embed) # X_valid, Y_labels_valid, _ = embed_data_sets_with_glove( #     args.valid, args.db, args.embed) # X_claims_embedding = embed_sentences(X_claims) # X_evidences_embedding = [] # for evidences in X_evidences: #     evidences_embedding = embed_sentences(evidences) # logger.debug(X_train['b'][100]) # USE_mlp = USEMLP() # USE_blstm = USEBiLSTM(random_state=55, tensorboard_logdir="logdir/", #                       dropout_rate=0.15, learning_rate=0.0001, batch_size=32) # USE_blstm.fit(X_train, Y_labels_train, X_valid, Y_labels_valid)