-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathrun_UA_plus.py
63 lines (49 loc) · 1.48 KB
/
run_UA_plus.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import tensorflow as tf
from model_UA_plus import *
import tensorflow as tf
import sys
config = {}
# Data info
config['task'] = 'UA+_source_code'
config['num_features'] = 0
config['steps'] = 0
# Model info
config['max_epoch'] = 100
config['num_layers'] = 1
config['hidden_units'] = 33
config['embed_size'] = 33
config['lr'] = 1e-4
config['batch_size'] = 100
config['save_iter'] = 20
config['lamb'] = 0.004
config['num_sampling'] = 30
def main():
path = 'physionet_dataset/1_'
train_x = np.load(path + 'train_x.npy')
train_y = np.load(path + 'train_y.npy')
val_x = np.load(path + 'val_x.npy')
val_y = np.load(path + 'val_y.npy')
eval_x = np.load(path + 'eval_x.npy')
eval_y = np.load(path + 'eval_y.npy')
num_features = train_x.shape[2]
steps = train_x.shape[1]
print('shape of train_x:', train_x.shape)
config['num_features'] = num_features
config['steps'] = steps
config['train_x'] = train_x
config['train_y'] = train_y
config['val_x'] = val_x
config['val_y'] = val_y
config['eval_x'] = eval_x
config['eval_y'] = eval_y
#GPU Option
gpu_usage = 0.95
gpu_options = tf.GPUOptions(per_process_gpu_memory_fraction=gpu_usage)
sess = tf.InteractiveSession(config=tf.ConfigProto(gpu_options=gpu_options))
config['sess'] = sess
with tf.Session() as sess:
model = UA_plus(config)
model.build_model()
model.run()
if __name__ == '__main__':
main()