data[i] = x cumulative_average = np.cumsum(data) / (np.arange(N) + 1) # plot moving average ctr plt.plot(cumulative_average) plt.plot(np.ones(N)*m1) plt.plot(np.ones(N)*m2) plt.plot(np.ones(N)*m3) plt.xscale('log') plt.show() return cumulative_average if __name__ == '__main__': eps = run_experiment_decaying_epsilon(1.0, 2.0, 3.0, 100000) oiv = run_experiment_oiv(1.0, 2.0, 3.0, 100000) ucb = run_experiment_ucb(1.0, 2.0, 3.0, 100000) bayes = run_experiment(1.0, 2.0, 3.0, 100000) # log scale plot plt.plot(eps, label='decaying-epsilon-greedy') plt.plot(oiv, label='optimistic') plt.plot(ucb, label='ucb1') plt.plot(bayes, label='bayesian') plt.legend() plt.xscale('log') plt.show() # linear plot plt.plot(eps, label='decaying-epsilon-greedy')
cumulative_average = np.cumsum(data) / (np.arange(N) + 1) # plot moving average ctr plt.plot(cumulative_average) plt.plot(np.ones(N)*m1) plt.plot(np.ones(N)*m2) plt.plot(np.ones(N)*m3) plt.xscale('log') plt.show() return cumulative_average if __name__ == '__main__': <<<<<<< HEAD eps = run_experiment_decaying_epsilon(1.0, 2.0, 3.0, 100000) oiv = run_experiment_oiv(1.0, 2.0, 3.0, 100000) ucb = run_experiment_ucb(1.0, 2.0, 3.0, 100000) bayes = run_experiment(1.0, 2.0, 3.0, 100000) ======= m1 = 1.0 m2 = 2.0 m3 = 3.0 eps = run_experiment_decaying_epsilon(m1, m2, m3, 100000) oiv = run_experiment_oiv(m1, m2, m3, 100000) ucb = run_experiment_ucb(m1, m2, m3, 100000) bayes = run_experiment(m1, m2, m3, 100000) >>>>>>> upstream/master # log scale plot plt.plot(eps, label='decaying-epsilon-greedy') plt.plot(oiv, label='optimistic')
# plot moving average ctr plt.plot(cumulative_average) plt.plot(np.ones(N)*m1) plt.plot(np.ones(N)*m2) plt.plot(np.ones(N)*m3) plt.xscale('log') plt.show() return cumulative_average if __name__ == '__main__': m1 = 1.0 m2 = 2.0 m3 = 3.0 eps = run_experiment_decaying_epsilon(m1, m2, m3, 100000) oiv = run_experiment_oiv(m1, m2, m3, 100000) ucb = run_experiment_ucb(m1, m2, m3, 100000) bayes = run_experiment(m1, m2, m3, 100000) # log scale plot plt.plot(eps, label='decaying-epsilon-greedy') plt.plot(oiv, label='optimistic') plt.plot(ucb, label='ucb1') plt.plot(bayes, label='bayesian') plt.legend() plt.xscale('log') plt.show() # linear plot plt.plot(eps, label='decaying-epsilon-greedy')
plt.plot(cumulative_avg) plt.plot(np.ones(N) * m1) plt.plot(np.ones(N) * m2) plt.plot(np.ones(N) * m3) plt.xscale('log') plt.show() return cumulative_avg if __name__ == '__main__': m1, m2, m3 = 1.0, 2.0, 3.0 N = 100000 eps = run_experiment_decaying_eps(m1, m2, m3, N) oiv = run_experiment_oiv(m1, m2, m3, N, 10) ucb = run_experiment_ucb(m1, m2, m3, N) bayes = run_experiment_bayesian_sampling(m1, m2, m3, N) # Log scale plot plt.plot(eps, label='Decaying Epsilon Greedy') plt.plot(oiv, label='Optimistic') plt.plot(ucb, label='UCB1') plt.plot(bayes, label='Bayesian') plt.legend() plt.xscale('log') plt.show() # Linear plot plt.plot(eps, label='Decaying Epsilon Greedy') plt.plot(oiv, label='Optimistic')