defload_data(data, prefix='data/'): """ Load graph, feature, and label given dataset name :returns: home and single-relation graphs, feature, label """
if data == 'yelp': data_file = loadmat(prefix + 'YelpChi.mat') labels = data_file['label'].flatten() feat_data = data_file['features'].todense().A # load the preprocessed adj_lists withopen(prefix + 'yelp_homo_adjlists.pickle', 'rb') as file: homo = pickle.load(file) file.close() withopen(prefix + 'yelp_rur_adjlists.pickle', 'rb') as file: relation1 = pickle.load(file) file.close() withopen(prefix + 'yelp_rtr_adjlists.pickle', 'rb') as file: relation2 = pickle.load(file) file.close() withopen(prefix + 'yelp_rsr_adjlists.pickle', 'rb') as file: relation3 = pickle.load(file) file.close() elif data == 'amazon': data_file = loadmat(prefix + 'Amazon.mat') labels = data_file['label'].flatten() feat_data = data_file['features'].todense().A # load the preprocessed adj_lists withopen(prefix + 'amz_homo_adjlists.pickle', 'rb') as file: homo = pickle.load(file) file.close() withopen(prefix + 'amz_upu_adjlists.pickle', 'rb') as file: relation1 = pickle.load(file) file.close() withopen(prefix + 'amz_usu_adjlists.pickle', 'rb') as file: relation2 = pickle.load(file) file.close() withopen(prefix + 'amz_uvu_adjlists.pickle', 'rb') as file: relation3 = pickle.load(file)