plt.savefig(path+'network_rbf_thres_%s_edge_num_%s'%(int(thres*10), edge_num)+'.png', dpi=300) plt.savefig(path+'network_rbf_thres_%s_edge_num_%s'%(int(thres*10), edge_num)+'.eps', dpi=300) 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, alpha, delta, sigma, state) gob_model=GOB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_adj, alpha, delta, sigma, beta, state) lapucb_model=LAPUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_adj, noise_matrix, alpha, delta, sigma, beta, thres, state) lapucb_sim_model=LAPUCB_SIM(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_adj, noise_matrix, alpha, delta, sigma, beta, thres, state) club_model = CLUB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, alpha, alpha_2, delta, sigma, beta, state) linucb_regret, linucb_error, linucb_beta=linucb_model.run(user_seq, item_pool_seq, iteration) gob_regret, gob_error, gob_beta, gob_graph=gob_model.run(user_seq, item_pool_seq, iteration) lapucb_regret, lapucb_error, lapucb_beta, lapucb_graph=lapucb_model.run(user_seq, item_pool_seq, iteration) lapucb_sim_regret, lapucb_sim_error, lapucb_sim_beta, lapucb_sim_graph=lapucb_sim_model.run( user_seq, item_pool_seq, iteration) club_regret, club_error,club_cluster_num, club_beta=club_model.run(user_seq, item_pool_seq, iteration) linucb_regret_matrix[l], linucb_error_matrix[l]=linucb_regret, linucb_error gob_regret_matrix[l], gob_error_matrix[l], gob_graph_matrix[l]=gob_regret, gob_error, gob_graph lapucb_regret_matrix[l], lapucb_error_matrix[l], lapucb_graph_matrix[l]=lapucb_regret, lapucb_error, lapucb_graph lapucb_sim_regret_matrix[l], lapucb_sim_error_matrix[l], lapucb_sim_graph_matrix[l]=lapucb_sim_regret, lapucb_sim_error, lapucb_sim_graph 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) gob_regret=np.mean(gob_regret_matrix, axis=0) gob_error=np.mean(gob_error_matrix, axis=0) gob_graph=np.mean(gob_graph_matrix, axis=0)
true_lap[i,j]=-old_adj[i,j]/D[i,i] np.fill_diagonal(true_lap, 1) true_adj=old_adj.copy() user_feature_matrix=dictionary_matrix_generator(user_num, dimension, true_lap, smooth) smoothness_list[index]=np.trace(np.dot(np.dot(user_feature_matrix.T, true_lap), user_feature_matrix)) true_payoffs=np.dot(user_feature_matrix, item_feature_matrix.T) linucb_model=LINUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, alpha, delta, sigma, state) lapucb_model=LAPUCB(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_adj, true_lap, noise_matrix, alpha, delta, sigma, beta, thres, state) lapucb_sim_model=LAPUCB_SIM(dimension, user_num, item_num, pool_size, item_feature_matrix, user_feature_matrix, true_payoffs, true_adj, true_lap, noise_matrix, alpha, delta, sigma, beta, thres, 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) lapucb_regret, lapucb_error, lapucb_beta, lapucb_x_norm, lapucb_inst_regret, lapucb_ucb, lapucb_sum_x_norm, lapucb_real_beta=lapucb_model.run(user_seq, item_pool_seq, iteration) lapucb_sim_regret, lapucb_sim_error, lapucb_sim_beta, lapucb_sim_x_norm, lapucb_sim_avg_norm, lapucb_sim_inst_regret, lapucb_sim_ucb, lapucb_sim_sum_x_norm=lapucb_sim_model.run( user_seq, item_pool_seq, iteration) linucb_regret_matrix_loop[l], linucb_error_matrix_loop[l]=linucb_regret, linucb_error lapucb_regret_matrix_loop[l], lapucb_error_matrix_loop[l]=lapucb_regret, lapucb_error lapucb_sim_regret_matrix_loop[l], lapucb_sim_error_matrix_loop[l]=lapucb_sim_regret, lapucb_sim_error linucb_regret_matrix[index], linucb_error_matrix[index]=np.mean(linucb_regret_matrix_loop, axis=0), np.mean(linucb_error_matrix_loop, axis=0) lapucb_regret_matrix[index], lapucb_error_matrix[index]=np.mean(lapucb_regret_matrix_loop, axis=0), np.mean(lapucb_error_matrix_loop, axis=0) lapucb_sim_regret_matrix[index], lapucb_sim_error_matrix[index]=np.mean(lapucb_sim_regret_matrix_loop, axis=0), np.mean(lapucb_sim_error_matrix_loop, axis=0) plt.figure(figsize=(5,5)) for ind, sm in enumerate(smooth_list): plt.plot(lapucb_regret_matrix[ind], '-', markevery=0.1, label='sm=%s'%(np.round(smoothness_list[ind], decimals=2))) plt.ylim([0,80]) plt.ylabel('Cumulative Regret', fontsize=16) plt.xlabel('Time', fontsize=16)