for index, alpha_2 in enumerate(alpha2_list): linucb_regret_matrix = np.zeros((loop, iteration)) linucb_error_matrix = np.zeros((loop, iteration)) club_regret_matrix = np.zeros((loop, iteration)) club_error_matrix = np.zeros((loop, iteration)) for l in range(loop): print('loop/total_loop', l, loop) linucb_model = LINUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, 0.25, delta, sigma, state) club_model = CLUB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, 0.25, alpha_2, delta, sigma, beta, state) linucb_regret, linucb_error, linucb_beta, linucb_x_norm, linucb_inst_regret, linucb_ucb, linucb_sum_x_norm, linucb_real_beta = linucb_model.run( user_seq, item_pool_seq, iteration) club_regret, club_error, club_cluster_num, club_beta, club_x_norm = club_model.run( user_seq, item_pool_seq, iteration) linucb_regret_matrix[l], linucb_error_matrix[ l] = linucb_regret, linucb_error club_regret_matrix[l], club_error_matrix[l] = club_regret, club_error linucb_regret = np.mean(linucb_regret_matrix, axis=0) linucb_error = np.mean(linucb_error_matrix, axis=0) club_regret = np.mean(club_regret_matrix, axis=0)
true_adj_binary[true_adj_binary>0]=1 true_lap_binary=np.diag(np.sum(true_adj_binary, axis=1))-true_adj_binary lap=np.identity(user_num) normed_lap=lap noise_matrix=np.zeros((user_num, item_num)) user_seq=np.random.choice(range(user_num), size=iteration) item_pool_seq=np.random.choice(range(item_num), size=(iteration, pool_size)) linucb_model=LINUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, alpha, delta, sigma) gob_model=GOB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_lap_binary, alpha, delta, sigma, beta) colin_model=COLIN(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_normed_adj, alpha, delta, sigma, beta) lapucb_model=LAPUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, noise_matrix, normed_lap, alpha, delta, sigma) lapucb_sim_model=LAPUCB_SIM(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, noise_matrix, normed_lap, alpha, delta, sigma) club_model = CLUB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs,normed_lap, alpha, alpha_2, delta, sigma, beta) sclub_model = SCLUB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs,normed_lap, alpha, delta, sigma, beta) linucb_regret, linucb_error, linucb_beta=linucb_model.run(user_seq, item_pool_seq, iteration) gob_regret, gob_error, gob_beta=gob_model.run(user_seq, item_pool_seq, iteration) colin_regret, colin_error, colin_beta=colin_model.run(user_seq, item_pool_seq, iteration) lapucb_regret, lapucb_error, lapucb_beta=lapucb_model.run(user_seq, item_pool_seq, iteration) lapucb_sim_regret, lapucb_sim_error, lapucb_sim_beta=lapucb_sim_model.run(user_seq, item_pool_seq, iteration) club_regret, club_error,club_graph_error, club_cluster_num, club_beta=club_model.run(user_seq, item_pool_seq, iteration) sclub_regret, sclub_error,sclub_graph_error, sclub_cluster_num, sclub_beta=sclub_model.run(user_seq, item_pool_seq, iteration) np.fill_diagonal(true_adj,0) true_adj=np.round(true_adj, decimals=1) graph, edge_num=create_networkx_graph(user_num, true_adj)