reproduce/plot_test_error.py [13:75]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mpl.use('agg')
import matplotlib.pyplot as plt
plt.ioff() #http://matplotlib.org/faq/usage_faq.html (interactive mode)
import numpy as np
import itertools
from random import shuffle
from label_lines import *

mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.size'] = '6'
linewidth = '0.3'
mpl.rcParams['lines.linewidth'] = linewidth
mpl.rcParams['axes.linewidth'] = linewidth
mpl.rcParams['xtick.major.width'] = linewidth
mpl.rcParams['ytick.major.width'] = linewidth
label_fontsize = 6

linestyles = ['-', '--', '-.', '-', '-', '--', '-.', '-']

colors = ["#000000", "#e41a1c", "#377eb8", "#4daf4a", "#984ea3",
          "#ff7f00", "#ffff33", "#a65628", "#f781bf"]

def plot_averaged(plot_name, plot_entries, xvals, yrange=None):
    run_dir = "runs"
    plot_dir = "plots"
    #plot_name = "test_error1"
    loss_key = "test_errors"
    ylabel = "Test error (%)"

    # Positions of the labels in x axis range, i.e. epoch number
    #xvals

    if not os.path.exists(plot_dir):
        os.makedirs(plot_dir)

    max_seen = 0
    plt.cla()
    fig = plt.figure(figsize=(3.3,2))
    ax = fig.add_subplot(111)

    ax.set_prop_cycle("color", colors)
    #ax.set_prop_cycle("linestyle", linestyles)
    line_idx = 0

    for plot_entry in plot_entries:
        fname_grob = plot_entry["fname"]
        data_files = glob.glob(fname_grob)

        if len(data_files) == 0:
            raise Exception("No files found matching path: {}".format(fname_grob))

        errors_lists = []
        for fname in data_files:
            print("(ALL) processing run ", fname)
            with open(fname, 'rb') as fdata:
                rd = pickle.load(fdata)

                values = rd[loss_key]
                # convert to errors
                errors = [100.0 - val for val in values]
                #pdb.set_trace()
                #print("losses: {}".format(losses))
                print("Final test error {} for {}".format(errors[-1], plot_entry["label"]))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



reproduce/plot_test_error_with_bars.py [13:77]:
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
mpl.use('agg')
import matplotlib.pyplot as plt
plt.ioff() #http://matplotlib.org/faq/usage_faq.html (interactive mode)
import numpy as np
import itertools
import scipy
import scipy.stats
from random import shuffle
from label_lines import *

#mpl.rcParams['mathtext.fontset'] = 'cm'
mpl.rcParams['font.family'] = 'serif'
mpl.rcParams['font.size'] = '6'
linewidth = '0.3'
mpl.rcParams['lines.linewidth'] = linewidth
mpl.rcParams['axes.linewidth'] = linewidth
mpl.rcParams['xtick.major.width'] = linewidth
mpl.rcParams['ytick.major.width'] = linewidth
label_fontsize = 6

linestyles = ['-', '--', '-.', '-', '-', '--', '-.', '-']

colors = ["#000000", "#e41a1c", "#377eb8", "#4daf4a", "#984ea3",
          "#ff7f00", "#ffff33", "#a65628", "#f781bf"]

def plot_averaged(plot_name, plot_entries, xvals, yrange=None):
    run_dir = "runs"
    plot_dir = "plots"
    loss_key = "test_errors"
    ylabel = "Test error (%)"

    # Positions of the labels in x axis range, i.e. epoch number
    #xvals

    if not os.path.exists(plot_dir):
        os.makedirs(plot_dir)

    max_seen = 0
    plt.cla()
    fig = plt.figure(figsize=(3.3,2))
    ax = fig.add_subplot(111)

    ax.set_prop_cycle("color", colors)
    #ax.set_prop_cycle("linestyle", linestyles)
    line_idx = 0

    for plot_entry in plot_entries:
        fname_grob = plot_entry["fname"]
        data_files = glob.glob(fname_grob)

        if len(data_files) == 0:
            raise Exception("No files found matching path: {}".format(fname_grob))

        errors_lists = []
        for fname in data_files:
            print("(ALL) processing run ", fname)
            with open(fname, 'rb') as fdata:
                rd = pickle.load(fdata)

                values = rd[loss_key]
                # convert to errors
                errors = [100.0 - val for val in values]
                #pdb.set_trace()
                #print("losses: {}".format(losses))
                print("Final test error {} for {}".format(errors[-1], plot_entry["label"]))
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -



