Ejemplo n.º 1
0
def test_experiment_context_add_param():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.add_parameter("num_iteration", 1000) == 1
    assert ctx.params["num_iteration"] == 1000
Ejemplo n.º 2
0
def test_experiment_context_remove_param():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.remove_parameter("learning_rate") == 1
    assert "learning_rate" not in ctx.params
Ejemplo n.º 3
0
def test_experiment_context_remove_stage():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.remove_stage("preprocess") == 1
    assert "preprocess" not in ctx.pipeline
    assert len(ctx.pipeline["clean"]) == 1
Ejemplo n.º 4
0
def test_experiment_context_add_script():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.add_script("preprocess", "scr-1") == 1
    assert len(ctx.pipeline["preprocess"]) == 2
    assert len(ctx.pipeline["clean"]) == 1
Ejemplo n.º 5
0
def test_experiment_context_check_params():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.params["learning_rate"] == 0.1
Ejemplo n.º 6
0
def test_experiment_context_check_pipeline():
    ctx = ExperimentContext(None, ContextInitializer(xp_ctx_init, None))
    ctx.create_storage("xp_test")
    assert ctx.pipeline["preprocess"]
    assert ctx.pipeline["clean"]
    assert len(ctx.pipeline) == 2
Ejemplo n.º 7
0
 def _create_experiment_object(self, experiment_name):
     xp_dir = self._get_experiment_location(experiment_name)
     ctx = ExperimentContext(xp_dir, ContextInitializer.experiment)
     args = (experiment_name, self._scripts, ctx)
     return QuarkExperiment(*args)