def show_group_frontiers(groups, name, XMAX, YMIN, baseline=None):
colors = cycle(['m','g','b','y','c','k'])
ax = pl.figure().add_subplot(111)
groups = list(groups)
print
print yellow % name
print yellow % '============'
for color, (group_name, r) in zip(colors, groups):
print '%s; color: %s; len %s' % (group_name, color, len(r))
for color, (group_name, r) in zip(colors, groups):
show_frontier(r.dev_runtime, r.dev_accuracy, label='%s (dev)' % group_name,
c=color, alpha=0.5, ax=ax, XMAX=XMAX, YMIN=YMIN, lw=LW)
# show_frontier(r.train_runtime, r.train_accuracy, label='%s (train)' % group_name,
# c=color, linestyle=':', alpha=0.5, ax=ax, XMAX=XMAX, YMIN=YMIN, lw=LW)
ax.set_xlabel('runtime')
ax.set_ylabel('accuracy')
if baseline is not None:
# show_frontier(baseline.train_runtime, baseline.train_accuracy, ax=pl.gca(),
# c='r', linestyle=':', alpha=0.25, label='baseline (train)', XMAX=XMAX, YMIN=YMIN, lw=LW)
show_frontier(baseline.dev_runtime, baseline.dev_accuracy, ax=pl.gca(),
c='r', alpha=0.25, label='baseline (dev)', XMAX=XMAX, YMIN=YMIN, lw=LW)
ax.set_title('Frontiers grouped-by %s' % name)
#ax.set_xlim(0.35, .85)
#ax.set_ylim(.74, .83)
if 0:
ax.legend(loc='best')
pl.tight_layout()
else:
# Shink current axis by 20%
ax.legend(loc='center left', bbox_to_anchor=(1, 0.5))
box = ax.get_position()
ax.set_position([box.x0, box.y0, box.width * 0.85, box.height])
ax.figure.canvas.draw()
评论列表
文章目录