From 6e6fdde7a0f5da7225a1ad1b18f561fa0b39a2b2 Mon Sep 17 00:00:00 2001 From: arthur_fyc Date: Sat, 10 Feb 2018 13:02:32 +0800 Subject: [PATCH] add python --- AH.py => python/AH.py | 4 ++-- AMTA.py => python/AMTA.py | 6 +++--- ARNN.py => python/ARNN.py | 6 +++--- DARNN.py => python/DARNN.py | 6 +++--- LR.py => python/LR.py | 6 +++--- loadCriteo.py => python/loadCriteo.py | 0 model_config.py => python/model_config.py | 0 wrapped_loadCriteo.py => python/wrapped_loadCriteo.py | 0 8 files changed, 14 insertions(+), 14 deletions(-) rename AH.py => python/AH.py (98%) rename AMTA.py => python/AMTA.py (99%) rename ARNN.py => python/ARNN.py (99%) rename DARNN.py => python/DARNN.py (99%) rename LR.py => python/LR.py (97%) rename loadCriteo.py => python/loadCriteo.py (100%) rename model_config.py => python/model_config.py (100%) rename wrapped_loadCriteo.py => python/wrapped_loadCriteo.py (100%) diff --git a/AH.py b/python/AH.py similarity index 98% rename from AH.py rename to python/AH.py index 560c819..72023ed 100644 --- a/AH.py +++ b/python/AH.py @@ -189,8 +189,8 @@ def test(beta, omega, num_of_channel, test_data): num_of_epoches = 20 -train_path = 'data/train_usr.yzx.txt' -test_path = 'data/test_usr.yzx.txt' +train_path = '../data/train_usr.yzx.txt' +test_path = '../data/test_usr.yzx.txt' traindata_size = loadCriteo.count(train_path) testdata_size = loadCriteo.count(test_path) diff --git a/AMTA.py b/python/AMTA.py similarity index 99% rename from AMTA.py rename to python/AMTA.py index f5ad3c8..c18db99 100644 --- a/AMTA.py +++ b/python/AMTA.py @@ -343,8 +343,8 @@ def vertical_attr(self, lenth): f_log = open("log_AMTA.txt", 'w') -train_path = 'data/train_usr.yzx.txt' -test_path = 'data/test_usr.yzx.txt' +train_path = '../data/train_usr.yzx.txt' +test_path = '../data/test_usr.yzx.txt' traindata_size = loadCriteo.count(train_path) testdata_size = loadCriteo.count(test_path) num_feat = 5867 @@ -471,6 +471,6 @@ def vertical_attr(self, lenth): exit(1) f_train = open(train_path) f_test = open(test_path) -AMTAModel = AMTA('./Model/AMTA', batchsize=1000, learning_rate=learning_rate) +AMTAModel = AMTA('../Model/AMTA', batchsize=1000, learning_rate=learning_rate) AMTAModel.train_all_epoch() AMTAModel.test() diff --git a/ARNN.py b/python/ARNN.py similarity index 99% rename from ARNN.py rename to python/ARNN.py index e78d654..94d6350 100644 --- a/ARNN.py +++ b/python/ARNN.py @@ -390,8 +390,8 @@ def vertical_attr(self, lenth): if __name__ == '__main__': - traindata = 'data/train_usr.yzx.txt' - testdata = 'data/test_usr.yzx.txt' + traindata = '../data/train_usr.yzx.txt' + testdata = '../data/test_usr.yzx.txt' if len(sys.argv) != 4 and len(sys.argv) != 1: print('usage: python ARNN.py [learning rate] [batch size] [mu]') exit(1) @@ -407,7 +407,7 @@ def vertical_attr(self, lenth): C = config(max_features=5897, learning_rate=learning_rate, batch_size=batch_size, feature_number=12, seq_max_len=20, n_input=2, embedding_output=256, n_hidden=512, n_classes=2, n_epochs=50, isseq=True, miu=mu) - path = './Model/ARNN' + path = '../Model/ARNN' model = RnnWithattention(path, traindata, testdata, C) model.train_until_cov() model.test(0) diff --git a/DARNN.py b/python/DARNN.py similarity index 99% rename from DARNN.py rename to python/DARNN.py index 1ff6970..19be98f 100644 --- a/DARNN.py +++ b/python/DARNN.py @@ -623,8 +623,8 @@ def vertical_attr(self, lenth): if __name__ == '__main__': - traindata = 'data/train_usr.yzx.txt' - testdata = 'data/test_usr.yzx.txt' + traindata = '../data/train_usr.yzx.txt' + testdata = '../data/test_usr.yzx.txt' if len(sys.argv) != 4 and len(sys.argv) != 1: print('usage: python ARNN.py [learning rate] [batch size] [mu]') exit(1) @@ -640,7 +640,7 @@ def vertical_attr(self, lenth): C = config(max_features=5897, learning_rate=learning_rate, batch_size=batch_size, feature_number=12, seq_max_len=20, n_input=2, embedding_output=256, n_hidden=512, n_classes=2, n_epochs=50, isseq=True, miu=mu) - path = './Model/DARNN' + path = '../Model/DARNN' model = DualAttention(path, traindata, testdata, C) model.train_until_cov() model.test(0) diff --git a/LR.py b/python/LR.py similarity index 97% rename from LR.py rename to python/LR.py index f24c4c8..7e429d6 100644 --- a/LR.py +++ b/python/LR.py @@ -100,7 +100,7 @@ def train_one_epoch(self): total_loss = [] pred = [] label = [] - trainfile = open('data/train_usr.yzx.txt', 'rb') + trainfile = open('../data/train_usr.yzx.txt', 'rb') while True: train_X, train_Y = loadLRF(500, 20, 12, trainfile) feed_dict = { @@ -167,7 +167,7 @@ def test(self, epoch): total_loss = [] pred = [] label = [] - file = open('data/test_usr.yzx.txt', 'rb') + file = open('../data/test_usr.yzx.txt', 'rb') while True: train_X, train_Y = loadLRF(500, 20, 12, file) feed_dict = { @@ -230,6 +230,6 @@ def attr(self): else: print 'usage: python LR.py [learning rate]' exit(1) - model = LR_f_criteo("./Model/LR", learning_rate=learning_rate) + model = LR_f_criteo("../Model/LR", learning_rate=learning_rate) model.train_all_epochs() model.test(0) diff --git a/loadCriteo.py b/python/loadCriteo.py similarity index 100% rename from loadCriteo.py rename to python/loadCriteo.py diff --git a/model_config.py b/python/model_config.py similarity index 100% rename from model_config.py rename to python/model_config.py diff --git a/wrapped_loadCriteo.py b/python/wrapped_loadCriteo.py similarity index 100% rename from wrapped_loadCriteo.py rename to python/wrapped_loadCriteo.py