Exemplo n.º 1
0
 def load():
     if progress_filename == "progress.csv":
         return core.load_exps_data(dirnames)
     elif progress_filename == "tensorboard_log.npy":
         return load_exps_data_numpy(dirnames, progress_filename=progress_filename)
     else:
         return core.load_exps_data(dirnames, progress_filename=progress_filename)
Exemplo n.º 2
0
 def load():
     if progress_filename == "progress.csv":
         return core.load_exps_data(dirnames)
     elif progress_filename == "tensorboard_log.npy":
         return load_exps_data_numpy(dirnames, NumpyLogReader(), progress_filename=progress_filename, )
     elif custom_log_reader:
         return load_exps_data_numpy(dirnames, custom_log_reader, progress_filename=progress_filename, )
     else:
         return core.load_exps_data(dirnames, progress_filename=progress_filename)
Exemplo n.º 3
0
def load_exps(dirnames, filter_fn=true_fn, suppress_output=False):
    if suppress_output:
        with suppress_stdout():
            exps = core.load_exps_data(dirnames)
    else:
        exps = core.load_exps_data(dirnames)
    good_exps = []
    for e in exps:
        if filter_fn(e):
            good_exps.append(e)
    return good_exps
def reload_data(data_paths):
    """
    Iterate through the data folder and organize each experiment into a list, with their progress data, hyper-parameters
    and also analyze all the curves and give the distinct hyper-parameters.
    :param data_path: Path of the folder storing all the data
    :return [exps_data, plottable_keys, distinct_params]
        exps_data: A list of the progress data for each curve. Each curve is an AttrDict with the key
                    'progress': A dictionary of plottable keys. The val of each key is an ndarray representing the
                        values of the key during training, or one column in the progress.txt file.
                    'params'/'flat_params': A dictionary of all hyperparameters recorded in 'variants.json' file.
        plottable_keys: A list of strings representing all the keys that can be plotted.
        distinct_params: A list of hyper-parameters which have different values among all the curves. This can be used
                    to split the graph into multiple figures. Each element is a tuple (param, list_of_values_to_take).
    """

    exps_data = copy.copy(
        core.load_exps_data(data_paths,
                            disable_variant=False,
                            ignore_missing_keys=True))
    plottable_keys = copy.copy(
        sorted(
            list(set(flatten(list(exp.progress.keys())
                             for exp in exps_data)))))
    distinct_params = copy.copy(sorted(
        core.extract_distinct_params(exps_data)))

    return exps_data, plottable_keys, distinct_params
Exemplo n.º 5
0
def reload_data():
    global exps_data
    global plottable_keys
    global distinct_params
    exps_data = core.load_exps_data(args.data_paths, args.disable_variant)
    plottable_keys = sorted(list(
        set(flatten(list(exp.progress.keys()) for exp in exps_data))))
    distinct_params = sorted(core.extract_distinct_params(exps_data))
Exemplo n.º 6
0
def reload_data():
    global exps_data
    global plottable_keys
    global distinct_params
    exps_data = core.load_exps_data(args.data_paths,args.disable_variant)
    plottable_keys = sorted(list(
        set(flatten(list(exp.progress.keys()) for exp in exps_data))))
    distinct_params = sorted(core.extract_distinct_params(exps_data))
Exemplo n.º 7
0
def reload_data():
    global exps_data
    global plottable_keys
    global distinct_params
    exps_data = core.load_exps_data(args.data_path)
    plottable_keys = list(
        set(flatten(exp.progress.keys() for exp in exps_data)))
    distinct_params = core.extract_distinct_params(exps_data)
Exemplo n.º 8
0
def reload_data():
    global exps_data
    global plottable_keys
    global distinct_params
    exps_data = core.load_exps_data(args.data_paths,args.disable_variant)
    plottable_keys = list(
        set(flatten(list(exp.progress.keys()) for exp in exps_data)))
    plottable_keys = sorted([k for k in plottable_keys if k is not None])
    # distinct_params = sorted(core.extract_distinct_params(exps_data))
    distinct_params = []  # todo: to get normal plots at all
Exemplo n.º 9
0
def reload_data():
    global exps_data
    global plottable_keys
    global distinct_params
    args.disable_variant = False
    exps_data = core.load_exps_data(args.data_paths, args.disable_variant)
    plottable_keys = list(
        set(flatten(list(exp.progress.keys()) for exp in exps_data)))
    plottable_keys = sorted([k for k in plottable_keys if k is not None])
    distinct_params = sorted(core.extract_distinct_params(exps_data))
    print("\n\n distinct_params:{} \n\n".format(distinct_params))
Exemplo n.º 10
0
plt.rc('axes', labelsize=MEDIUM_SIZE)  # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE)  # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE)  # fontsize of the tick labels
plt.rc('legend', fontsize=MEDIUM_SIZE)  # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title

prop_cycle = plt.rcParams['axes.prop_cycle']
colors = prop_cycle.by_key()['color']
COLORS = dict(ours=colors.pop(0))

LEGEND_ORDER = {'ppo': 0, 'trpo': 1, 'vpg': 2}

########## Add data path here #############
data_path = "data/s3/ppo-maml-hyperparam-final-2-lmao"
###########################################
exps_data = core.load_exps_data([data_path], False)


def sorting_legend(label):
    return LEGEND_ORDER[label]


def get_color(label):
    if label not in COLORS.keys():
        COLORS[label] = colors.pop(0)
    return COLORS[label]


def total_under_curve(exp_data):
    mean_scores = []
    for exp in exp_data:
Exemplo n.º 11
0
 def load():
     if progress_filename == "progress.csv":
         return core.load_exps_data(dirnames)
     else:
         return core.load_exps_data(dirnames, progress_filename=progress_filename)
Exemplo n.º 12
0
from rllab.viskit import frontend
from rllab.viskit import core
import matplotlib.pyplot as plt
from plots.plot_utils import *

plt.style.use('ggplot')
#plt.rc('font', family='Times New Roman')
import matplotlib
# matplotlib.use('TkAgg')
#matplotlib.font_manager._rebuild()

data_path_fast_lr = None
data_path_num_models = None
data_path_maml_iter = None

exps_data_fast_lr = core.load_exps_data([data_path_fast_lr], False)
exps_data_num_models = core.load_exps_data([data_path_num_models], False)
exps_data_maml_iter = core.load_exps_data([data_path_maml_iter], False)

SMALL_SIZE = 30
MEDIUM_SIZE = 32
BIGGER_SIZE = 36
LINEWIDTH = 4

plt.rc('font', size=SMALL_SIZE)          # controls default text sizes
plt.rc('axes', titlesize=BIGGER_SIZE)     # fontsize of the axes title
plt.rc('axes', labelsize=MEDIUM_SIZE)    # fontsize of the x and y labels
plt.rc('xtick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
plt.rc('ytick', labelsize=SMALL_SIZE)    # fontsize of the tick labels
plt.rc('legend', fontsize=SMALL_SIZE)    # legend fontsize
plt.rc('figure', titlesize=BIGGER_SIZE)  # fontsize of the figure title