def plot_training_and_dev_metrics(training_metrics_df, dev_metrics_df, model_name, steps_per_epoch, epoch_count, output_fp):
    (output_dp, output_filename) = os.path.split(output_fp)
    (output_basename, output_ext) = os.path.splitext(output_filename)
    with PdfPages(output_fp) as pdfpages:
        (fig, ax1) = plt.subplots()
        legend = []
        ax1.plot(training_metrics_df.index, training_metrics_df.loc[:, 'loss'], color='tab:blue', alpha=0.8)
        legend.append('training loss')
        ax1.set_xlabel('epoch')
        tick_spacing = steps_per_epoch
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(tick_spacing))
        ax1.set_xticklabels(([0] + list(range((epoch_count + 1)))))
        ax1.set_ylabel('loss')
        ax1.legend(legend, loc='lower left')
        ax2 = ax1.twinx()
        legend = []
        ax2.plot(training_metrics_df.index, training_metrics_df.loc[:, 'acc'], color='tab:purple', alpha=0.8)
        legend.append('training acc')
        for dev_acc_column in [column for column in dev_metrics_df.columns if ('acc' in column)]:
            print('validation acc column: {}'.format(dev_acc_column))
            ax2.plot([(steps_per_epoch * (n + 1)) for n in dev_metrics_df.index], dev_metrics_df.loc[:, dev_acc_column], alpha=0.8)
            legend.append(dev_acc_column)
        ax2.set_title('Training and Development Metrics\n{}'.format(model_name))
        ax2.set_ylim(0.0, 1.0)
        ax2.set_ylabel('accuracy')
        print(legend)
        ax2.legend(legend, loc='lower right')
        pdfpages.savefig()
def plot_training_and_dev_metrics(training_metrics_df, dev_metrics_df, model_name, steps_per_epoch, epoch_count, output_fp):
    (output_dp, output_filename) = os.path.split(output_fp)
    (output_basename, output_ext) = os.path.splitext(output_filename)
    with PdfPages(output_fp) as pdfpages:
        (fig, ax1) = plt.subplots()
        legend = []
        ax1.plot(training_metrics_df.index, training_metrics_df.loc[:, 'loss'], color='tab:blue', alpha=0.8)
        legend.append('training loss')
        ax1.set_xlabel('epoch')
        tick_spacing = steps_per_epoch
        ax1.xaxis.set_major_locator(ticker.MultipleLocator(tick_spacing))
        ax1.set_xticklabels(([0] + list(range((epoch_count + 1)))))
        ax1.set_ylabel('loss')
        ax1.legend(legend, loc='lower left')
        ax2 = ax1.twinx()
        legend = []
        ax2.plot(training_metrics_df.index, training_metrics_df.loc[:, 'acc'], color='tab:purple', alpha=0.8)
        legend.append('training acc')
        for dev_acc_column in [column for column in dev_metrics_df.columns if ('acc' in column)]:
            print('validation acc column: {}'.format(dev_acc_column))
            ax2.plot([(steps_per_epoch * (n + 1)) for n in dev_metrics_df.index], dev_metrics_df.loc[:, dev_acc_column], alpha=0.8)
            legend.append(dev_acc_column)
        ax2.set_title('Training and Development Metrics\n{}'.format(model_name))
        ax2.set_ylim(0.0, 1.0)
        ax2.set_ylabel('accuracy')
        print(legend)
        ax2.legend(legend, loc='lower right')
        pdfpages.savefig()