@@ -609,45 +609,37 @@ mystnb:
609609
610610π = 0.3
611611n = 100
612-
613612nv = [0.27, 0.34, 0.49, 0.74, 0.92, 1.1, 1.47, 2.94, 14.7]
614613x = np.arange(0, 1, 0.001)
615- y = [truth_border_function(i, π) for i in x]
614+ y = x - 0.4
616615z = x
617616x0 = np.arange(π, 1, 0.001)
618617x2 = np.arange(0, π, 0.001)
619618y1 = [π for i in x0]
620619y2 = [π for i in x2]
621620
622- # Calculate truth border more precisely
623- threshold = π * (1 - π) / (1 - 2 * π)**2
624- x3 = np.arange(threshold, 1, 0.001)
625- y3 = [(xi**0.5 - (1 - π)**0.5)**2 for xi in x3]
626-
627621plt.figure(figsize=(12, 10))
628622plt.plot(x, x, 'c:', linewidth=2)
629- plt.plot(x0, y1,'c:', linewidth=2)
630- plt.plot(y2, x2,'c:', linewidth=2)
631- plt.plot(x3, y3,'b-', linewidth=2, label='Truth Border')
632- plt.fill_between(x, y, z, facecolor='blue', alpha=0.05, label='Truth telling')
633- plt.fill_between(x3, 0, y3, facecolor='green', alpha=0.05, label='Lying')
634-
635- # Plot iso-variance curves
623+ plt.plot(x0, y1, 'c:', linewidth=2)
624+ plt.plot(y2, x2, 'c:', linewidth=2)
625+ plt.plot(x, y, 'r-', label='Truth Border')
626+ plt.fill_between(x, y, z, facecolor='blue', alpha=0.05, label='truth telling')
627+ plt.fill_between(x, 0, y, facecolor='green', alpha=0.05, label='lying')
636628for i in range(len(nv)):
637- y_var = π - (π**2 * (1 - π)**2) / (n * (nv[i] / n) * (x0 - π + 1e-8))
638- plt.plot(x0, y_var , 'k--', alpha=1 - 0.07 * i, label=f'V{i+1}')
629+ y = π - (π**2 * (1 - π)**2) / (n * (nv[i] / n) * (x0 - π + 1e-8))
630+ plt.plot(x0, y , 'k--', alpha=1 - 0.07 * i, label=f'V{i+1}')
639631
640- # Plot the calculated optimal point
641- plt.scatter(optimal_x, optimal_y, c='r', marker='*', label='Q (computed)', s=150)
632+
633+ plt.scatter(0.498, 0.1, c='b', marker='*', label='Q', s=150)
634+ plt.scatter(0.4, 0, c='y', label='X', s=150)
642635plt.xlim([0, 1])
643636plt.ylim([0, 0.5])
644637plt.xlabel('Pr(A|yes)')
645638plt.ylabel('Pr(A|no)')
646639plt.text(0.45, 0.35, "Truth Telling", fontdict={'size':28, 'style':'italic'})
647- plt.text(0.8, 0.1, "Lying", fontdict={'size':28, 'style':'italic'})
648- plt.text(optimal_x + 0.02, optimal_y + 0.005, f"Optimal Design\n({optimal_x:.3f}, {optimal_y:.3f})",
649- fontdict={'size':12,'color':'r'})
650- plt.legend(loc='upper right', fontsize='medium')
640+ plt.text(0.85, 0.35, "Lying",fontdict = {'size':28, 'style':'italic'})
641+ plt.text(0.515, 0.095, "Optimal Design", fontdict={'size':16,'color':'b'})
642+ plt.legend(loc=0, fontsize='large')
651643plt.show()
652644```
653645
0 commit comments