예제 #1
0
ax2.set_yscale('log', basey=2)

ax3.set_xlabel('$E_{D2D}/E_{Glob}$')
ax3.set_ylabel('total delay ($x 10^1$ s)')
# ax3.set_yscale('log')

ax1.grid(b=True)
ax2.grid()
ax3.grid()

ax1.set_title('(a)', y=-0.4)
ax2.set_title('(b)', y=-0.4)
ax3.set_title('(c)', y=-0.4)

ax1.legend(
    loc='upper right',
    ncol=args.ncols,
    bbox_to_anchor=(-0.05, 1.1, 3.9, .25),
    mode='expand',
    frameon=False,
    # handlelength=0.7
)

args.name = args.name.format(args.accuracy)
print('Saving: ', args.name)
fig.subplots_adjust(wspace=0.4)
plt.savefig('../ckpts/{}_{}/plots/{}'.format(args.dataset, args.num_nodes,
                                             args.name),
            bbox_inches='tight',
            dpi=args.dpi)
예제 #2
0
for idx, history in enumerate(args.histories):
    if args.infer_folder == 1:
        history = '../ckpts/{}_{}/history/{}'.format(args.dataset,
                                                     args.num_nodes, history)
    h_epoch, h_acc, _, _, h_loss, _, _, h_uplink, _, _ = pkl.load(
        open(history, 'rb'))
    h_epoch = h_epoch[:args.epochs]
    h_acc = h_acc[:args.epochs]
    h_loss = h_loss[:args.epochs]
    h_uplink = h_uplink[:args.epochs]
    ax1.plot(h_epoch, h_acc, colors[idx], label=args.labels[idx])
    ax2.plot(h_epoch, np.cumsum(h_uplink), colors[idx], label=args.labels[idx])

ax1.set_xlabel('epochs')
ax1.set_ylabel('accuracy')
ax2.set_xlabel('epochs')
ax2.set_ylabel('# uplink')
ax1.grid(ls='-.', lw=0.25)
ax2.grid(ls='-.', lw=0.25)
ax2.legend(loc='upper right',
           ncol=args.ncols,
           bbox_to_anchor=(-1.33, 1.1, 2.35, .1),
           mode='expand',
           frameon=False)
print('Saving: ', args.name)
fig.subplots_adjust(wspace=0.3)
if args.infer_folder == 1:
    args.name = '../ckpts/{}_{}/plots/{}'.format(args.dataset, args.num_nodes,
                                                 args.name)
plt.savefig(args.name, bbox_inches='tight', dpi=args.dpi)