def load_er_data(): frac_train = 0.9 pattern = 'nrange-%d-%d-n_graph-%d-p-%.2f' % ( cmd_args.min_n, cmd_args.max_n, cmd_args.n_graphs, cmd_args.er_p) num_train = int(frac_train * cmd_args.n_graphs) train_glist = [] test_glist = [] label_map = {} for i in range(cmd_args.min_c, cmd_args.max_c + 1): cur_list = load_pkl( '%s/ncomp-%d-%s.pkl' % (cmd_args.data_folder, i, pattern), cmd_args.n_graphs) assert len(cur_list) == cmd_args.n_graphs train_glist += [S2VGraph(cur_list[j], i) for j in range(num_train)] test_glist += [ S2VGraph(cur_list[j], i) for j in range(num_train, len(cur_list)) ] label_map[i] = i - cmd_args.min_c cmd_args.num_class = len(label_map) cmd_args.feat_dim = 1 print('# train:', len(train_glist), ' # test:', len(test_glist)) return label_map, train_glist, test_glist
def load_graphs(): frac_train = 0.9 pattern = 'nrange-%d-%d-n_graph-%d-p-%.2f' % ( cmd_args.min_n, cmd_args.max_n, cmd_args.n_graphs, cmd_args.er_p) num_train = int(frac_train * cmd_args.n_graphs) train_glist = [] test_glist = [] label_map = {} for i in range(cmd_args.min_c, cmd_args.max_c + 1): cur_list = load_pkl( '%s/ncomp-%d-%s.pkl' % (cmd_args.data_folder, i, pattern), cmd_args.n_graphs) print('Input filename:\n', '%s/ncomp-%d-%s.pkl' % (cmd_args.data_folder, i, pattern)) assert len(cur_list) == cmd_args.n_graphs print('----- type(cur_list) =\n', type(cur_list)) print('----- type(cur_list[0]) =\n', type(cur_list[0])) train_glist += [S2VGraph(cur_list[j], i) for j in range(num_train)] test_glist += [ S2VGraph(cur_list[j], i) for j in range(num_train, len(cur_list)) ] label_map[i] = i - cmd_args.min_c print('# train:', len(train_glist), ' # test:', len(test_glist)) return label_map, train_glist, test_glist