Exemplo n.º 1
0
plt.grid()

plt.subplot(2, 2, 2)
plt.plot(range(T), W[:, 1])
plt.xlabel('t')
plt.ylabel(r'$w_2$')
plt.title(r'$\theta_2 = 0.3$')
plt.grid()

plt.subplot(2, 2, 3)
plt.plot(range(T), W_log[:, 0])
plt.xlabel('t')
plt.ylabel(r'$-\frac{1}{t} \log w_1(t)$')
plt.grid()

D2 = aux.KL(theta_true, Theta[1]) - aux.KL(theta_true, Theta[0])
#print('D2 =', D2)
plt.subplot(2, 2, 4)
plt.plot(range(T), W_log[:, 1])
plt.plot(range(T),
         np.ones(T) * D2,
         color='red',
         label=r'$D(\theta^*||\theta^{(2)}) - D(\theta^*||\theta^{(1)})$')
plt.legend()
plt.ylim([0, D2 * 2])
plt.xlabel('t')
plt.ylabel(r'$-\frac{1}{t} \log w_2(t)$')
plt.grid()

plt.suptitle(r'$\theta^* = 0.6$')
#plt.savefig('figs/TS_vs_UCB.png')
Exemplo n.º 2
0
    plt.grid()

    plt.subplot(2, 3, 3)
    plt.plot(range(T), s[:, 2])
    plt.xlabel('t')
    plt.ylabel(r'$w_3$')
    plt.title(r'$\theta_3 = 0.2$')
    plt.grid()

    plt.subplot(2, 3, 4)
    plt.plot(range(T), s_log[:, 0])
    plt.xlabel('t')
    plt.ylabel(r'$-\frac{1}{t} \log w_1(t)$')
    plt.grid()

    D2 = aux.KL(0.6, 0.5)
    plt.subplot(2, 3, 5)
    plt.plot(range(T), s_log[:, 1])
    plt.plot(range(T),
             np.ones(T) * D2,
             color='red',
             label=r'$D(\theta^*||\theta^{(2)}) - D(\theta^*||\theta^{(1)})$')
    plt.legend()
    plt.ylim([0, D2 * 3])
    plt.xlabel('t')
    plt.ylabel(r'$-\frac{1}{t} \log w_2(t)$')
    plt.grid()

    D3 = aux.KL(0.6, 0.2)
    plt.subplot(2, 3, 6)
    plt.plot(range(T), s_log[:, 2])