예제 #1
0
    def testmain(self):

        # Same specification as before
        generation_specification = {"seed": [1, 2, 3, 4, 5, 6, 7, 8], "num_calls": [[10, 20, 30]]}
        specifications = SpecificationGenerator().generate(generation_specification)

        output_generation_specification = {"seed": [1, 2, 3, 4, 5, 6, 7, 8], "num_calls": [10, 20, 30]}
        output_specifications = SpecificationGenerator().generate(output_generation_specification)

        name = "test"
        # This time we will run them all in parallel
        runner = ExperimentRunner()
        expr = SimpleExperiment()
        runner.run(name, specifications, expr, specification_runner=MultiprocessingRunner(),
                   use_dashboard=True, propagate_exceptions=True,context_type="spawn")
        log_base = os.path.join("experiment_runs",name,"logs")
        for root, dirs, files in  os.walk(log_base):
            for file in files:
                with open(os.path.join(root,file),"r") as f:
                    lines = f.readlines()
                    self.assertNotEqual([],lines)

        for result in experiment_iterator(name):
            if result["result"] != []:
                output_specifications.remove(result["specification"])
        self.assertEqual([],output_specifications)
예제 #2
0
    def testmain(self):

        # Same specification as before
        generation_specification = {
            "seed": [1, 2, 3, 4, 5, 6, 7, 8],
            "num_calls": [[10, 20, 30]]
        }
        specifications = SpecificationGenerator().generate(
            generation_specification)

        output_generation_specification = {
            "seed": [1, 2, 3, 4, 5, 6, 7, 8],
            "num_calls": [10, 20, 30]
        }
        output_specifications = SpecificationGenerator().generate(
            output_generation_specification)

        name = "test"
        # This time we will run them all in parallel
        runner = ExperimentRunner()
        runner.run(name,
                   specifications,
                   SimpleExperiment(),
                   specification_runner=MultiprocessingRunner(),
                   use_dashboard=False,
                   propagate_exceptions=True)
        for result in experiment_iterator(name):
            if result["result"] != []:
                output_specifications.remove(result["specification"])
        self.assertEqual([], output_specifications)
        print(s)
        raise Exception()


def rename_title(s):
    if "fn" in s:
        return "Dynamic Function"
    elif "163636" in s:
        return "Validation Environment 1"
    else:
        return "Validation Environment 2"


df = pandas.DataFrame(columns=[x_name, y_name, hue_var_name, graph_split_name])
df = df.astype({y_name: 'float64', x_name: 'float64', hue_var_name: 'str'})
for experiment in experiment_iterator(experiment_name1):
    d = dict()
    if experiment["specification"]["rollout_allocation_method"] in [
            "sr", "ugapeb"
    ]:
        continue
    if experiment['result'] != []:
        d[x_name] = experiment[x_var[0]][x_var[1]]
        d[y_name] = np.sum(experiment["result"]["Ys"][-1])
        d[hue_var_name] = rename_arm_selector(
            str(experiment[hue_var[0]][hue_var[1]]))
        d[graph_split_name] = experiment[graph_split_var[0]][
            graph_split_var[1]]
        df = df.append(d, True)

for split_var in df[graph_split_name].unique():