import matplotlib.pyplot as plt

def prepare_standardplot(title, xlabel):
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15,7))
    fig.suptitle(title)
    ax1.set_ylabel('MSE')
    ax1.set_xlabel(xlabel)
    ax2.set_ylabel('Error [% incorrect]')
    ax2.set_xlabel(xlabel)
    return fig, ax1, ax2

def finalize_standardplot(fig, ax1, ax2):
    ax1handles, ax1labels = ax1.get_legend_handles_labels()
    if len(ax1labels) > 0:
        ax1.legend(ax1handles, ax1labels)
    ax2handles, ax2labels = ax2.get_legend_handles_labels()
    if len(ax2labels) > 0:
        ax2.legend(ax2handles, ax2labels)
    fig.tight_layout()
    plt.subplots_adjust(top=0.9)

def plot_history(history, title):
    fig, ax1, ax2 = prepare_standardplot(title, 'epoch')
    ax1.plot(history['train_loss'], label = "training")
    ax1.plot(history['test_loss'], label = "test")
    ax2.plot(history['train_error'], label = "training")
    ax2.plot(history['test_error'], label = "test")
    finalize_standardplot(fig, ax1, ax2)
    return fig
c8dd4b0d5703be93a4aff501325e393384249f2e
<mask token>

<mask token>


def prepare_standardplot(title, xlabel):
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 7))
    fig.suptitle(title)
    ax1.set_ylabel('MSE')
    ax1.set_xlabel(xlabel)
    ax2.set_ylabel('Error [% incorrect]')
    ax2.set_xlabel(xlabel)
    return fig, ax1, ax2


<mask token>


def plot_history(history, title):
    fig, ax1, ax2 = prepare_standardplot(title, 'epoch')
    ax1.plot(history['train_loss'], label='training')
    ax1.plot(history['test_loss'], label='test')
    ax2.plot(history['train_error'], label='training')
    ax2.plot(history['test_error'], label='test')
    finalize_standardplot(fig, ax1, ax2)
    return fig

<mask token>


def prepare_standardplot(title, xlabel):
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 7))
    fig.suptitle(title)
    ax1.set_ylabel('MSE')
    ax1.set_xlabel(xlabel)
    ax2.set_ylabel('Error [% incorrect]')
    ax2.set_xlabel(xlabel)
    return fig, ax1, ax2


def finalize_standardplot(fig, ax1, ax2):
    ax1handles, ax1labels = ax1.get_legend_handles_labels()
    if len(ax1labels) > 0:
        ax1.legend(ax1handles, ax1labels)
    ax2handles, ax2labels = ax2.get_legend_handles_labels()
    if len(ax2labels) > 0:
        ax2.legend(ax2handles, ax2labels)
    fig.tight_layout()
    plt.subplots_adjust(top=0.9)


def plot_history(history, title):
    fig, ax1, ax2 = prepare_standardplot(title, 'epoch')
    ax1.plot(history['train_loss'], label='training')
    ax1.plot(history['test_loss'], label='test')
    ax2.plot(history['train_error'], label='training')
    ax2.plot(history['test_error'], label='test')
    finalize_standardplot(fig, ax1, ax2)
    return fig

import matplotlib.pyplot as plt


def prepare_standardplot(title, xlabel):
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15, 7))
    fig.suptitle(title)
    ax1.set_ylabel('MSE')
    ax1.set_xlabel(xlabel)
    ax2.set_ylabel('Error [% incorrect]')
    ax2.set_xlabel(xlabel)
    return fig, ax1, ax2


def finalize_standardplot(fig, ax1, ax2):
    ax1handles, ax1labels = ax1.get_legend_handles_labels()
    if len(ax1labels) > 0:
        ax1.legend(ax1handles, ax1labels)
    ax2handles, ax2labels = ax2.get_legend_handles_labels()
    if len(ax2labels) > 0:
        ax2.legend(ax2handles, ax2labels)
    fig.tight_layout()
    plt.subplots_adjust(top=0.9)


def plot_history(history, title):
    fig, ax1, ax2 = prepare_standardplot(title, 'epoch')
    ax1.plot(history['train_loss'], label='training')
    ax1.plot(history['test_loss'], label='test')
    ax2.plot(history['train_error'], label='training')
    ax2.plot(history['test_error'], label='test')
    finalize_standardplot(fig, ax1, ax2)
    return fig

import matplotlib.pyplot as plt

def prepare_standardplot(title, xlabel):
    fig, (ax1, ax2) = plt.subplots(1, 2, figsize=(15,7))
    fig.suptitle(title)
    ax1.set_ylabel('MSE')
    ax1.set_xlabel(xlabel)
    ax2.set_ylabel('Error [% incorrect]')
    ax2.set_xlabel(xlabel)
    return fig, ax1, ax2

def finalize_standardplot(fig, ax1, ax2):
    ax1handles, ax1labels = ax1.get_legend_handles_labels()
    if len(ax1labels) > 0:
        ax1.legend(ax1handles, ax1labels)
    ax2handles, ax2labels = ax2.get_legend_handles_labels()
    if len(ax2labels) > 0:
        ax2.legend(ax2handles, ax2labels)
    fig.tight_layout()
    plt.subplots_adjust(top=0.9)

def plot_history(history, title):
    fig, ax1, ax2 = prepare_standardplot(title, 'epoch')
    ax1.plot(history['train_loss'], label = "training")
    ax1.plot(history['test_loss'], label = "test")
    ax2.plot(history['train_error'], label = "training")
    ax2.plot(history['test_error'], label = "test")
    finalize_standardplot(fig, ax1, ax2)
    return fig