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(oiv, label='optimistic')
    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()

    for b in bandits:
        print(b.mean)


if __name__ == '__main__':
    eps_decay = run_experiment_decaying_epsilon(1.0, 2.0, 3.0, 10000)

    iov = run_experiment_iov(1.0, 2.0, 3.0, 10000)

    ucb = run_experiment_ucb(1.0, 2.0, 3.0, 10000)

    bayes = run_experiment(1.0, 2.0, 3.0, 10000)

    plt.plot(c_1, label='eps-decaying')
    plt.plot(iov, label='optimistic')
    plt.plot(ucb, label='ucb')
    plt.plot(bayes, label='bayes')
    plt.legend()
    plt.xscale('log')
    plt.show()
Beispiel #3
0
  # 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')
  plt.plot(ucb, label='ucb1')