-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathconfig_degc.py
190 lines (172 loc) · 12.7 KB
/
config_degc.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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
import argparse
def parse_arguments():
parser = argparse.ArgumentParser(description='Reinforced Graph Continual learning')
parser.add_argument("-d", "--dataset", type=str, default="Taobao2014", help="Dataset string")
parser.add_argument("-bm", "--base_model", type=str, default="MGCCF")
parser.add_argument("-alg", "--algorithm", type=str, default="DEGC")
parser.add_argument("-ptd", "--pretrain_data", type=bool, default=True)
parser.add_argument("-graph_path", "--graph_path", type=str, default="./graph_log/",
help="data_path to save user_user or item_item self neighbors")
parser.add_argument("-load_save_path_prefix", "--load_save_path_prefix", type=str, default='./model_log/',
help="upper-level folder for saved models")
parser.add_argument("-log_folder", "--log_folder", type=str, default='.')
parser.add_argument("-log", "--log_name", type=str, default='')
parser.add_argument("-log_files", "--log_files", type=str,
default='recall_logs', help='saved path for result logging')
parser.add_argument("-se", "--setting", type=str, default="no_adjust", help="Setting name of saved weights")
#Data Processing
#parser.add_argument("-data_split", "--data_split", default='[0.6,3,0.1]',
# help='[a,b,c] a is the portion of first block, c is the portion of the last block, b is the numebr blocks in the middle')
#parser.add_argument("-n_inc", "--n_inc", default=0, type=int, help='train n incremental blocks consecutively')
parser.add_argument("-valid_test_ratio", "--valid_test_ratio", type=float, default=0.2)
parser.add_argument("-test_ratio", "--test_ratio", type=float, default=0.5)
parser.add_argument("-first_segment_time", "--first_segment_time", type=int, default=18)
#Taobao2014: 18
#Taobao2015: 2
#Foursquare: 4
#Netflix: 13 (novalid data when set as 11 or 12)
#Alimama: 25
parser.add_argument("-last_segment_time", "--last_segment_time", type=int, default=48)
#Taobao2014: 48
#Taobao2015: 31
#Foursquare: 25
#Netflix: 84
#Alimama: 33
# Running experiment
parser.add_argument("-de", "--device", type=str, default='')
parser.add_argument("-seed", "--seed", type=int, default=0)
# model args
parser.add_argument("-l2", "--l2", type=float, default=0.02, help="weight decay of embeddings")
parser.add_argument("-dist_embed", "--dist_embed", type=float, default=0.002, help="weight decay of distance term")
parser.add_argument("-e", "--num_epoch", type=int, default=25)
parser.add_argument("-min_epoch","--min_epoch", type=int, default=8)
# # optimizer args (adam by default)
parser.add_argument("-lr", "--learning_rate", type=float, default=1e-3)
parser.add_argument("-eps", "--epsilon", type=float, default=1e-8)
# # GCN hyper-parameters
parser.add_argument("-act", "--activation", type=str, default='tf.nn.tanh',
choices=['tf.nn.relu', 'tf.nn.tanh'])
parser.add_argument("-emb", "--embedded_dimension", type=str, default='[128, 128, 128]')
# [128, 128, 128]
parser.add_argument("-wg_dimension", "--wg_dimension", type=int, default=64, help='hidden dimension for weight generator')
parser.add_argument("-wg_act", "--wg_act", type=str, default='tf.nn.relu', help='activation function for weight generator')
parser.add_argument("-ndrop", "--neighbor_dropout", type=float, default=0.1)
parser.add_argument("-g", "--gcn_sample", default='[10, 5]', help='the number of sampled [1-hop, 2-hop] neighbours')
parser.add_argument('-n_neigh', "--num_neigh", type=int, default=5,
help='the number of positive neighbors for contrastive loss')
#15
parser.add_argument('-n_self_neigh', "--num_self_neigh", type=int, default=5,
help='the number of positive neighbors user_user of item_item_graph')
#15
parser.add_argument('-con_positive', "--con_positive", type=int, default=5,
help='the number of positive neighbors used for contrastive loss for users')
parser.add_argument('-con_negative', "--con_negative", type=int, default=5,
help='the number of negative neighbors used for contrastive loss for users')
##############################################################################################
parser.add_argument('-ui_con_positive', "--ui_con_positive", type=int, default=5,
help='the number of positive neighbors used for contrastive loss for users')
parser.add_argument('-con_ratios','--con_ratios',type=str,default='[1,1,1,1,1,1,1]',
help = 'the relative ratio of number of neighbor terms for contrastive loss')
parser.add_argument('-ui_con_negative', "--ui_con_negative", type=int, default=5,
help='the number of negative neighbors used for contrastive loss for users')
parser.add_argument('-iu_con_positive', "--iu_con_positive", type=int, default=5,
help='the number of positive neighbors used for contrastive loss for items')
parser.add_argument('-iu_con_negative', "--iu_con_negative", type=int, default=5,
help='the number of negative neighbors used for contrastive loss for items')
parser.add_argument('-uu_con_positive', "--uu_con_positive", type=int, default=5,
help='the number of positive neighbors used for contrastive loss for users')
parser.add_argument('-uu_con_negative', "--uu_con_negative", type=int, default=5,
help='the number of negative neighbors used for contrastive loss for users')
parser.add_argument('-ii_con_positive', "--ii_con_positive", type=int, default=5,
help='the number of positive neighbors used for contrastive loss for users')
parser.add_argument('-ii_con_negative', "--ii_con_negative", type=int, default=5,
help='the number of negative neighbors used for contrastive loss for users')
parser.add_argument('-include_self', "--include_self", type=int, default=0,
help='whether to sample self node as positive neighbors for contrastive ;pss')
parser.add_argument('-trans_positive', "--trans_positive", type=int, default=10,
help='the number of positive neighbors used for calculate user weights using single transform')
parser.add_argument('-n_cluster_points', "--n_cluster_points", type=int, default=60,
help='the number of points selected in each cluster')
# training args
parser.add_argument("-b", "--batch_pairs", type=int, default=1000,
help='the size of a mini-batch of positive pairs')
#5000
parser.add_argument("-b_eval", "--batch_evaluate", type=int, default=1000)
#20000
parser.add_argument("-neg", "--num_neg", type=int, default=10,
help='number of negative paris for each positve pair in bpr loss')
parser.add_argument('-max', '--max_degree', default=128, type=int, choices=[64, 128, 256],
help='fixed number of neighbours for each node')
parser.add_argument("-patience", "--patience", type=int, default=2)
parser.add_argument("-nu", "--nu", type=float, default=1)
# streaming args
parser.add_argument("-load_cp", "--load_cp", type=str, default='')
parser.add_argument("-save_cp", "--save_cp", type=str, default='')
parser.add_argument("-emb_a", "--emb_a", type=str, default='', help='used for embedding concat')
parser.add_argument("-emb_b", "--emb_b", type=str, default='', help='used for embedding concat')
parser.add_argument("-block", "--block", type=int, default=0)
parser.add_argument("-train_mode", "--train_mode", type=str, default='sep', help='\'acc\' uses accumulated data until current block,\
\'sep\' uses the current block only for training')
parser.add_argument("-inc_full_batch", "--inc_full_batch", action='store_true')
parser.add_argument("-mse", "--lambda_mse", type=float, default=0) # default=100
parser.add_argument("-lambda_contrastive", '--lambda_contrastive', type=str, default='[0,0,0]')
parser.add_argument("-lambda_layer_l2", '--lambda_layer_l2', type=str, default='[0,0,0]')
parser.add_argument("-lambda_soft", '--lambda_soft', type=float, default=0)
parser.add_argument("-local_distill", "--lambda_distillation", type=float, default=0)
parser.add_argument("-local_mode", '--local_mode', type=str, default='local_anchor')
parser.add_argument("-contrastive_mode", '--contrastive_mode', type=str, default='')
parser.add_argument("-layer_l2_mode", '--layer_l2_mode', type=int, default=0)
parser.add_argument("-adaptive_mode", '--adaptive_mode', type=str, default='')
parser.add_argument("-layer_wise", '--layer_wise', type=int, default=0)
parser.add_argument("-center_initialize", '--center_initialize', type=int, default=0)
parser.add_argument("-soft_center", '--soft_center', type=int, default=0)
parser.add_argument("-global_distill", "--lambda_global_distill", type=float, default=0)
parser.add_argument("-global_k", "--k_centroids", type=str, default='[0,0]') # [50, 50]
parser.add_argument("-global_tau", "--tau", type=float, default=0.5)
parser.add_argument("-alpha", "--alpha", type=float, default=0) # [50, 50]
parser.add_argument("-distill_mode", "--distill_mode", type=str, default='inner_product',
help='the distance metric used in graph distillation',
choices=['', 'euc', 'inner_product', 'rbf', 'poly'])
parser.add_argument("-new_node_init", "--new_node_init", type=str, default='', choices=['', '2hop_mean'])
# Reservoir
"""
parser.add_argument("-rs", "--reservoir_mode", type=str, default='',
choices=['full', 'sliding', 'reservoir_sampling'])
parser.add_argument("-sliding_ratio", "--sliding_ratio", type=float, default=0)
parser.add_argument("-replay_ratio", "--replay_ratio", type=float, default=0)
parser.add_argument('-union_mode', '--union_mode', type=str, default='snu', choices=['uns', 'snu'])
parser.add_argument('-sampling_mode', '--reservoir_selection', type=str, default='',
choices=['', 'uniform', 'boosting_inner_product', 'inverse_deg', 'prop_deg', 'latest',
'boosting_wasserstein', 'mse_distill_score', 'adp_inverse_deg', 'item_embedding'])
parser.add_argument("-inc_agg", '--inc_agg', type=int, default=0)
parser.add_argument("-adaptive_reservoir", '--adaptive_reservoir', type=str, default='')
"""
# irrelevent args, do not need to touch for our experiment setup
parser.add_argument('-test_split', action='store_true',
help='for each data block, split the block into test/valid sets')
parser.add_argument('-shuffle', action='store_true', help='use shuffled dataset')
parser.add_argument("-test_mode", "--test_mode", type=str, default='sep',
help='specify which block is used as test set, should be an integer')
# model parameters
parser.add_argument('--n_hiddens', type=str, default='312,218',
help='number of hidden neurons at each layer')
parser.add_argument('--n_layers', type=int, default=2,
help='number of hidden layers')
# experiment parameters
parser.add_argument('--save_path', type=str, default='./DEGC_results/',
help='save models at the end of training')
parser.add_argument('--max_trials', type=int, default=50,
help='max_trials')
# data parameters
parser.add_argument('--state_space', type=int, default=30, help="the state space for search")
parser.add_argument('--actions_num', type=int, default=2, help="how many actions to dscide")
parser.add_argument('--hidden_size', type=int, default=100, help="the hidden size of RNN")
parser.add_argument('--num_layers', type=int, default=2, help="the layer of a RNN cell")
parser.add_argument('--cuda', type=bool, default=True, help="use GPU or not")
parser.add_argument('--bendmark', type=str, default='critic', help="the type of bendmark")
parser.add_argument('--reward_coefficient', type=int, default=10, help="the type of bendmark")#0.0001
parser.add_argument('--penalty', type=float, default=0.0001, help="the type of bendmark")#0.0001
parser.add_argument('--optimizer', type=str, default="adam", help="the type of optimizer")#
parser.add_argument('--method', type=str, default='policy', help="method for generate actions")
parser = parser.parse_args()
return parser