Exemple #1
0
 def test_resume_without_cache_from_instance_with_param(self):
     generator = Generator2()
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object",
         func=generator.generate,
         func_args={"baz": "uho"})
     self.assertEqual({"foobar": "uho"}, want_to_load_object)
Exemple #2
0
 def test_resume_with_cache(self):
     org_object = {"foobar": "baz"}
     file_path = _generate_file_path_from_label("want-to-load-object")
     freeze(org_object, file_path)
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object", func=generate)
     self.assertEqual(org_object, want_to_load_object)
Exemple #3
0
 def test_resume_not_disabling_stage(self):
     env.HIDEOUT_SKIP_STAGES = ["preliminary"]
     org_object = {"foobar": "baz"}
     file_path = _generate_file_path_from_label("want-to-load-object")
     freeze(org_object, file_path)
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object", func=generate, stage="body")
     self.assertEqual({"foobar": "baz"}, want_to_load_object)
Exemple #4
0
 def test_resume_with_disabling_cache(self):
     env.HIDEOUT_ENABLE_CACHE = False  # disabling cache
     org_object = {"foobar": "baz"}
     file_path = _generate_file_path_from_label("want-to-load-object")
     freeze(org_object, file_path)
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object", func=generate)
     self.assertEqual({"foobar": "bar"}, want_to_load_object)
Exemple #5
0
 def fit(self, search_parameters: List = SEARCH_PARAMETERS) -> float:
     clf, self.model = hideout.resume_or_generate(
         label="classifier",
         func=self._fit,
         func_args={"search_parameters": search_parameters})
     print("best parameters : ", clf.best_params_)
     print("best scores : ", clf.best_score_)
     return clf.best_score_
Exemple #6
0
def cmd():
    result = hideout.resume_or_generate(
        func=generate_large_object,
        func_args={"times": 10}
    )
    print(result)
Exemple #7
0
 def test_resume_without_cache_from_instance(self):
     generator = Generator()
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object", func=generator.generate)
     self.assertEqual({"foobar": "bar"}, want_to_load_object)
Exemple #8
0
 def test_resume_and_save_to_not_exist_dir(self):
     env.HIDEOUT_CACHE_DIR = tempfile.mkdtemp() + "/foobar"
     want_to_load_object = hideout.resume_or_generate(
         label="want-to-load-object", func=generate)
     self.assertEqual({"foobar": "bar"}, want_to_load_object)
Exemple #9
0
 def __init__(self):
     self.vec, self.feature_vectors = hideout.resume_or_generate(
         label="vectorizer", func=self._vectorizer)
     self.clf = None
     self.model = None