-
Notifications
You must be signed in to change notification settings - Fork 1
/
main.py
50 lines (38 loc) · 1.14 KB
/
main.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
import numpy as np
import time
import os
import tensorflow as tf
from config import config
from train import train
os.environ["CUDA_DEVICE_ORDER"]="PCI_BUS_ID"
os.environ["CUDA_VISIBLE_DEVICES"]="0"
tfe = tf.contrib.eager
tf.compat.v1.enable_eager_execution()
idx = 0
# dataset file name (except .npz)
config['data'] = 'MNIST_35_val'
config['pi_pl'] = 0.01
config['pi_pu'] = 0.5 - config['pi_pl']
config['pi_u'] = 1 - config['pi_pl']
config['n_h_y'] = 10
config['n_h_o'] = 2
config['lr_pu'] = 3e-4
config['lr_pn'] = 1e-5
config['num_epoch_pre'] = 100
config['num_epoch_step1'] = 400
config['num_epoch_step_pn1'] = 500
config['num_epoch_step_pn2'] = 600
config['num_epoch_step2'] = 500
config['num_epoch_step3'] = 700
config['num_epoch'] = 800
config['n_hidden_cl'] = []
config['n_hidden_pn'] = [300, 300, 300, 300]
config['batch_size_l'], config['batch_size_u'] = (10, 990)
config['batch_size_l_pn'], config['batch_size_u_pn'] = (10, 990)
config['alpha_gen'] = 0.1
config['alpha_disc'] = 0.1
config['alpha_gen2'] = 3
config['alpha_disc2'] = 3
np.random.seed(idx)
tf.set_random_seed(idx)
train(idx, config)