Skip to content
Permalink
Browse files

add python

  • Loading branch information...
Arthur-Null committed Feb 10, 2018
1 parent d113474 commit 6e6fdde7a0f5da7225a1ad1b18f561fa0b39a2b2
@@ -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)

@@ -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()
@@ -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)
@@ -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)
@@ -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)
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 comments on commit 6e6fdde

Please sign in to comment.
You can’t perform that action at this time.